Pass in parameters explicitly to DeconzSession (#29617)
Dont pass in loop to DeconzSession Services will use new refresh state method
This commit is contained in:
1 parent
00dc721609
commit
57a3f7d5c8
16 files changed
+219
-137
No files matched your search
@@ -117,17 +117,22 @@ async def test_lights_and_groups(hass):
|
||||
empty_group = hass.states.get("light.empty_group")
|
||||
assert empty_group is None
|
||||
|
||||
rgb_light_device = gateway.api.lights["1"]
|
||||
|
||||
rgb_light_device.async_update({"state": {"on": False}})
|
||||
state_changed_event = {
|
||||
"t": "event",
|
||||
"e": "changed",
|
||||
"r": "lights",
|
||||
"id": "1",
|
||||
"state": {"on": False},
|
||||
}
|
||||
gateway.api.async_event_handler(state_changed_event)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
rgb_light = hass.states.get("light.rgb_light")
|
||||
assert rgb_light.state == "off"
|
||||
|
||||
with patch.object(
|
||||
rgb_light_device, "_async_set_callback", return_value=True
|
||||
) as set_callback:
|
||||
rgb_light_device = gateway.api.lights["1"]
|
||||
|
||||
with patch.object(rgb_light_device, "_request", return_value=True) as set_callback:
|
||||
await hass.services.async_call(
|
||||
light.DOMAIN,
|
||||
light.SERVICE_TURN_ON,
|
||||
@@ -143,8 +148,9 @@ async def test_lights_and_groups(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
set_callback.assert_called_with(
|
||||
"put",
|
||||
"/lights/1/state",
|
||||
{
|
||||
json={
|
||||
"ct": 2500,
|
||||
"bri": 200,
|
||||
"transitiontime": 50,
|
||||
@@ -153,9 +159,7 @@ async def test_lights_and_groups(hass):
|
||||
},
|
||||
)
|
||||
|
||||
with patch.object(
|
||||
rgb_light_device, "_async_set_callback", return_value=True
|
||||
) as set_callback:
|
||||
with patch.object(rgb_light_device, "_request", return_value=True) as set_callback:
|
||||
await hass.services.async_call(
|
||||
light.DOMAIN,
|
||||
light.SERVICE_TURN_ON,
|
||||
@@ -169,13 +173,12 @@ async def test_lights_and_groups(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
set_callback.assert_called_with(
|
||||
"put",
|
||||
"/lights/1/state",
|
||||
{"xy": (0.411, 0.351), "alert": "lselect", "effect": "none"},
|
||||
json={"xy": (0.411, 0.351), "alert": "lselect", "effect": "none"},
|
||||
)
|
||||
|
||||
with patch.object(
|
||||
rgb_light_device, "_async_set_callback", return_value=True
|
||||
) as set_callback:
|
||||
with patch.object(rgb_light_device, "_request", return_value=True) as set_callback:
|
||||
await hass.services.async_call(
|
||||
light.DOMAIN,
|
||||
light.SERVICE_TURN_OFF,
|
||||
@@ -184,12 +187,12 @@ async def test_lights_and_groups(hass):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
set_callback.assert_called_with(
|
||||
"/lights/1/state", {"bri": 0, "transitiontime": 50, "alert": "select"}
|
||||
"put",
|
||||
"/lights/1/state",
|
||||
json={"bri": 0, "transitiontime": 50, "alert": "select"},
|
||||
)
|
||||
|
||||
with patch.object(
|
||||
rgb_light_device, "_async_set_callback", return_value=True
|
||||
) as set_callback:
|
||||
with patch.object(rgb_light_device, "_request", return_value=True) as set_callback:
|
||||
await hass.services.async_call(
|
||||
light.DOMAIN,
|
||||
light.SERVICE_TURN_OFF,
|
||||
@@ -197,7 +200,9 @@ async def test_lights_and_groups(hass):
|
||||
blocking=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
set_callback.assert_called_with("/lights/1/state", {"alert": "lselect"})
|
||||
set_callback.assert_called_with(
|
||||
"put", "/lights/1/state", json={"alert": "lselect"}
|
||||
)
|
||||
|
||||
await gateway.async_reset()
|
||||
|
||||
|
||||
Reference in new issue
Block a user