From f1c210114810f5b0a8472e9fd7395c71f06fda55 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 5 Oct 2020 18:39:15 +0200 Subject: [PATCH] add 'manually_controlled' attribute to switch --- custom_components/adaptive_lighting/switch.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 9272413b..69d92b47 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -384,7 +384,12 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity): """Return the attributes of the switch.""" if not self.is_on: return {key: None for key in self._settings} - return self._settings + manually_controlled = [ + light + for light in self._lights + if self.turn_on_off_listener.manually_controlled.get(light) + ] + return dict(self._settings, manually_controlled=manually_controlled) async def async_turn_on( # pylint: disable=arguments-differ self, adapt_lights: bool = True