Get UI working for background detector things

This commit is contained in:
Julian Stirling 2026-01-13 19:05:24 +00:00
parent 44860bf777
commit 3e8874188e
5 changed files with 70 additions and 38 deletions

View file

@ -173,6 +173,10 @@ class BaseCamera(lt.Thing):
dictionary in this function. Configuration will be added at a later date.
"""
super().__init__(thing_server_interface)
# Default is never updated but is used if the value set from settings is
# incorrect. In the future a better way to set defaults for thing slot mappings
# would be ideal.
self._default_detector = "bg_channel_deviations_luv"
self._detector_name = "bg_channel_deviations_luv"
def __enter__(self) -> Self:
@ -591,6 +595,9 @@ class BaseCamera(lt.Thing):
@property
def active_detector(self) -> BackgroundDetectAlgorithm:
"""The active background detector instance."""
if self.detector_name not in self.background_detectors:
self.logger.warning(f"No detector named {self.detector_name}")
self.detector_name = self._default_detector
return self.background_detectors[self.detector_name]
@lt.action

View file

@ -181,7 +181,7 @@ class SimulatedCamera(BaseCamera):
@lt.property
def calibration_required(self) -> bool:
"""Whether the camera needs calibrating."""
return not self.background_detector_status.ready
return not self.active_detector.ready
def generate_sprites(self) -> None:
"""Generate sprites to populate the image."""