Add brightness control to Key Colors targets with HAOS integration

Adds brightness (0.0-1.0) to KeyColorsSettings, applies scaling in the
KC processing pipeline after smoothing, exposes a slider on the WebUI
target card, and creates a HA number entity for KC target brightness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 02:26:46 +03:00
parent 10e426be13
commit 46be9922bd
8 changed files with 131 additions and 11 deletions

View File

@@ -45,6 +45,7 @@ class KeyColorsSettings:
interpolation_mode: str = "average"
smoothing: float = 0.3
pattern_template_id: str = ""
brightness: float = 1.0
def to_dict(self) -> dict:
return {
@@ -52,6 +53,7 @@ class KeyColorsSettings:
"interpolation_mode": self.interpolation_mode,
"smoothing": self.smoothing,
"pattern_template_id": self.pattern_template_id,
"brightness": self.brightness,
}
@classmethod
@@ -61,6 +63,7 @@ class KeyColorsSettings:
interpolation_mode=data.get("interpolation_mode", "average"),
smoothing=data.get("smoothing", 0.3),
pattern_template_id=data.get("pattern_template_id", ""),
brightness=data.get("brightness", 1.0),
)