Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix turning on the light with a specific color #108080

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions homeassistant/components/matter/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ async def _set_xy_color(self, xy_color: tuple[float, float]) -> None:
colorY=int(matter_xy[1]),
# It's required in TLV. We don't implement transition time yet.
transitionTime=0,
# allow setting the color while the light is off,
# by setting the optionsMask to 1 (=ExecuteIfOff)
optionsMask=1,
optionsOverride=1,
)
)

Expand All @@ -103,6 +107,10 @@ async def _set_hs_color(self, hs_color: tuple[float, float]) -> None:
saturation=int(matter_hs[1]),
# It's required in TLV. We don't implement transition time yet.
transitionTime=0,
# allow setting the color while the light is off,
# by setting the optionsMask to 1 (=ExecuteIfOff)
optionsMask=1,
optionsOverride=1,
)
)

Expand All @@ -114,6 +122,10 @@ async def _set_color_temp(self, color_temp: int) -> None:
colorTemperatureMireds=color_temp,
# It's required in TLV. We don't implement transition time yet.
transitionTime=0,
# allow setting the color while the light is off,
# by setting the optionsMask to 1 (=ExecuteIfOff)
optionsMask=1,
optionsOverride=1,
)
)

Expand Down
12 changes: 9 additions & 3 deletions tests/components/matter/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ async def test_color_temperature_light(
command=clusters.ColorControl.Commands.MoveToColorTemperature(
colorTemperatureMireds=300,
transitionTime=0,
optionsMask=1,
optionsOverride=1,
),
),
call(
Expand Down Expand Up @@ -278,7 +280,11 @@ async def test_extended_color_light(
node_id=light_node.node_id,
endpoint_id=1,
command=clusters.ColorControl.Commands.MoveToColor(
colorX=0.5 * 65536, colorY=0.5 * 65536, transitionTime=0
colorX=0.5 * 65536,
colorY=0.5 * 65536,
transitionTime=0,
optionsMask=1,
optionsOverride=1,
),
),
call(
Expand Down Expand Up @@ -311,8 +317,8 @@ async def test_extended_color_light(
hue=167,
saturation=254,
transitionTime=0,
optionsMask=0,
optionsOverride=0,
optionsMask=1,
optionsOverride=1,
),
),
call(
Expand Down
Loading