Split adaptive value source into explicit adaptive_time and adaptive_scene types

Replace single "adaptive" type with adaptive_mode sub-selector by two
distinct source types in the dropdown. Removes the adaptive_mode field
entirely — the source_type itself carries the mode. Clearer UX with
"Adaptive (Time of Day)" and "Adaptive (Scene)" as separate options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 15:23:50 +03:00
parent d339dd3f90
commit 1e4a7a067f
10 changed files with 142 additions and 170 deletions

View File

@@ -7,8 +7,8 @@ on demand via ``get_value()``. Five concrete types:
AnimatedValueStream — evaluates a periodic waveform (sine/triangle/square/sawtooth)
AudioValueStream — polls audio analysis for RMS/peak/beat, applies
sensitivity and temporal smoothing
TimeOfDayValueStream — interpolates brightness along a 24h schedule
SceneValueStream — derives brightness from a picture source's frame luminance
TimeOfDayValueStream — interpolates brightness along a 24h schedule (adaptive_time)
SceneValueStream — derives brightness from a picture source's frame luminance (adaptive_scene)
ValueStreams are cheap (trivial math or single poll), so they compute inline
in the caller's processing loop — no background threads required.
@@ -362,7 +362,7 @@ class TimeOfDayValueStream(ValueStream):
def update_source(self, source: "ValueSource") -> None:
from wled_controller.storage.value_source import AdaptiveValueSource
if isinstance(source, AdaptiveValueSource) and source.adaptive_mode == "time_of_day":
if isinstance(source, AdaptiveValueSource) and source.source_type == "adaptive_time":
self._parse_schedule(source.schedule)
self._min = source.min_value
self._max = source.max_value
@@ -463,7 +463,7 @@ class SceneValueStream(ValueStream):
def update_source(self, source: "ValueSource") -> None:
from wled_controller.storage.value_source import AdaptiveValueSource
if not isinstance(source, AdaptiveValueSource) or source.adaptive_mode != "scene":
if not isinstance(source, AdaptiveValueSource) or source.source_type != "adaptive_scene":
return
self._behavior = source.scene_behavior
@@ -603,7 +603,7 @@ class ValueStreamManager:
)
if isinstance(source, AdaptiveValueSource):
if source.adaptive_mode == "scene":
if source.source_type == "adaptive_scene":
return SceneValueStream(
picture_source_id=source.picture_source_id,
scene_behavior=source.scene_behavior,
@@ -613,7 +613,6 @@ class ValueStreamManager:
max_value=source.max_value,
live_stream_manager=self._live_stream_manager,
)
# Default: time_of_day
return TimeOfDayValueStream(
schedule=source.schedule,
min_value=source.min_value,