Skip to content

Commit

Permalink
Fix for error logs - self.hass is None
Browse files Browse the repository at this point in the history
Fixes #63
  • Loading branch information
megakid authored Dec 10, 2024
1 parent b08aef9 commit e27eafd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions custom_components/hildebrand_glow_ihd_mqtt/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,17 @@ def process_update(self, mqtt_data) -> None:
return
self._attr_native_value = new_value

if self._last_reset_reported and self._meter_interval:
zoneInfo = None
if self._time_zone:
zoneInfo = self._time_zone
elif (self.hass is not None and
self.hass.config is not None):
zoneInfo = self.hass.config.time_zone

if zoneInfo and self._last_reset_reported and self._meter_interval:
self._attr_last_reset = self.determine_last_reset(
self.get_message_datetime(mqtt_data),
ZoneInfo(self._time_zone or self.hass.config.time_zone),
ZoneInfo(zoneInfo),
self._meter_interval
)

Expand Down

0 comments on commit e27eafd

Please sign in to comment.