Fix group member planning for low brightness

This commit is contained in:
ajp_anton
2026-06-01 04:34:32 +00:00
parent cdf1f4e3a1
commit afafd4fe93
6 changed files with 295 additions and 66 deletions
+25 -1
View File
@@ -2,7 +2,7 @@ from __future__ import annotations
from lights_config import GROUPS, LIGHTS
from ha_deconz_bridge.color import Color
from ha_deconz_bridge.debugger.web_debugger import _combine_specs, _group_debug_spec
from ha_deconz_bridge.debugger.web_debugger import _combine_specs, _group_debug_spec, _solve_group_request
from ha_deconz_bridge.lights import ChannelSpec, ControllerModeSpec, ControllerSpec, VirtualLightSpec
from ha_deconz_bridge.solver import solve_light
from ha_deconz_bridge.solver_model import compile_light_model
@@ -686,3 +686,27 @@ def test_example_all_lights_ct_sweep_does_not_use_unused_onoff_reference() -> No
previous = levels
assert max_delta < 0.9
def test_debugger_group_low_brightness_keeps_onoff_members_off() -> None:
group = GROUPS["Living Room"]
group_spec = _group_debug_spec(group, LIGHTS)
models = {
name: compile_light_model(spec)
for name, spec in LIGHTS.items()
}
result = _solve_group_request(
group,
LIGHTS,
group_spec,
{"mode": "color_temp", "brightness": 1, "color_temp": 500},
model_for_light=models.__getitem__,
)
assert result["commands"]["plug_a"]["on"] is False
assert result["commands"]["plug_b"]["on"] is False
assert result["channel_levels"].get("plug_a.onoff.w", 0.0) == 0.0
assert result["channel_levels"].get("plug_b.onoff.w", 0.0) == 0.0
assert result["channel_levels"].get("fixed_a.color_temp.ww", 0.0) == 0.0
assert result["channel_levels"].get("fixed_b.color_temp.ww", 0.0) == 0.0