mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Ensure bulb state is restored when turning back on (#330)
* Ensure state is restored when turning back on Fixes https://github.com/home-assistant/core/issues/69039 * Update kasa/tests/test_bulb.py Co-authored-by: Teemu R. <tpr@iki.fi> Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
@@ -232,3 +232,16 @@ async def test_non_dimmable(dev):
|
||||
assert dev.brightness == 0
|
||||
with pytest.raises(SmartDeviceException):
|
||||
await dev.set_brightness(100)
|
||||
|
||||
|
||||
@bulb
|
||||
async def test_ignore_default_not_set_without_color_mode_change_turn_on(dev, mocker):
|
||||
query_helper = mocker.patch("kasa.SmartBulb._query_helper")
|
||||
# When turning back without settings, ignore default to restore the state
|
||||
await dev.turn_on()
|
||||
args, kwargs = query_helper.call_args_list[0]
|
||||
assert args[2] == {"on_off": 1, "ignore_default": 0}
|
||||
|
||||
await dev.turn_off()
|
||||
args, kwargs = query_helper.call_args_list[1]
|
||||
assert args[2] == {"on_off": 0, "ignore_default": 1}
|
||||
|
Reference in New Issue
Block a user