Fix Hue scene overriding Hue default transition times (#47454)

pull/47470/head
Franck Nijhof 2021-03-05 18:43:26 +01:00 committed by GitHub
parent f2a2dbb561
commit cc99fd5e32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 7 deletions

View File

@ -19,7 +19,6 @@ from .const import (
CONF_ALLOW_UNREACHABLE,
DEFAULT_ALLOW_HUE_GROUPS,
DEFAULT_ALLOW_UNREACHABLE,
DEFAULT_SCENE_TRANSITION,
LOGGER,
)
from .errors import AuthenticationRequired, CannotConnect
@ -34,9 +33,7 @@ SCENE_SCHEMA = vol.Schema(
{
vol.Required(ATTR_GROUP_NAME): cv.string,
vol.Required(ATTR_SCENE_NAME): cv.string,
vol.Optional(
ATTR_TRANSITION, default=DEFAULT_SCENE_TRANSITION
): cv.positive_int,
vol.Optional(ATTR_TRANSITION): cv.positive_int,
}
)
# How long should we sleep if the hub is busy
@ -209,7 +206,7 @@ class HueBridge:
"""Service to call directly into bridge to set scenes."""
group_name = call.data[ATTR_GROUP_NAME]
scene_name = call.data[ATTR_SCENE_NAME]
transition = call.data.get(ATTR_TRANSITION, DEFAULT_SCENE_TRANSITION)
transition = call.data.get(ATTR_TRANSITION)
group = next(
(group for group in self.api.groups.values() if group.name == group_name),

View File

@ -14,8 +14,6 @@ DEFAULT_ALLOW_UNREACHABLE = False
CONF_ALLOW_HUE_GROUPS = "allow_hue_groups"
DEFAULT_ALLOW_HUE_GROUPS = False
DEFAULT_SCENE_TRANSITION = 4
GROUP_TYPE_LIGHT_GROUP = "LightGroup"
GROUP_TYPE_ROOM = "Room"
GROUP_TYPE_LUMINAIRE = "Luminaire"

View File

@ -189,6 +189,7 @@ async def test_hue_activate_scene(hass, mock_api):
assert len(mock_api.mock_requests) == 3
assert mock_api.mock_requests[2]["json"]["scene"] == "scene_1"
assert "transitiontime" not in mock_api.mock_requests[2]["json"]
assert mock_api.mock_requests[2]["path"] == "groups/group_1/action"