[homematic]Pass channel to light color functions (#27306)

The device HmIP-BSL has two independent LEDs on two different channels,
so the channel needs to be explictly specified when setting the color.
This commit is contained in:
guillempages 2019-10-25 16:06:52 +02:00 committed by Daniel Perna
parent 9661efc312
commit 6bfb2460f2

View File

@ -66,7 +66,7 @@ class HMLight(HMDevice, Light):
"""Return the hue and saturation color value [float, float].""" """Return the hue and saturation color value [float, float]."""
if not self.supported_features & SUPPORT_COLOR: if not self.supported_features & SUPPORT_COLOR:
return None return None
hue, sat = self._hmdevice.get_hs_color() hue, sat = self._hmdevice.get_hs_color(self._channel)
return hue * 360.0, sat * 100.0 return hue * 360.0, sat * 100.0
@property @property
@ -98,6 +98,7 @@ class HMLight(HMDevice, Light):
self._hmdevice.set_hs_color( self._hmdevice.set_hs_color(
hue=kwargs[ATTR_HS_COLOR][0] / 360.0, hue=kwargs[ATTR_HS_COLOR][0] / 360.0,
saturation=kwargs[ATTR_HS_COLOR][1] / 100.0, saturation=kwargs[ATTR_HS_COLOR][1] / 100.0,
channel=self._channel,
) )
if ATTR_EFFECT in kwargs: if ATTR_EFFECT in kwargs:
self._hmdevice.set_effect(kwargs[ATTR_EFFECT]) self._hmdevice.set_effect(kwargs[ATTR_EFFECT])