Migrate Shelly to use kelvin for color temperature (#79880)

This commit is contained in:
Shay Levy 2022-10-08 22:24:19 +03:00 committed by GitHub
parent f65dcf3c35
commit 9019fcb5c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 450 additions and 37 deletions

View file

@ -25,6 +25,36 @@ MOCK_SETTINGS = {
"rollers": [{"positioning": True}],
}
def mock_light_set_state(
turn="on",
mode="color",
red=45,
green=55,
blue=65,
white=70,
gain=19,
temp=4050,
brightness=50,
effect=0,
transition=0,
):
"""Mock light block set_state."""
return {
"ison": turn == "on",
"mode": mode,
"red": red,
"green": green,
"blue": blue,
"white": white,
"gain": gain,
"temp": temp,
"brightness": brightness,
"effect": effect,
"transition": transition,
}
MOCK_BLOCKS = [
Mock(
sensor_ids={"inputEvent": "S", "inputEventCnt": 2},
@ -43,6 +73,15 @@ MOCK_BLOCKS = [
}
),
),
Mock(
sensor_ids={},
channel="0",
output=mock_light_set_state()["ison"],
colorTemp=mock_light_set_state()["temp"],
**mock_light_set_state(),
type="light",
set_state=AsyncMock(side_effect=mock_light_set_state),
),
]
MOCK_CONFIG = {