Implement add-lux-target: reduce-only ambient lux gate

Optional per-profile lux sensor binding that dims lights when daylight
alone exceeds a user-set target (factor = target/current). Lights turn
off entirely below min_brightness. Two config fields, live lux reading
in the options flow, two conditional output sensors, sensor state
subscription with 5pp significance guard. 26/26 tasks, 138 tests green.
This commit is contained in:
Casey 2026-05-25 16:11:52 +02:00
commit 11fe23253c
18 changed files with 1047 additions and 19 deletions

View file

@ -184,6 +184,8 @@ async def test_curve_tick_publishes_outputs(hass) -> None:
"output_brightness",
"output_color_temp",
"sun_elevation",
"ambient_lux",
"lux_reduction",
"updated_at",
}
assert outputs["output_brightness"] == 72
@ -312,6 +314,8 @@ async def test_friendly_names_compose_correctly(hass) -> None:
entry = await _setup_entry(hass)
names = {}
for row in OUTPUT_SENSORS:
if row.get("conditional"):
continue
key = row["key"]
eid = _resolve_entity_id(hass, entry, key)
names[key] = hass.states.get(eid).attributes["friendly_name"]