Home Assistant release with the issue: 0.88
Last working Home Assistant release (if known):0.87.1
Operating environment (Hass.io/Docker/Windows/etc.):Hass.io
Component/platform: knx / light.py
Description of problem: Light not added, just cover are added
LOG:
2019-02-21 10:12:31 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform knx
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/knx/light.py", line 69, in async_setup_platform
async_add_entities_discovery(hass, discovery_info, async_add_entities)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/knx/light.py", line 80, in async_add_entities_discovery
entities.append(KNXLight(device))
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/knx/light.py", line 132, in __init__
color_util.color_temperature_kelvin_to_mired(self._max_kelvin)
File "/usr/local/lib/python3.7/site-packages/homeassistant/util/color.py", line 516, in color_temperature_kelvin_to_mired
return math.floor(1000000 / kelvin_temperature)
TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'
xknx.yaml (light section):
light:
Ingresso: {group_address_switch: '0/0/1', group_address_switch_state: '0/1/1'}
Divano: {group_address_switch: '0/0/10', group_address_switch_state: '0/1/10'}
Zona_Tv: {group_address_switch: '0/0/9', group_address_switch_state: '0/1/9'}
Madia: {group_address_switch: '0/0/21', group_address_switch_state: '0/1/21'}
Pranzo: {group_address_switch: '0/0/11', group_address_switch_state: '0/1/11'}
Isola: {group_address_switch: '0/0/12', group_address_switch_state: '0/1/12'}
Pensili: {group_address_switch: '0/0/13', group_address_switch_state: '0/1/13'}
Camera: {group_address_switch: '0/0/15', group_address_switch_state: '0/1/15'}
Specchio_Camera: {group_address_switch: '0/0/19', group_address_switch_state: '0/1/19'}
Bagno_Camera: {group_address_switch: '0/0/18', group_address_switch_state: '0/1/18'}
Cabina Armadio: {group_address_switch: '0/0/17', group_address_switch_state: '0/1/17'}
Cameretta: {group_address_switch: '0/0/7', group_address_switch_state: '0/1/7'}
Bagno: {group_address_switch: '0/0/5', group_address_switch_state: '0/1/5'}
Specchio_Bagno: {group_address_switch: '0/0/4', group_address_switch_state: '0/1/4'}
Lavanderia: {group_address_switch: '0/0/3', group_address_switch_state: '0/1/3'}
AntiBagno: {group_address_switch: '0/0/2', group_address_switch_state: '0/1/2'}
Balcone_Cucina: {group_address_switch: '0/0/14', group_address_switch_state: '0/1/14'}
Balcone_Sala: {group_address_switch: '0/0/8', group_address_switch_state: '0/1/8'}
Balcone_Camera: {group_address_switch: '0/0/16', group_address_switch_state: '0/1/16'}
Cromoterapia: {group_address_switch: '0/0/6', group_address_switch_state: '0/1/6'}
Log updated
I have the same issue, if "fixed" this locally by doing:
diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py
index f2a6f15e0..7ff269084 100644
--- a/homeassistant/components/knx/light.py
+++ b/homeassistant/components/knx/light.py
@@ -113,8 +113,8 @@ def async_add_entities_config(hass, config, async_add_entities):
group_address_tunable_white_state=group_address_tunable_white_state,
group_address_color_temperature=group_address_color_temp,
group_address_color_temperature_state=group_address_color_temp_state,
- min_kelvin=config[CONF_MIN_KELVIN],
- max_kelvin=config[CONF_MAX_KELVIN])
+ min_kelvin=2700, # config[CONF_MAX_KELVIN]
+ max_kelvin=6000) # config[CONF_MIN_KELVIN]
hass.data[DATA_KNX].xknx.devices.add(light)
async_add_entities([KNXLight(light)])
@@ -126,8 +126,8 @@ class KNXLight(Light):
"""Initialize of KNX light."""
self.device = device
- self._min_kelvin = device.min_kelvin
- self._max_kelvin = device.max_kelvin
+ self._min_kelvin = 2700 # device.min_kelvin
+ self._max_kelvin = 6000 # device.max_kelvin
self._min_mireds = \
color_util.color_temperature_kelvin_to_mired(self._max_kelvin)
self._max_mireds = \
Will try to investigate further this weekend.
EDIT:
Julius I create a custom component using your suggestions and now it's working.
@furiaceka87: We wouldn't suggest you doing that. Instead you could try to specify min_kelvin and max_kelvin in your config.
Lavanderia: {group_address_switch: '0/0/3', group_address_switch_state: '0/1/3', min_kelvin: 2700, max_kelvin: 6000}
Copy paste this for every light you have and you should be good to go. Please note that this is only a workaround and you won't need to use this with an upcoming release but still I think it's easier and better than nothing.
@Julius2342 The problem probably relies in the fact that we are using discovery when we use xknx.yml thus we ignore default values from the HA config.
I'd suggest the following fix:
diff --git a/xknx/devices/light.py b/xknx/devices/light.py
index 669a619..541ecac 100644
--- a/xknx/devices/light.py
+++ b/xknx/devices/light.py
@@ -21,6 +21,8 @@ class Light(Device):
"""Class for managing a light."""
# pylint: disable=too-many-locals
+ DEFAULT_MIN_KELVIN = 2700 # 370 mireds
+ DEFAULT_MAX_KELVIN = 6000 # 166 mireds
def __init__(self,
xknx,
@@ -128,9 +130,9 @@ class Light(Device):
group_address_color_temperature_state = \
config.get('group_address_color_temperature_state')
min_kelvin = \
- config.get('min_kelvin')
+ config.get('min_kelvin', Light.DEFAULT_MIN_KELVIN)
max_kelvin = \
- config.get('max_kelvin')
+ config.get('max_kelvin', Light.DEFAULT_MAX_KELVIN)
return cls(xknx,
name,
XKNX 0.10.0 has been released.
When it will be included in Home Assistant?
Most helpful comment
@furiaceka87: We wouldn't suggest you doing that. Instead you could try to specify min_kelvin and max_kelvin in your config.
Copy paste this for every light you have and you should be good to go. Please note that this is only a workaround and you won't need to use this with an upcoming release but still I think it's easier and better than nothing.
@Julius2342 The problem probably relies in the fact that we are using discovery when we use
xknx.ymlthus we ignore default values from the HA config.I'd suggest the following fix: