Skip to content

Commit

Permalink
Fix state updates from Philips Hue
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Mar 27, 2024
1 parent 767e8f9 commit f7e5b7e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/xiaomi_gateway3/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ async def async_turn_on(self, transition: int = None, **kwargs):

self.device.write(kwargs if kwargs else {self.attr: True})

# fix Philips Hue with polling
if self._attr_should_poll and (not kwargs or transition):
await asyncio.sleep(transition or 1)

async def async_turn_off(self, transition: int = None, **kwargs):
if self.default_transition is not None and transition is None:
transition = self.default_transition
Expand All @@ -116,6 +120,10 @@ async def async_turn_off(self, transition: int = None, **kwargs):

self.device.write(kwargs if kwargs else {self.attr: False})

# fix Philips Hue with polling
if self._attr_should_poll and (not kwargs or transition):
await asyncio.sleep(transition or 1)


class XLightGroup(XLight):
update_event: asyncio.Event
Expand Down

0 comments on commit f7e5b7e

Please sign in to comment.