paulhoule / tentacruel

MIT License
0 stars 0 forks source link

Light Control Program can be put into various modes #24

Open paulhoule opened 5 years ago

paulhoule commented 5 years ago

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:

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.