orchestracities / lego-diorama-usi-2022

This repository hosts code, configuration and documentation to deploy Orchestra Cities lego diorama.
Apache License 2.0
0 stars 0 forks source link

reformat streelight code based on [#18] #19

Closed chicco785 closed 2 years ago

chicco785 commented 2 years ago

https://github.com/orchestracities/lego-diorama-usi-2022/blob/c853492d9d894653cdb7d23e7597c415a6fdc9e8/traffic/street_lights_client.py#L58

the flow should be:

  1. subscribe to command topic
  2. when command received to turn on light (e.g. { "light": { "power": "on" } }):
    1. turn on lights (a leave them on - the off control will be done with an external logic that ask to turn off)
    2. send ack to cmdexe topic (e.g. { "light": { "power": "ok" } })
    3. update status attribute on attrs topic (e.g. { "powerState": "on" })
  3. when command received to turn off light (e.g. { "light": { "power": "off" } }):
    1. turn off lights
    2. send ack to cmdexe topic (e.g. { "light": { "power": "ok" } })
    3. update status attribute on attrs topic (e.g. { "powerState": "off" })