Split homematic color and effect support (#27299)

* [homematic] Split color and effect support

There are homematic devices (like HmIP-BSL) that support color but
do not support effects.
Split the support, so that color can be supported even if effects are not.

* Make effect fully independent of color

If a device supports effects for e.g. just brightness, it shouldn't be coupled to the color
This commit is contained in:
guillempages 2019-10-19 14:40:42 +02:00 committed by Daniel Perna
parent 1c0814d6f6
commit f2617fd74a

View File

@ -54,9 +54,12 @@ class HMLight(HMDevice, Light):
@property
def supported_features(self):
"""Flag supported features."""
features = SUPPORT_BRIGHTNESS
if "COLOR" in self._hmdevice.WRITENODE:
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR | SUPPORT_EFFECT
return SUPPORT_BRIGHTNESS
features |= SUPPORT_COLOR
if "PROGRAM" in self._hmdevice.WRITENODE:
features |= SUPPORT_EFFECT
return features
@property
def hs_color(self):
@ -110,4 +113,6 @@ class HMLight(HMDevice, Light):
self._data[self._state] = None
if self.supported_features & SUPPORT_COLOR:
self._data.update({"COLOR": None, "PROGRAM": None})
self._data.update({"COLOR": None})
if self.supported_features & SUPPORT_EFFECT:
self._data.update({"PROGRAM": None})