Branchwell

Lightwell / prototype / demo.py

1"""No network or hardware access: two simulated lights on a local scene."""
2from datetime import datetime, time, timezone
3from lightwell import Controller, LightState, Schedule, SimulatedLights
4
5lights = SimulatedLights("holiday", "accent")
6controller = Controller(lights, {"holiday", "accent"})
7controller.add_scene("evening", {
8 "holiday": LightState(True, 55, (255, 174, 95)),
9 "accent": LightState(True, 30, (245, 209, 164)),
10})
11controller.add_schedule(Schedule("after-dusk", time(18, 0), "evening"))
12now = datetime(2026, 11, 29, 18, 0, tzinfo=timezone.utc)
13print("Scheduled local scene:", controller.run_due(now))
14print("Repeated tick:", controller.run_due(now))
15lights.offline_devices.add("accent")
16print("Manual request with one device unavailable:", controller.apply("evening"))