mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
make the custom polling actually request state (#22778)
This commit is contained in:
parent
8dfbfae270
commit
192ed90773
@ -243,16 +243,20 @@ class Light(ZhaEntity, light.Light):
|
|||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Attempt to retrieve on off state from the light."""
|
"""Attempt to retrieve on off state from the light."""
|
||||||
await super().async_update()
|
await super().async_update()
|
||||||
|
await self.async_get_state()
|
||||||
|
|
||||||
|
async def async_get_state(self, from_cache=True):
|
||||||
|
"""Attempt to retrieve on off state from the light."""
|
||||||
if self._on_off_channel:
|
if self._on_off_channel:
|
||||||
self._state = await self._on_off_channel.get_attribute_value(
|
self._state = await self._on_off_channel.get_attribute_value(
|
||||||
'on_off')
|
'on_off', from_cache=from_cache)
|
||||||
if self._level_channel:
|
if self._level_channel:
|
||||||
self._brightness = await self._level_channel.get_attribute_value(
|
self._brightness = await self._level_channel.get_attribute_value(
|
||||||
'current_level')
|
'current_level', from_cache=from_cache)
|
||||||
|
|
||||||
async def refresh(self, time):
|
async def refresh(self, time):
|
||||||
"""Call async_update at an interval."""
|
"""Call async_get_state at an interval."""
|
||||||
await self.async_update()
|
await self.async_get_state(from_cache=False)
|
||||||
|
|
||||||
def debug(self, msg, *args):
|
def debug(self, msg, *args):
|
||||||
"""Log debug message."""
|
"""Log debug message."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user