Skip to content

Commit

Permalink
Mark ZHA Light methods as a callbacks (#53170)
Browse files Browse the repository at this point in the history
* ZHA Light.set_level is safe to run in the loop

* Fix tests.
  • Loading branch information
Adminiuga authored Jul 20, 2021
1 parent 7659197 commit c9ae141
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions homeassistant/components/zha/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def max_mireds(self):
"""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.
Expand Down
2 changes: 1 addition & 1 deletion tests/components/zha/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c9ae141

Please sign in to comment.