Mark ZHA Light methods as a callbacks (#53170)

* ZHA Light.set_level is safe to run in the loop

* Fix tests.
This commit is contained in:
Alexei Chetroi 2021-07-20 02:33:45 -04:00 committed by GitHub
parent 7659197154
commit c9ae141eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -167,6 +167,7 @@ class BaseLight(LogMixin, light.LightEntity):
"""Return the warmest color_temp that this light supports."""
return self._max_mireds
@callback
def set_level(self, value):
"""Set the brightness of this light between 0..254.

View File

@ -421,7 +421,7 @@ async def async_test_dimmer_from_light(hass, cluster, entity_id, level, expected
await send_attributes_report(
hass, cluster, {1: level + 10, 0: level, 2: level - 10 or 22}
)
await hass.async_block_till_done()
await async_wait_for_updates(hass)
assert hass.states.get(entity_id).state == expected_state
# hass uses None for brightness of 0 in state attributes
if level == 0: