mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
Support on-off device in rfxtrx light
This commit is contained in:
parent
bca3207e0c
commit
0d45470ea6
@ -155,16 +155,18 @@ class RfxtrxLight(Light):
|
|||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
""" Turn the light on. """
|
""" Turn the light on. """
|
||||||
brightness = kwargs.get(ATTR_BRIGHTNESS)
|
brightness = kwargs.get(ATTR_BRIGHTNESS)
|
||||||
|
if not self._event:
|
||||||
|
return
|
||||||
|
|
||||||
if brightness is None:
|
if brightness is None:
|
||||||
self._brightness = 100
|
self._brightness = 100
|
||||||
|
self._event.device.send_on(rfxtrx.RFXOBJECT.transport)
|
||||||
else:
|
else:
|
||||||
self._brightness = ((brightness + 4) * 100 // 255 - 1)
|
self._brightness = ((brightness + 4) * 100 // 255 - 1)
|
||||||
|
|
||||||
if hasattr(self, '_event') and self._event:
|
|
||||||
self._event.device.send_dim(rfxtrx.RFXOBJECT.transport,
|
self._event.device.send_dim(rfxtrx.RFXOBJECT.transport,
|
||||||
self._brightness)
|
self._brightness)
|
||||||
|
|
||||||
|
|
||||||
self._brightness = (self._brightness * 255 // 100)
|
self._brightness = (self._brightness * 255 // 100)
|
||||||
self._state = True
|
self._state = True
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user