Add relative color temp control

This commit is contained in:
2026-02-15 21:29:56 +01:00
parent 9825e748cf
commit d9b4e39a69
46 changed files with 99 additions and 95 deletions

View File

@@ -1167,7 +1167,7 @@ class BridgeManager:
await self._call_light_service(
port.entity_id,
"turn_on",
{"color_temp": _kelvin_to_mireds(kelvin)},
{ATTR_COLOR_TEMP_KELVIN: int(round(kelvin))},
)
return
@@ -1477,7 +1477,7 @@ class BridgeManager:
await self._call_light_service(
port.entity_id,
"turn_on",
{"color_temp": _kelvin_to_mireds(next_kelvin)},
{ATTR_COLOR_TEMP_KELVIN: int(round(next_kelvin))},
)
await asyncio.sleep(0.3)
@@ -1740,8 +1740,8 @@ def _color_temperature_payload(
percent = (kelvin - min_kelvin) / (max_kelvin - min_kelvin) * 100
return int(round(_clamp_percent(int(round(percent))))), "percent"
if port.color_temperature_mode == "absolute_float":
return float(kelvin), "9"
return int(round(kelvin)), "7.600"
return float(kelvin), "2byte_float"
return int(round(kelvin)), "2byte_unsigned"
def _color_temperature_from_value(