Concept for uninterrupted automatic scaring #178
Labels
No labels
UserStory
bug
duplicate
enhancement
help wanted
hw task
invalid
question
refactoring
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mattzz/halloween#178
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The scary installations in the garden operate continuously and in an orchestrated fashion without the need for manual interaction
This implies:
To think about
Let's slice the poor elephant:
A) ms-Synced pulsing lights
B) Choreography
4) Have a choreography action trigger other scary actions based on a schedule that is synced with the external clock
- Start a choreography like a scary action (web call?)
- First sync with time then start other scary actions on certain times
- Have the same routine that is downloaded to all hosts and only triggers the local ones
5) Test with two RPIs that work together in a choreography
6) Make the choreography blocking so that only one can be running
C) Continuous Choreo
7) Restart choreography automatically after a choreography_interval DB field if DB flag continuous_choreogaphy_flag says so
8) Add routine to set the choreography_interval
9) Add routine to set and reset continuous_choreography_flag
D) Restart chores after reboot
10) Persist continuous_choreography_flag
11) Initialise after reboot with persisted flag
Y) Later: Allow several choreos
10) Give the choreography a name and DB parameter for running_choreography
11) Possible choreos are in cfg
Z) Poll choreo from server
12) Poll running choreography from server
Why DB fields? So that they can be changed via web interface.
We need in DB:
All are initialised by cfg values (for now),
Later
Think about it: How to deal with scary actions of a different duration? That should not be possible --> split prisoner actions
This means every scary host needs to know how long the actions of the others take --> cfg table? First hardcoded.
Now we have
TODO:
B, C and Y are done.
D needs a concept
Z is not important and would be one solution to share a config update
Open question:
** A fixed schedule could be configured at what time to start and which intervals to use when.
*** Disadvantage: Any rigid schedule never really works out. It might be too often and annoying or it might not be often enough.
** This point more to configuration by communication
*** Any wireless communication to the server may be impossible --> which would point to a wired ethernet connection to hosts that should be reliably reconfigured.
*** In case of unstable connections a polling mechanism may be better where the wifi-connected hosts poll configuration updates from a reliably reachable server ("master").
*** This would also allow hosts to switch back to choreography mode automatically and with the right interval after reboot
*** The hosts which are not called master could simply call the master and copy his choreography mode and duration.
*** Each host would expose mode and duration in its web UI
*** First step: Add a config demon to poll the master's state in regular intervals. Limit this to the choreography mode which is already exposed in the REST API. Test!
We now have a mechanism that polls the choreography mode. However, there is still something left to do:
Hosts have to poll for updates at around the same time so that all hosts start the choreography together.
A change of the duration is not yet implemented but also has to be done in a synchronized way. Especially when choreography mode is "on".
Implemented as planned in last post. All hosts involved in a choreography poll the mode at the beginning of the cycle. There is a potential race condition when the master changes the mode right in that moment. This could be avoided by a future improvement.
Another TODO: While there are different choreographies they all are enabled with the same mode from the master. Would it make sense to have different modes for each choreography. Puh, this is getting more and more complicated.
A change of the duration is not yet implemented but also has to be done in a synchronized way. Especially when choreography mode is "on". For this it would be nice if the master would update the duration at a time he knows that the hosts won't be checking it. They now all check at the beginning of the choreography cycle. Of course, the duration would also have to be configuration specific...
Duration is now called "interval" and that's the interval to start a new the choreography regardless of how long it takes. This means more choreographies can run at the same time at different stages of progression.
Still to do:
The other open item to support more choreographies with different choreography_mode states and - in the future - intervals can be overcome easily by programming a master responsible for each choreography. E.g. Dolores would be reponsible for the graveyard. The weremonkey for the stairs routine. This would only require to add a hostname entry for the boss of each choreography. Seems like a good trade off and avoids too much complexity.
So, TODO:
What happens if someone change the interval at non-master? Maybe allow only for the configured master of a choreography.
If the interval can be other values than N*interval==3600 then we also need the overflow handler for the last shorter interval(s) of the hour...