From 580bd692e6f7f40c1e37f8af4db2b9299154fa2c Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Tue, 14 Apr 2026 19:03:58 +0300 Subject: [PATCH] fix(scenes): coerce BindableFloat fps to int when snapshotting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OutputTarget.fps is a BindableFloat but TargetSnapshot.fps is a plain int — capture_current_snapshot was stuffing the BindableFloat directly into the snapshot, causing json.dumps to fail on recapture (500) and polluting the in-memory cache so subsequent list calls also 500'd with pydantic validation errors. --- server/src/ledgrab/core/scenes/scene_activator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/ledgrab/core/scenes/scene_activator.py b/server/src/ledgrab/core/scenes/scene_activator.py index 3890f47..cb12be3 100644 --- a/server/src/ledgrab/core/scenes/scene_activator.py +++ b/server/src/ledgrab/core/scenes/scene_activator.py @@ -6,6 +6,7 @@ These functions are used by both the scene-presets API route and the automation from typing import List, Optional, Set, Tuple from ledgrab.core.processing.processor_manager import ProcessorManager +from ledgrab.storage.bindable import bfloat from ledgrab.storage.output_target_store import OutputTargetStore from ledgrab.storage.scene_preset import ( ScenePreset, @@ -38,7 +39,7 @@ def capture_current_snapshot( running=running, color_strip_source_id=getattr(t, "color_strip_source_id", ""), brightness_value_source_id=getattr(t, "brightness_value_source_id", ""), - fps=getattr(t, "fps", 30), + fps=int(bfloat(getattr(t, "fps", 30), default=30.0)), ) ) @@ -82,7 +83,7 @@ async def apply_scene_state( changed["color_strip_source_id"] = ts.color_strip_source_id if getattr(target, "brightness_value_source_id", None) != ts.brightness_value_source_id: changed["brightness_value_source_id"] = ts.brightness_value_source_id - if getattr(target, "fps", None) != ts.fps: + if int(bfloat(getattr(target, "fps", 30), default=30.0)) != ts.fps: changed["fps"] = ts.fps if changed: target.update_fields(**changed)