Modularize bridge and improve control GUI

This commit is contained in:
2026-08-03 00:55:12 +02:00
parent 73b302a965
commit f4ab49e0c8
26 changed files with 3104 additions and 1953 deletions
+37
View File
@@ -0,0 +1,37 @@
import unittest
from frigate_camera_control_bridge.ui import render_page
class DummyAction:
def __init__(self):
self.id = "example_camera_siren"
self.platform = "switch"
self.kind = "dahua_coaxial_io"
self.state = "ON"
self.auto_off_seconds = 180
self.auto_off_at = 1234567890
self.cfg = {
"name_key": "action.siren",
"requires_ack": True,
"snapshot": {"camera": "example", "frigate_url": "http://frigate.example.test:5000"},
}
def display_name(self, lang):
return "Example siren"
def command_list(self):
return ["on", "off"]
class UiRenderTest(unittest.TestCase):
def test_timer_timestamp_and_ack_survive_server_render(self):
html = render_page([DummyAction()], "en")
self.assertIn('data-auto-off-at="1234567890"', html)
self.assertIn('data-requires-ack="true"', html)
self.assertIn("Example siren", html)
if __name__ == "__main__":
unittest.main()