Skip to content

How to automate based on an ever-changing time? #186

Answered by craigbarratt
wsw70 asked this question in Q&A
Discussion options

You must be logged in to vote

Here's one approach. Just trigger off the MQTT message, and the task does a task.unique and then a task.wait_until until an hour before the school time (or skip if it's already less than an hour). After the task.wait_until it opens the shades. Each time you get a new MQTT update, the old task gets killed and replaced by the new one, which uses the potentially new time to do the next task.wait_until.

To make this only happen once per day, you'll also have to have a flag (eg, some state variable) that is set when the shades are auto-opened. Once the flag is set, the MQTT task trigger should be disabled by putting that condition in @state.active. You can reset the flag each morning with a fi…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@wsw70
Comment options

@craigbarratt
Comment options

@wsw70
Comment options

@dorbitbrown
Comment options

Answer selected by wsw70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants