#how to make an automation like "run only once per day, but only during a scheduled time and im away"

1 messages · Page 1 of 1 (latest)

fair wharf
#

so i have a thing i want to do

i have all the stuff to coordinate this but i want to know whats the best way to achieve the logic for this:

i have a roomba that i want to be able to run during a scheduled block (so i have the schedule entity for that), but only when i'm away from home (have BLE stuff for that), so i need it to trigger when i leave or when the schedule begins. BUT i only want this to happen once per schedule block! so how best to do this?
my instinct is to have a helper toggle that flips on when the schedule flips on like "available to clean" and flips off when the cleaning is requested, but i dont know if this is the best/idiomatic way to do this

real harness
#

There's a lot of ways to do this - personally I would approach this one of two ways.

Helper toggle - have it turn on at midnight, then turn it off when the roomba sets off - use it being on as a condition. Nice and simple, but requires an extra automation or trigger.

Button/Datetime Helper - use a template condition to check if the helper is not showing "today" - and then set it to now (either button press, or action depending on which you do) when you use the vacuum. Depending on what sensors the vacuum exposes you might even be able to avoid the helper

outer kite
#

You could also use a template condition to check the automation was last triggered before the start of the current calendar event. Something like this (untested):

{{ this.attributes.last_triggered | default(0 | as_datetime, true) < state_attr('calendar.my_calendar', 'start_time') | as_datetime(now()) | as_local }}
real harness
#

does the schedule entity have a start time attribute? tbh i don't use it much