I have an automation that should defiantly be execute, but within specific hours.
Meaning that, when triggers - i defiantly want it to perform, however if the trigger happens let’s say at 23:00, i want to action to wait until it’s working hours (8:00 - 22:00) to take place.
So i can’t use “wait” & “time” in “conditions” section - since if it triggers at 22:01 - the conditions won’t be met and the action won’t perform.
I want the action to always perform - but only at specific hours.
What i’m trying to do is, once my roborock finishes to clean, i check if it cleaned over 40sqm, and if so, i send him to wait next to the trash can - so i can empty him.
The problem is that he might finish at 23:30 at night, and then wait all night draining his battery.
So i would like him to “wait” until it’s like 8:00 and only then go to the trash can.
Here is my current script:
alias: Alfred notifying when he's full after 40sq (testing at specific hours)
description: This sends Alfred to the trash can to wait to be cleaned.
trigger:
- platform: state
entity_id: vacuum.alfred
to: returning
condition:
- condition: template
value_template: >-
{{ (trigger.to_state.attributes.total_cleaned_area / 40)|int >
(trigger.from_state.attributes.total_cleaned_area / 40)|int }}
action:
- wait_template: |-
{% if states('vacuum.alfred') == "docked" %}
True
{% else %}
False
{% endif %}
timeout: '3:00'
continue_on_timeout: true
- service: script.vacuum_maintenance_trash_can
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: notify.mobile_app_ziv_cellphone
data:
title: testing alfred (roborock) at specific hours
message: this is test to clean alfred (roborock)
mode: single
Hi there, Please try this script. I have only scripted the part with time and actions. Hope you can work it out. I have used choose action. Do let me know if this needs change.
action:
- choose:
- conditions:
- condition: time
after: '08:00:00'
before: '22:00:00'
sequence:
- service: script.vacuum_maintenance_trash_can
default:
- wait_for_trigger:
- platform: time
at: '08:00:00'
continue_on_timeout: false
- service: script.vacuum_maintenance_trash_can
- service: notify.mobile_app_ziv_cellphone
data:
title: testing alfred (roborock) at specific hours
message: this is test to clean alfred (roborock)
i need the actions that i’ve mentioned (i now see you removed some of them) so they still need to exist.
I see a condition mention this shuold work if it’s between 8:00 till 22:00,
But i want the action to also work even if it’s 23:00,
However if it’s not in working hours (say 8:00 - 22:00), i want it to wait until the working hours and then perform the steps mention in my script.
I just gave the basic outline for the action. The complete automation would look like below.
alias: Alfred notifying when he's full after 40sq (testing at specific hours)
description: This sends Alfred to the trash can to wait to be cleaned.
trigger:
- platform: state
entity_id: vacuum.alfred
to: returning
condition:
- condition: template
value_template: >-
{{ (trigger.to_state.attributes.total_cleaned_area / 40)|int >
(trigger.from_state.attributes.total_cleaned_area / 40)|int }}
action:
- choose:
- conditions:
- condition: time
after: '08:00:00'
before: '22:00:00'
sequence:
- wait_template: |-
{% if states('vacuum.alfred') == "docked" %}
True
{% else %}
False
{% endif %}
timeout: '3:00'
continue_on_timeout: true
- service: script.vacuum_maintenance_trash_can
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: notify.mobile_app_ziv_cellphone
data:
title: testing alfred (roborock) at specific hours
message: this is test to clean alfred (roborock)
default:
- wait_for_trigger:
- platform: time
at: '08:00:00'
continue_on_timeout: false
- wait_template: |-
{% if states('vacuum.alfred') == "docked" %}
True
{% else %}
False
{% endif %}
timeout: '3:00'
continue_on_timeout: true
- service: script.vacuum_maintenance_trash_can
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: notify.mobile_app_ziv_cellphone
data:
title: testing alfred (roborock) at specific hours
message: this is test to clean alfred (roborock)
mode: single
I believe this should work for you. The idea is that the when the robovac is returning this will be triggered and if the cleaned area is above the mentioned and time is between 8am and 10 pm, the robovac would move to the trash and wait. If the time is not between 8am and 10pm, the robot would go to the doc and start charging and when its 8 am would move to trash and wait. Please try it.