Skip to content

Commit

Permalink
fix: don't update entities that are disabled (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
luuuis authored Dec 11, 2021
1 parent bb59ccb commit 6474db6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/wibeee/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ async def fetching_data(self, now=None):
def updating_sensors(self, sensor_data):
"""Update all sensor states from sensor_data."""
for sensor in self.sensors:
sensor._state = sensor_data.get(sensor._entity, STATE_UNAVAILABLE)
sensor._attr_available = sensor._state is not STATE_UNAVAILABLE
sensor.async_schedule_update_ha_state()
_LOGGER.debug("[sensor:%s] %s)", sensor._entity, sensor._state)
if sensor.enabled:
sensor._state = sensor_data.get(sensor._entity, STATE_UNAVAILABLE)
sensor._attr_available = sensor._state is not STATE_UNAVAILABLE
sensor.async_schedule_update_ha_state()
_LOGGER.debug("[sensor:%s] %s%s", sensor._entity, sensor._state, '' if sensor.enabled else ' (DISABLED)')

0 comments on commit 6474db6

Please sign in to comment.