diff --git a/.gitignore b/.gitignore index 29cf09b..14044e3 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ venv .HA_VERSION config/.storage/* config/blueprints/* -.ruff_cache \ No newline at end of file +.ruff_cache +config/deps/* \ No newline at end of file diff --git a/custom_components/pirateweather/sensor.py b/custom_components/pirateweather/sensor.py index ff9b186..c186e53 100644 --- a/custom_components/pirateweather/sensor.py +++ b/custom_components/pirateweather/sensor.py @@ -1076,12 +1076,15 @@ 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.UTC) + try: + 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) + except KeyError: + native_val = None elif self.type == "minutely_summary": native_val = getattr(