I have an automation set up (below) to run my Roomba vacuums which is mostly working. The condition template was just added from reading another thread so not sure if that part is functional yet. What I really want it to do is more complex then I can manage to come up with though and I’m looking for some assistance. I’ll try my best to explain what I’m trying to do.
Run once a day only
Only start between 09:00-18:00 mon-sat
Only start if the tv is off (harmony integration)
Force start at 17:00 if it hasn’t already run
alias: Vacuum house
description: ''
trigger:
- platform: time
at: '12:00:00'
id: time
- platform: state
to: not_home
from: home
for:
hours: 0
minutes: 15
seconds: 0
entity_id: group.someones_home
condition:
- condition: time
weekday:
- mon
- tue
- wed
- fri
- sat
before: '18:00:00'
after: '09:00:00'
- condition: template
value_template: >-
-{{ state_attr('this.entity_id','last_triggered') | default(today_at(),
true) < today_at('05:00') }}
- condition: state
entity_id: remote.living_room
state: power_off
attribute: current_activity
action:
- scene: scene.vacuum
mode: single
Those are just the triggers I added when I created it to try and get it going.
Ideally the vacancy trigger would apply starting at 09:00 and then a trigger covering the 12-18:00 if the tv is off.
Okay let me try again.
Trigger if everyone leaves between 09:00-18:00
Trigger at 12:00 if the tv is off, if not continue to check every #mins until 17:00
Trigger at 17:00 regardless if it hasn’t run previously because of conditions
I’m still new and trying to learn what’s possible so I don’t even know if this is doable,
It’s all doable but we will be wasting out time if the requirements aren’t clearly defined. For example, the original list of requirements didn’t mention it should trigger the moment everyone leaves (yet the example you posted had it as a trigger). That’s why I asked for clarification.
Instead of “check every X minutes” why not just trigger the moment the TV gets turned off (between noon and 17:00)?
If a Time Trigger triggers at noon but the TV is not off (this is a condition), nothing happens; the automation doesn’t execute its action.
If a State Trigger monitoring the TV’s state, is triggered when the TV is turned off, and the Time Condition confirms it’s between noon and 17:00, the automation will execute its action (assuming all other conditions are also met).
Does that sound like the way you want it to work?
EDIT
What’s the TV’s entity_id? Is it remote.living_room?
Trigger between 9-12 if/when house is vacant
Trigger between 12-17 if/when TV has been off for 5mins
Trigger at 17 regardless of conditions above if it hasn’t run yet
Only run once a day
Yes - below variables “should” work
condition: state
entity_id: remote.living_room
state: PowerOff
attribute: current_activity
Trigger between 9-12 if/when house is vacant
Trigger between 12-17 if/when TV has been off for 5mins
Is this behavior you want?
If the house becomes vacant between 9-12, it will trigger.
If the house becomes vacant between 12-17 it will not trigger.
If the TV turns off between 12-17, it will trigger.
If the TV turns off between 9-12, it will not trigger.
Basically, if the TV is turned off in the morning (or is never turned on) and the house becomes vacant shortly after 12:00, nothing will happen until the Time Trigger at 17:00. Seems like a waste of several hours when the vacuum could be operating.
Crap I suck at this. Okay
If the house becomes vacant between 9-17, trigger
At 12, if tv is off, trigger
If tv turns off between 12-17, trigger
At 1700, trigger
Trigger is 15 minutes after the Harmony is turned off or 5:00 PM. Create a toggle helper. Call it Vacuum has run, or whatever. Youll need another automation that turns that toggle back off every night at midnight.
I don’t understand how this would work. The way I read this it will only start between 9-17 if no one is home and the tv is off. How do the conditions apply to the specific triggers.
Okay so here are two separate automations that if both are enabled will trigger the action like I want. Only trouble is, since they are separate, the condition to only run once a day applies to each separately. How do I combine them so they only run once.
alias: Vacuum house (Duplicate1)
description: ''
trigger:
- platform: state
to: not_home
from: home
for:
hours: 0
minutes: 15
seconds: 0
entity_id: group.someones_home
- platform: time
at: '17:00:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- fri
- sat
before: '18:00:00'
after: '09:00:00'
- condition: template
value_template: >-
-{{ state_attr('this.entity_id','last_triggered') | default(today_at(),
true) < today_at('05:00') }}
I copied this from another thread and just forgot to adjust the time.
I have another automation that shuts everything in the house off if everyone leaves. Besides, if no one is there watching, who cares if you can’t hear because the vacuum is running.
Yes. I just don’t want it to start if I’m home watching TV. At least not until 17:00
Probably from one of my posts because I recognize the template, right down to the time which met the needs of the person for whom I created the template.
Understood. It can run when no one is home (morning and afternoon) or when someone is home as long as the TV is off (but only in the afternoon). I can adapt the original example to meet these requirements.