Fix Hue scene overriding Hue default transition times (#47454)
This commit is contained in:
parent
f2a2dbb561
commit
cc99fd5e32
3 changed files with 3 additions and 7 deletions
|
@ -19,7 +19,6 @@ from .const import (
|
||||||
CONF_ALLOW_UNREACHABLE,
|
CONF_ALLOW_UNREACHABLE,
|
||||||
DEFAULT_ALLOW_HUE_GROUPS,
|
DEFAULT_ALLOW_HUE_GROUPS,
|
||||||
DEFAULT_ALLOW_UNREACHABLE,
|
DEFAULT_ALLOW_UNREACHABLE,
|
||||||
DEFAULT_SCENE_TRANSITION,
|
|
||||||
LOGGER,
|
LOGGER,
|
||||||
)
|
)
|
||||||
from .errors import AuthenticationRequired, CannotConnect
|
from .errors import AuthenticationRequired, CannotConnect
|
||||||
|
@ -34,9 +33,7 @@ SCENE_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(ATTR_GROUP_NAME): cv.string,
|
vol.Required(ATTR_GROUP_NAME): cv.string,
|
||||||
vol.Required(ATTR_SCENE_NAME): cv.string,
|
vol.Required(ATTR_SCENE_NAME): cv.string,
|
||||||
vol.Optional(
|
vol.Optional(ATTR_TRANSITION): cv.positive_int,
|
||||||
ATTR_TRANSITION, default=DEFAULT_SCENE_TRANSITION
|
|
||||||
): cv.positive_int,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# How long should we sleep if the hub is busy
|
# 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."""
|
"""Service to call directly into bridge to set scenes."""
|
||||||
group_name = call.data[ATTR_GROUP_NAME]
|
group_name = call.data[ATTR_GROUP_NAME]
|
||||||
scene_name = call.data[ATTR_SCENE_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 = next(
|
||||||
(group for group in self.api.groups.values() if group.name == group_name),
|
(group for group in self.api.groups.values() if group.name == group_name),
|
||||||
|
|
|
@ -14,8 +14,6 @@ DEFAULT_ALLOW_UNREACHABLE = False
|
||||||
CONF_ALLOW_HUE_GROUPS = "allow_hue_groups"
|
CONF_ALLOW_HUE_GROUPS = "allow_hue_groups"
|
||||||
DEFAULT_ALLOW_HUE_GROUPS = False
|
DEFAULT_ALLOW_HUE_GROUPS = False
|
||||||
|
|
||||||
DEFAULT_SCENE_TRANSITION = 4
|
|
||||||
|
|
||||||
GROUP_TYPE_LIGHT_GROUP = "LightGroup"
|
GROUP_TYPE_LIGHT_GROUP = "LightGroup"
|
||||||
GROUP_TYPE_ROOM = "Room"
|
GROUP_TYPE_ROOM = "Room"
|
||||||
GROUP_TYPE_LUMINAIRE = "Luminaire"
|
GROUP_TYPE_LUMINAIRE = "Luminaire"
|
||||||
|
|
|
@ -189,6 +189,7 @@ async def test_hue_activate_scene(hass, mock_api):
|
||||||
|
|
||||||
assert len(mock_api.mock_requests) == 3
|
assert len(mock_api.mock_requests) == 3
|
||||||
assert mock_api.mock_requests[2]["json"]["scene"] == "scene_1"
|
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"
|
assert mock_api.mock_requests[2]["path"] == "groups/group_1/action"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue