From a20734c760a0926b8aee82bceaed34c7460a5f8d Mon Sep 17 00:00:00 2001 From: Kev Date: Thu, 22 Aug 2024 16:13:06 +0000 Subject: [PATCH] Fix Lint Error --- custom_components/pirateweather/const.py | 2 +- custom_components/pirateweather/sensor.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/custom_components/pirateweather/const.py b/custom_components/pirateweather/const.py index 1c79803..10c3090 100644 --- a/custom_components/pirateweather/const.py +++ b/custom_components/pirateweather/const.py @@ -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 = [ diff --git a/custom_components/pirateweather/sensor.py b/custom_components/pirateweather/sensor.py index 2162ef3..fcf43d2 100644 --- a/custom_components/pirateweather/sensor.py +++ b/custom_components/pirateweather/sensor.py @@ -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", @@ -661,7 +661,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): icon="mdi:clock-time-three-outline", device_class=SensorDeviceClass.TIMESTAMP, forecast_mode=[], - ), + ), } @@ -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( @@ -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",