mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
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:
parent
7659197154
commit
c9ae141eab
@ -167,6 +167,7 @@ class BaseLight(LogMixin, light.LightEntity):
|
|||||||
"""Return the warmest color_temp that this light supports."""
|
"""Return the warmest color_temp that this light supports."""
|
||||||
return self._max_mireds
|
return self._max_mireds
|
||||||
|
|
||||||
|
@callback
|
||||||
def set_level(self, value):
|
def set_level(self, value):
|
||||||
"""Set the brightness of this light between 0..254.
|
"""Set the brightness of this light between 0..254.
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ async def async_test_dimmer_from_light(hass, cluster, entity_id, level, expected
|
|||||||
await send_attributes_report(
|
await send_attributes_report(
|
||||||
hass, cluster, {1: level + 10, 0: level, 2: level - 10 or 22}
|
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
|
assert hass.states.get(entity_id).state == expected_state
|
||||||
# hass uses None for brightness of 0 in state attributes
|
# hass uses None for brightness of 0 in state attributes
|
||||||
if level == 0:
|
if level == 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user