mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Update xknx to 2.11.0: Add support for Light DPT 9 color temperature (#95213)
Update xknx to 2.11.0
This commit is contained in:
parent
1d9821efa2
commit
f4756fe1f9
@ -118,6 +118,7 @@ class ColorTempModes(Enum):
|
|||||||
"""Color temperature modes for config validation."""
|
"""Color temperature modes for config validation."""
|
||||||
|
|
||||||
ABSOLUTE = "DPT-7.600"
|
ABSOLUTE = "DPT-7.600"
|
||||||
|
ABSOLUTE_FLOAT = "DPT-9"
|
||||||
RELATIVE = "DPT-5.001"
|
RELATIVE = "DPT-5.001"
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,11 @@ from __future__ import annotations
|
|||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
from xknx import XKNX
|
from xknx import XKNX
|
||||||
from xknx.devices.light import Light as XknxLight, XYYColor
|
from xknx.devices.light import (
|
||||||
|
ColorTemperatureType,
|
||||||
|
Light as XknxLight,
|
||||||
|
XYYColor,
|
||||||
|
)
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
@ -56,16 +60,20 @@ def _create_light(xknx: XKNX, config: ConfigType) -> XknxLight:
|
|||||||
group_address_tunable_white_state = None
|
group_address_tunable_white_state = None
|
||||||
group_address_color_temp = None
|
group_address_color_temp = None
|
||||||
group_address_color_temp_state = None
|
group_address_color_temp_state = None
|
||||||
if config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.ABSOLUTE:
|
color_temperature_type = ColorTemperatureType.UINT_2_BYTE
|
||||||
group_address_color_temp = config.get(LightSchema.CONF_COLOR_TEMP_ADDRESS)
|
if config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.RELATIVE:
|
||||||
group_address_color_temp_state = config.get(
|
|
||||||
LightSchema.CONF_COLOR_TEMP_STATE_ADDRESS
|
|
||||||
)
|
|
||||||
elif config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.RELATIVE:
|
|
||||||
group_address_tunable_white = config.get(LightSchema.CONF_COLOR_TEMP_ADDRESS)
|
group_address_tunable_white = config.get(LightSchema.CONF_COLOR_TEMP_ADDRESS)
|
||||||
group_address_tunable_white_state = config.get(
|
group_address_tunable_white_state = config.get(
|
||||||
LightSchema.CONF_COLOR_TEMP_STATE_ADDRESS
|
LightSchema.CONF_COLOR_TEMP_STATE_ADDRESS
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
# absolute uint or float
|
||||||
|
group_address_color_temp = config.get(LightSchema.CONF_COLOR_TEMP_ADDRESS)
|
||||||
|
group_address_color_temp_state = config.get(
|
||||||
|
LightSchema.CONF_COLOR_TEMP_STATE_ADDRESS
|
||||||
|
)
|
||||||
|
if config[LightSchema.CONF_COLOR_TEMP_MODE] == ColorTempModes.ABSOLUTE_FLOAT:
|
||||||
|
color_temperature_type = ColorTemperatureType.FLOAT_2_BYTE
|
||||||
|
|
||||||
return XknxLight(
|
return XknxLight(
|
||||||
xknx,
|
xknx,
|
||||||
@ -140,6 +148,7 @@ def _create_light(xknx: XKNX, config: ConfigType) -> XknxLight:
|
|||||||
group_address_brightness_white_state=individual_color_addresses(
|
group_address_brightness_white_state=individual_color_addresses(
|
||||||
LightSchema.CONF_WHITE, LightSchema.CONF_BRIGHTNESS_STATE_ADDRESS
|
LightSchema.CONF_WHITE, LightSchema.CONF_BRIGHTNESS_STATE_ADDRESS
|
||||||
),
|
),
|
||||||
|
color_temperature_type=color_temperature_type,
|
||||||
min_kelvin=config[LightSchema.CONF_MIN_KELVIN],
|
min_kelvin=config[LightSchema.CONF_MIN_KELVIN],
|
||||||
max_kelvin=config[LightSchema.CONF_MAX_KELVIN],
|
max_kelvin=config[LightSchema.CONF_MAX_KELVIN],
|
||||||
)
|
)
|
||||||
@ -239,7 +248,7 @@ class KNXLight(KnxEntity, LightEntity):
|
|||||||
"""Return the color temperature in Kelvin."""
|
"""Return the color temperature in Kelvin."""
|
||||||
if self._device.supports_color_temperature:
|
if self._device.supports_color_temperature:
|
||||||
if kelvin := self._device.current_color_temperature:
|
if kelvin := self._device.current_color_temperature:
|
||||||
return kelvin
|
return int(kelvin)
|
||||||
if self._device.supports_tunable_white:
|
if self._device.supports_tunable_white:
|
||||||
relative_ct = self._device.current_tunable_white
|
relative_ct = self._device.current_tunable_white
|
||||||
if relative_ct is not None:
|
if relative_ct is not None:
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"loggers": ["xknx", "xknxproject"],
|
"loggers": ["xknx", "xknxproject"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"xknx==2.10.0",
|
"xknx==2.11.0",
|
||||||
"xknxproject==3.2.0",
|
"xknxproject==3.2.0",
|
||||||
"knx-frontend==2023.6.23.191712"
|
"knx-frontend==2023.6.23.191712"
|
||||||
]
|
]
|
||||||
|
@ -2688,7 +2688,7 @@ xbox-webapi==2.0.11
|
|||||||
xiaomi-ble==0.17.2
|
xiaomi-ble==0.17.2
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknx==2.10.0
|
xknx==2.11.0
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknxproject==3.2.0
|
xknxproject==3.2.0
|
||||||
|
@ -1967,7 +1967,7 @@ xbox-webapi==2.0.11
|
|||||||
xiaomi-ble==0.17.2
|
xiaomi-ble==0.17.2
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknx==2.10.0
|
xknx==2.11.0
|
||||||
|
|
||||||
# homeassistant.components.knx
|
# homeassistant.components.knx
|
||||||
xknxproject==3.2.0
|
xknxproject==3.2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user