mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Update flux_led.py (#9122)
This commit is contained in:
parent
698d133455
commit
d72a181e30
@ -122,7 +122,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
if ipaddr in light_ips:
|
if ipaddr in light_ips:
|
||||||
continue
|
continue
|
||||||
device['name'] = '{} {}'.format(device['id'], ipaddr)
|
device['name'] = '{} {}'.format(device['id'], ipaddr)
|
||||||
device[ATTR_MODE] = 'rgbw'
|
device[ATTR_MODE] = MODE_RGBW
|
||||||
device[CONF_PROTOCOL] = None
|
device[CONF_PROTOCOL] = None
|
||||||
light = FluxLight(device)
|
light = FluxLight(device)
|
||||||
lights.append(light)
|
lights.append(light)
|
||||||
@ -216,9 +216,9 @@ class FluxLight(Light):
|
|||||||
elif rgb is not None:
|
elif rgb is not None:
|
||||||
self._bulb.setRgb(*tuple(rgb))
|
self._bulb.setRgb(*tuple(rgb))
|
||||||
elif brightness is not None:
|
elif brightness is not None:
|
||||||
if self._mode == 'rgbw':
|
if self._mode == MODE_RGBW:
|
||||||
self._bulb.setWarmWhite255(brightness)
|
self._bulb.setWarmWhite255(brightness)
|
||||||
elif self._mode == 'rgb':
|
elif self._mode == MODE_RGB:
|
||||||
(red, green, blue) = self._bulb.getRgb()
|
(red, green, blue) = self._bulb.getRgb()
|
||||||
self._bulb.setRgb(red, green, blue, brightness=brightness)
|
self._bulb.setRgb(red, green, blue, brightness=brightness)
|
||||||
elif effect == EFFECT_RANDOM:
|
elif effect == EFFECT_RANDOM:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user