comparison light_bridge.py @ 6:fc8ed0efcd72

move init to Lights
author drewp@bigasterisk.com
date Sun, 28 Jan 2024 16:02:31 -0800
parents 7eeda7f4f9cd
children 05fb0319eb64
comparison
equal deleted inserted replaced
5:7eeda7f4f9cd 6:fc8ed0efcd72
39 return EventSourceResponse(g()) 39 return EventSourceResponse(g())
40 40
41 41
42 def main(): 42 def main():
43 lights = Lights() 43 lights = Lights()
44 lights.add(Light('do-desk', 'topic1', True, Color('#ff0000'), {'r': 255}, Color('#000000'), 100))
45 lights.add(Light('do-desk2', 'topic2', True, Color('#ff00ff'), {'r': 255}, Color('#000000'), 200))
46 graph = PatchableGraph() 44 graph = PatchableGraph()
47 app = Starlette(debug=True, 45 app = Starlette(debug=True,
48 routes=[ 46 routes=[
49 Route('/api/output', partial(output, lights), methods=['PUT']), 47 Route('/api/output', partial(output, lights), methods=['PUT']),
50 Route('/api/table', partial(table, lights)), 48 Route('/api/table', partial(table, lights)),