Skip to content

Commit 645cbf6

Browse files
authored
fix(binary_sensor): changes async_write_ha_state method to schedule_update_ha_state in is_on() (#351)
1 parent 6b70043 commit 645cbf6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

custom_components/dahua/binary_sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ def is_on(self):
119119
120120
This is the magic part of this sensor along with the async_added_to_hass method below.
121121
The async_added_to_hass method adds a listener to the coordinator so when the event is started or stopped
122-
it calls the async_write_ha_state function. async_write_ha_state gets the current value from this is_on method.
122+
it calls the schedule_update_ha_state function. schedule_update_ha_state gets the current value from this is_on method.
123123
"""
124124
return self._coordinator.get_event_timestamp(self._event_name) > 0
125125

126126
async def async_added_to_hass(self):
127127
"""Connect to dispatcher listening for entity data notifications."""
128-
self._coordinator.add_dahua_event_listener(self._event_name, self.async_write_ha_state)
128+
self._coordinator.add_dahua_event_listener(self._event_name, self.schedule_update_ha_state)
129129

130130
@property
131131
def should_poll(self) -> bool:

0 commit comments

Comments
 (0)