Hue aggregated control for grouped lights (#68566)
This commit is contained in:
parent
d2dc9e6cbe
commit
ccd8c7d5f8
2 changed files with 38 additions and 93 deletions
|
@ -372,31 +372,24 @@ async def test_grouped_lights(hass, mock_bridge_v2, v2_resources_test_data):
|
|||
blocking=True,
|
||||
)
|
||||
|
||||
# PUT request should have been sent to ALL group lights with correct params
|
||||
assert len(mock_bridge_v2.mock_requests) == 3
|
||||
for index in range(0, 3):
|
||||
assert mock_bridge_v2.mock_requests[index]["json"]["on"]["on"] is True
|
||||
assert (
|
||||
mock_bridge_v2.mock_requests[index]["json"]["dimming"]["brightness"] == 100
|
||||
)
|
||||
assert mock_bridge_v2.mock_requests[index]["json"]["color"]["xy"]["x"] == 0.123
|
||||
assert mock_bridge_v2.mock_requests[index]["json"]["color"]["xy"]["y"] == 0.123
|
||||
assert (
|
||||
mock_bridge_v2.mock_requests[index]["json"]["dynamics"]["duration"] == 200
|
||||
)
|
||||
# PUT request should have been sent to group_light with correct params
|
||||
assert len(mock_bridge_v2.mock_requests) == 1
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["on"]["on"] is True
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["dimming"]["brightness"] == 100
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["color"]["xy"]["x"] == 0.123
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["color"]["xy"]["y"] == 0.123
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["dynamics"]["duration"] == 200
|
||||
|
||||
# Now generate update events by emitting the json we've sent as incoming events
|
||||
for index, light_id in enumerate(
|
||||
[
|
||||
"02cba059-9c2c-4d45-97e4-4f79b1bfbaa1",
|
||||
"b3fe71ef-d0ef-48de-9355-d9e604377df0",
|
||||
"8015b17f-8336-415b-966a-b364bd082397",
|
||||
]
|
||||
):
|
||||
for light_id in [
|
||||
"02cba059-9c2c-4d45-97e4-4f79b1bfbaa1",
|
||||
"b3fe71ef-d0ef-48de-9355-d9e604377df0",
|
||||
"8015b17f-8336-415b-966a-b364bd082397",
|
||||
]:
|
||||
event = {
|
||||
"id": light_id,
|
||||
"type": "light",
|
||||
**mock_bridge_v2.mock_requests[index]["json"],
|
||||
**mock_bridge_v2.mock_requests[0]["json"],
|
||||
}
|
||||
mock_bridge_v2.api.emit_event("update", event)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -452,13 +445,10 @@ async def test_grouped_lights(hass, mock_bridge_v2, v2_resources_test_data):
|
|||
blocking=True,
|
||||
)
|
||||
|
||||
# PUT request should have been sent to ALL group lights with correct params
|
||||
assert len(mock_bridge_v2.mock_requests) == 3
|
||||
for index in range(0, 3):
|
||||
assert mock_bridge_v2.mock_requests[index]["json"]["on"]["on"] is False
|
||||
assert (
|
||||
mock_bridge_v2.mock_requests[index]["json"]["dynamics"]["duration"] == 200
|
||||
)
|
||||
# PUT request should have been sent to group_light with correct params
|
||||
assert len(mock_bridge_v2.mock_requests) == 1
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["on"]["on"] is False
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["dynamics"]["duration"] == 200
|
||||
|
||||
# Test sending short flash effect to a grouped light
|
||||
mock_bridge_v2.mock_requests.clear()
|
||||
|
@ -494,12 +484,9 @@ async def test_grouped_lights(hass, mock_bridge_v2, v2_resources_test_data):
|
|||
blocking=True,
|
||||
)
|
||||
|
||||
# PUT request should have been sent to ALL group lights with correct params
|
||||
assert len(mock_bridge_v2.mock_requests) == 3
|
||||
for index in range(0, 3):
|
||||
assert (
|
||||
mock_bridge_v2.mock_requests[index]["json"]["alert"]["action"] == "breathe"
|
||||
)
|
||||
# PUT request should have been sent to grouped_light with correct params
|
||||
assert len(mock_bridge_v2.mock_requests) == 1
|
||||
assert mock_bridge_v2.mock_requests[0]["json"]["alert"]["action"] == "breathe"
|
||||
|
||||
# Test sending flash effect in turn_off call
|
||||
mock_bridge_v2.mock_requests.clear()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue