From c9ae141eab1bc03ac42b300b9931adb0ec06749a Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Tue, 20 Jul 2021 02:33:45 -0400 Subject: [PATCH] Mark ZHA Light methods as a callbacks (#53170) * ZHA Light.set_level is safe to run in the loop * Fix tests. --- homeassistant/components/zha/light.py | 1 + tests/components/zha/test_light.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zha/light.py b/homeassistant/components/zha/light.py index ca84a579d14..628d9c3b9be 100644 --- a/homeassistant/components/zha/light.py +++ b/homeassistant/components/zha/light.py @@ -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. diff --git a/tests/components/zha/test_light.py b/tests/components/zha/test_light.py index fe367a3969b..0408f164049 100644 --- a/tests/components/zha/test_light.py +++ b/tests/components/zha/test_light.py @@ -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: