paulhoule/tentacruel

Light Control Program can be put into various modes

Opened this issue · 0 comments

The most obvious use case for this is that the upstairs zone should not be turned on and off by
the motion sensors when the wake-up routine is running.

Here is how I want to do it.

Modes have leases, and the leases in turn are on a pushdown stack.

Modes have UUIDs. These UUIDs could be the UUIDs of a device or a zone, which is great except for one thing which is that an entity might have more than one mode associated with it,
but then we could say that entity has subentities inside of it: for instance a camera has a mode for the flash and a mode for the focus and those are two subsystems.

The document looks like (in YAML, but it will be stored in JSON)::

_key: caf89ac6-4c19-11e9-b4a5-9eb6d06a70c5
stack:
- pink
- blue
modes:
pink:
expires: 2019-08-01T14:22:11Z
blue:
expires:2019-08-01T15:25:11Z

There is a hierarchy of operations. When the light show is running, the light show
overrides the normal control program.

The lease mechanism is there to make the system fail-safe. If the wake-up program
crashes the system will self-recover its state.

This scheme depends on the order of the elements to denote priority, so that if
the wake-up script crashes, control goes back to normal eventually.