Fix for Hue not applying effect in scene (#113057)

This commit is contained in:
Marcel van der Veldt 2024-03-11 15:08:00 +01:00 committed by GitHub
parent ba971890a9
commit 0eb1adccf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View file

@ -235,6 +235,9 @@ class HueLight(HueBaseEntity, LightEntity):
if transition is None:
# a transition is required for timed effect, default to 10 minutes
transition = 600000
# we need to clear color values if an effect is applied
color_temp = None
xy_color = None
if flash is not None:
await self.async_set_flash(flash)

View file

@ -205,6 +205,28 @@ async def test_light_turn_on_service(
)
assert mock_bridge_v2.mock_requests[8]["json"]["timed_effects"]["duration"] == 6000
# test enabling effect should ignore color temperature
await hass.services.async_call(
"light",
"turn_on",
{"entity_id": test_light_id, "effect": "candle", "color_temp": 500},
blocking=True,
)
assert len(mock_bridge_v2.mock_requests) == 10
assert mock_bridge_v2.mock_requests[9]["json"]["effects"]["effect"] == "candle"
assert "color_temperature" not in mock_bridge_v2.mock_requests[9]["json"]
# test enabling effect should ignore xy color
await hass.services.async_call(
"light",
"turn_on",
{"entity_id": test_light_id, "effect": "candle", "xy_color": [0.123, 0.123]},
blocking=True,
)
assert len(mock_bridge_v2.mock_requests) == 11
assert mock_bridge_v2.mock_requests[10]["json"]["effects"]["effect"] == "candle"
assert "xy_color" not in mock_bridge_v2.mock_requests[9]["json"]
async def test_light_turn_off_service(
hass: HomeAssistant, mock_bridge_v2, v2_resources_test_data