Update control4 to use CoordinatorEntity (#39466)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-08-30 13:27:46 -05:00
1 parent ab0b0dc51c
commit b57f33c41a
2 files changed
+11 -28

No files matched your search

+4 -4
View File
@@ -175,13 +175,13 @@ class Control4Light(Control4Entity, LightEntity):
@property
def is_on(self):
"""Return whether this light is on or off."""
return self._coordinator.data[self._idx]["value"] > 0
return self.coordinator.data[self._idx]["value"] > 0
@property
def brightness(self):
"""Return the brightness of this light between 0..255."""
if self._is_dimmer:
return round(self._coordinator.data[self._idx]["value"] * 2.55)
return round(self.coordinator.data[self._idx]["value"] * 2.55)
return None
@property
@@ -213,7 +213,7 @@ class Control4Light(Control4Entity, LightEntity):
delay_time = (transition_length / 1000) + 0.7
_LOGGER.debug("Delaying light update by %s seconds", delay_time)
await asyncio.sleep(delay_time)
await self._coordinator.async_request_refresh()
await self.coordinator.async_request_refresh()
async def async_turn_off(self, **kwargs) -> None:
"""Turn the entity off."""
@@ -232,4 +232,4 @@ class Control4Light(Control4Entity, LightEntity):
delay_time = (transition_length / 1000) + 0.7
_LOGGER.debug("Delaying light update by %s seconds", delay_time)
await asyncio.sleep(delay_time)
await self._coordinator.async_request_refresh()
await self.coordinator.async_request_refresh()