Skip to content

Commit

Permalink
Fix Lint Error
Browse files Browse the repository at this point in the history
  • Loading branch information
cloneofghosts committed Aug 22, 2024
1 parent a9380ab commit a20734c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/pirateweather/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"nbm_fire_update_time": "NBM Fire Update Time",
"hrrr_18_48_update_time": "HRRR 18-48 Update Time",
"gfs_update_time": "GFS Update Time",
"gefs_update_time": "GEFS Update Time",
"gefs_update_time": "GEFS Update Time",
}

LANGUAGES = [
Expand Down
14 changes: 9 additions & 5 deletions custom_components/pirateweather/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
icon="mdi:clock-time-three-outline",
device_class=SensorDeviceClass.TIMESTAMP,
forecast_mode=[],
),
),
"hrrr_0_18_update_time": PirateWeatherSensorEntityDescription(
key="hrrr_0-18",
name="HRRR 0-18 Update Time",
Expand Down Expand Up @@ -661,7 +661,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
icon="mdi:clock-time-three-outline",
device_class=SensorDeviceClass.TIMESTAMP,
forecast_mode=[],
),
),
}


Expand Down Expand Up @@ -1076,8 +1076,12 @@ def native_value(self) -> StateType:
"gfs_update_time",
"gefs_update_time",
]:
model_time_string = self._weather_coordinator.data.json['flags']['sourceTimes'][self.entity_description.key]
native_val = datetime.datetime.strptime(model_time_string[0:-1], '%Y-%m-%d %H').replace(tzinfo=datetime.timezone.utc)
model_time_string = self._weather_coordinator.data.json["flags"][
"sourceTimes"
][self.entity_description.key]
native_val = datetime.datetime.strptime(
model_time_string[0:-1], "%Y-%m-%d %H"
).replace(tzinfo=datetime.UTC)

elif self.type == "minutely_summary":
native_val = getattr(
Expand Down Expand Up @@ -1205,7 +1209,7 @@ def get_state(self, data):
"sunset_time",
"time",
]:
outState = datetime.datetime.fromtimestamp(state, datetime.timezone.utc)
outState = datetime.datetime.fromtimestamp(state, datetime.UTC)

elif self.type in [
"dew_point",
Expand Down

0 comments on commit a20734c

Please sign in to comment.