Daemon to automate control of lights
Uses mqtt for both control and state
Note that all messages are to be sent as persistent
Messages that are really commands will be deleted by the controller
as a way of acknowledging processing that command
mqtt hierarchy
lighting/<region>/#
region is a set of lights that turn on and off at the same time.
Examples might be "indoor" or "outdoor"
Messages that should be set by an outside configuration utility or
UI:
lighting/<region>/window-start
value is either "light", which means turn on at dusk or hh:mm.
Time is on a 24 hour clock. Default is "light"
lighting/<region>/window-end
value is hh:mm.
lighting/<region>/devices
payload is a comma separated list of devices in this region.
Completely overwrites the previous list of devices. Any devices
that are in another region are moved to this one Any devices
that were in this region but not listed here are dropped.
lighting/<region>/command
These are commands that might be generated by an UI
Payload is one of "on", "off", "toggle"
The command will be erased to acknowledge it
Any other ocmmand will be silently erased.
lighting/<region>/drop
all the devices in the region
lighting/<region>/season/start
value is mm/dd. Default is year round
lighting/<region>/season/end
value is mm/dd. Default is year round
lighting/enable
value is true or false
Messages that are internal state and should NOT be messed with
lighting/<region>/control
Values are "auto", "manual-o", "manual-i"
When "auto" lights are off outside the window, and on inside the window.
More on window below.
When "manual-*" lights are the oposite of the auto setting.
If the state is "manual-o" and we are inside the window, or if
the state is "manual-i" and we are outside the window, set the
state to auto.
There are various ways to set the "manual-*" state, including
by button press on the plug devices. If the button is set
and we are in manual-*, set it to auto. IF the button is set
and we are in auto, set to manual-i if inside the window, and
manual-o if we are outside the window.
lighting/<region>/state
values are "on" and "off". Current state of the lights.