Use kelvin/mireds correctly for setting iglo white (#11622)
* Use kelvin/mireds correctly for setting iglo white * Update requirements_all.txt * Fix line lengths
This commit is contained in:
parent
ea62deda59
commit
5def6ebc3b
2 changed files with 13 additions and 8 deletions
|
@ -5,6 +5,7 @@ For more details about this platform, please refer to the documentation at
|
|||
https://home-assistant.io/components/light.iglo/
|
||||
"""
|
||||
import logging
|
||||
import math
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -16,8 +17,9 @@ from homeassistant.components.light import (
|
|||
)
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
REQUIREMENTS = ['iglo==1.0.0']
|
||||
REQUIREMENTS = ['iglo==1.1.3']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -65,17 +67,19 @@ class IGloLamp(Light):
|
|||
@property
|
||||
def color_temp(self):
|
||||
"""Return the color temperature."""
|
||||
return self._color_temp
|
||||
return color_util.color_temperature_kelvin_to_mired(self._color_temp)
|
||||
|
||||
@property
|
||||
def min_mireds(self):
|
||||
"""Return the coldest color_temp that this light supports."""
|
||||
return 1
|
||||
return math.ceil(color_util.color_temperature_kelvin_to_mired(
|
||||
self._lamp.max_kelvin))
|
||||
|
||||
@property
|
||||
def max_mireds(self):
|
||||
"""Return the warmest color_temp that this light supports."""
|
||||
return 255
|
||||
return math.ceil(color_util.color_temperature_kelvin_to_mired(
|
||||
self._lamp.min_kelvin))
|
||||
|
||||
@property
|
||||
def rgb_color(self):
|
||||
|
@ -107,8 +111,9 @@ class IGloLamp(Light):
|
|||
return
|
||||
|
||||
if ATTR_COLOR_TEMP in kwargs:
|
||||
color_temp = 255 - kwargs[ATTR_COLOR_TEMP]
|
||||
self._lamp.white(color_temp)
|
||||
kelvin = int(color_util.color_temperature_mired_to_kelvin(
|
||||
kwargs[ATTR_COLOR_TEMP]))
|
||||
self._lamp.white(kelvin)
|
||||
return
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
|
@ -121,4 +126,4 @@ class IGloLamp(Light):
|
|||
self._on = state['on']
|
||||
self._brightness = state['brightness']
|
||||
self._rgb = state['rgb']
|
||||
self._color_temp = 255 - state['white']
|
||||
self._color_temp = state['white']
|
||||
|
|
|
@ -396,7 +396,7 @@ https://github.com/wokar/pylgnetcast/archive/v0.2.0.zip#pylgnetcast==0.2.0
|
|||
# i2csense==0.0.4
|
||||
|
||||
# homeassistant.components.light.iglo
|
||||
iglo==1.0.0
|
||||
iglo==1.1.3
|
||||
|
||||
# homeassistant.components.influxdb
|
||||
# homeassistant.components.sensor.influxdb
|
||||
|
|
Loading…
Add table
Reference in a new issue