From c41cf7c3083bb4e05adee0c11d9f5e9f9a4fd7f9 Mon Sep 17 00:00:00 2001 From: John Arild Berentsen Date: Fri, 20 Jan 2017 13:35:41 +0100 Subject: [PATCH] Bugfix Zwave Light: Use only supported features for devices (#5370) * Use only supported features for devices * Changes * Holy Macarony! --- homeassistant/components/light/zwave.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/light/zwave.py b/homeassistant/components/light/zwave.py index d973f8d8dd2..754c27cbad3 100644 --- a/homeassistant/components/light/zwave.py +++ b/homeassistant/components/light/zwave.py @@ -42,7 +42,10 @@ TEMP_MID_HASS = (HASS_COLOR_MAX - HASS_COLOR_MIN) / 2 + HASS_COLOR_MIN TEMP_WARM_HASS = (HASS_COLOR_MAX - HASS_COLOR_MIN) / 3 * 2 + HASS_COLOR_MIN TEMP_COLD_HASS = (HASS_COLOR_MAX - HASS_COLOR_MIN) / 3 + HASS_COLOR_MIN -SUPPORT_ZWAVE = SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP | SUPPORT_RGB_COLOR +SUPPORT_ZWAVE_DIMMER = SUPPORT_BRIGHTNESS +SUPPORT_ZWAVE_COLOR = SUPPORT_BRIGHTNESS | SUPPORT_RGB_COLOR +SUPPORT_ZWAVE_COLORTEMP = (SUPPORT_BRIGHTNESS | SUPPORT_RGB_COLOR + | SUPPORT_COLOR_TEMP) def setup_platform(hass, config, add_devices, discovery_info=None): @@ -161,7 +164,7 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light): @property def supported_features(self): """Flag supported features.""" - return SUPPORT_ZWAVE + return SUPPORT_ZWAVE_DIMMER def turn_on(self, **kwargs): """Turn the device on.""" @@ -351,3 +354,11 @@ class ZwaveColorLight(ZwaveDimmer): self._value_color.node.set_rgbw(self._value_color.value_id, rgbw) super().turn_on(**kwargs) + + @property + def supported_features(self): + """Flag supported features.""" + if self._zw098: + return SUPPORT_ZWAVE_COLORTEMP + else: + return SUPPORT_ZWAVE_COLOR