Hey Guys,
I have an iCal thats linked to my Google Calendar and it lets me know if I have a reservation at my Airbnb. When a reservation begins marks the days (all-day) of the calendar as “Reserved”. Furthermore, the state of my devices will not always be available, so I have to loop and check every 10 minutes to see if the state is available and act accordingly.
I am trying to switch on my geyser/fridge when the reservation starts and then off again when the reservation ends.
I am trying to switch the geyser/fridge on at (or ‘from’) 08:00 on the reservation start date (because they check in at 14:00, sometimes earlier).
I currently have a separate automation for the ‘off’ phase but if it could all be incorporated into one, that would be awesome!
Ive set a limit of 99 times to try and to give up trying by 14:00
Please let me know if I am on the right track and if this would work?
description: ""
trigger:
- platform: calendar
event: start
offset: "8:0:0"
entity_id: >-
calendar.the_cal_id
condition:
- condition: template
value_template: "{{ 'Reserved' in trigger.calendar_event.summary }}"
action:
- repeat:
while:
- >-
{{ not is_state('switch.geyser', 'on') or not
is_state('switch.fridge', 'on') }}
- condition: time
before: "14:00"
- condition: template
value_template: "{{ repeat.index <= 99 }}"
sequence:
- type: turn_on
device_id: geyser_id
entity_id: switch.geyser
domain: switch
- type: turn_on
device_id: fridge_id
entity_id: switch.fridge
domain: switch
- service: notify.mobile_app_ipad
data:
title: Reservation Start
message: Attempted Geyser & Fridge Switch On
- service: notify.mobile_app_iphone
data:
title: Reservation Start
message: Attempted Geyser & Fridge Switch On
- delay:
minutes: 10
mode: single
type or paste code here