mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Decora light: Fix brightness level in UI (#8139)
This commit is contained in:
parent
f3945147a4
commit
d3bb6d3988
@ -14,7 +14,7 @@ from homeassistant.components.light import (
|
|||||||
PLATFORM_SCHEMA)
|
PLATFORM_SCHEMA)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
REQUIREMENTS = ['decora==0.4']
|
REQUIREMENTS = ['decora==0.6']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class DecoraLight(Light):
|
|||||||
self._switch = decora.decora(self._address, self._key)
|
self._switch = decora.decora(self._address, self._key)
|
||||||
self._switch.connect()
|
self._switch.connect()
|
||||||
self._state = self._switch.get_on()
|
self._state = self._switch.get_on()
|
||||||
self._brightness = self._switch.get_brightness()
|
self._brightness = self._switch.get_brightness() * 2.55
|
||||||
self.is_valid = True
|
self.is_valid = True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -99,7 +99,7 @@ class DecoraLight(Light):
|
|||||||
|
|
||||||
def set_state(self, brightness):
|
def set_state(self, brightness):
|
||||||
"""Set the state of this lamp to the provided brightness."""
|
"""Set the state of this lamp to the provided brightness."""
|
||||||
self._switch.set_brightness(brightness)
|
self._switch.set_brightness(int(brightness / 2.55))
|
||||||
self._brightness = brightness
|
self._brightness = brightness
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -120,5 +120,5 @@ class DecoraLight(Light):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Synchronise internal state with the actual light state."""
|
"""Synchronise internal state with the actual light state."""
|
||||||
self._brightness = self._switch.get_brightness()
|
self._brightness = self._switch.get_brightness() * 2.55
|
||||||
self._state = self._switch.get_on()
|
self._state = self._switch.get_on()
|
||||||
|
@ -141,7 +141,7 @@ datadog==0.15.0
|
|||||||
datapoint==0.4.3
|
datapoint==0.4.3
|
||||||
|
|
||||||
# homeassistant.components.light.decora
|
# homeassistant.components.light.decora
|
||||||
# decora==0.4
|
# decora==0.6
|
||||||
|
|
||||||
# homeassistant.components.media_player.denonavr
|
# homeassistant.components.media_player.denonavr
|
||||||
denonavr==0.4.4
|
denonavr==0.4.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user