From 7555638b6f877687bb58344eb70372fd0f7593e2 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Tue, 20 Oct 2020 00:06:10 +0200 Subject: [PATCH] add percent --- custom_components/adaptive_lighting/const.py | 1 + custom_components/adaptive_lighting/switch.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/const.py b/custom_components/adaptive_lighting/const.py index 2bd9db96..c9dfd3a5 100644 --- a/custom_components/adaptive_lighting/const.py +++ b/custom_components/adaptive_lighting/const.py @@ -36,6 +36,7 @@ CONF_SUNSET_TIME = "sunset_time" CONF_TAKE_OVER_CONTROL, DEFAULT_TAKE_OVER_CONTROL = "take_over_control", True CONF_TRANSITION, DEFAULT_TRANSITION = "transition", 45 +SLEEP_MODE_SWITCH = "sleep_mode_switch" ATTR_TURN_ON_OFF_LISTENER = "turn_on_off_listener" UNDO_UPDATE_LISTENER = "undo_update_listener" NONE_STR = "None" diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 0736f7de..8c662cf6 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -102,6 +102,7 @@ from .const import ( ICON, SERVICE_APPLY, SERVICE_SET_MANUAL_CONTROL, + SLEEP_MODE_SWITCH, SUN_EVENT_MIDNIGHT, SUN_EVENT_NOON, TURNING_OFF_DELAY, @@ -216,7 +217,7 @@ async def async_setup_entry( sleep_mode_switch = AdaptiveSleepModeSwitch(hass, config_entry) switch = AdaptiveSwitch(hass, config_entry, turn_on_off_listener, sleep_mode_switch) - data[config_entry.entry_id]["sleep_mode_switch"] = sleep_mode_switch + data[config_entry.entry_id][SLEEP_MODE_SWITCH] = sleep_mode_switch data[config_entry.entry_id][SWITCH_DOMAIN] = switch async_add_entities([switch, sleep_mode_switch], update_before_add=True) @@ -987,6 +988,7 @@ class SunLightSettings: "rgb_color": rgb_color, "xy_color": xy_color, "hs_color": hs_color, + "sun_position": percent, }