Optimize yeelight signal handling (#22806)
This commit is contained in:
parent
a91e79ee77
commit
f62d1d8d09
3 changed files with 12 additions and 10 deletions
|
@ -31,14 +31,15 @@ class YeelightNightlightModeSensor(BinarySensorDevice):
|
|||
self._device = device
|
||||
|
||||
@callback
|
||||
def _schedule_immediate_update(self, ipaddr):
|
||||
if ipaddr == self._device.ipaddr:
|
||||
self.async_schedule_update_ha_state()
|
||||
def _schedule_immediate_update(self):
|
||||
self.async_schedule_update_ha_state()
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Handle entity which will be added."""
|
||||
async_dispatcher_connect(
|
||||
self.hass, DATA_UPDATED, self._schedule_immediate_update
|
||||
self.hass,
|
||||
DATA_UPDATED.format(self._device.ipaddr),
|
||||
self._schedule_immediate_update
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue