For a while now, I have had several automations written and working around being able to temporarily disable my security camera array. For example, if we wanted to work out in the yard for a few hours, we’d select the 2hr sleep. It kicks off a timer and when the timer expires it turns them back on. It’s been on my to-do list to take advantage of the choose:
option added to the automation capabilities recently and combine the 4-5 automations handling this temporary disable into one.
Since the holidays are here, I decided to try to tackle it and it’s going very well. I ran into a snag when trying to combine the notification messaging into the massive automation block. Simply, I cannot figure out how to really take advantage of the event object that comes back so I can include it properly inside my conditions
statement.
I have my choose
set up generically matching platform == 'event'
and the default case falls through and it will create a persistent notification with the trigger, trigger.event and trigger.event.data so I can see what it looks like:
Trigger:{'platform': 'event', 'event': <Event timer.finished[L]: entity_id=timer.zm_cameras_timer>, 'description': "event 'timer.finished'"}
Event:<Event timer.finished[L]: entity_id=timer.zm_cameras_timer>
Data:{"entity_id": "timer.zm_cameras_timer"}
I’d like to take test for timer.finished
inside the condition: template
below but not sure how to go about doing that. Clearly, the ‘event’ is a timer object but I don’t know how to address it since it’s not json. how?
- conditions:
- condition: template
value_template: "{{ trigger.platform == 'event' }}"
sequence:
- service: input_select.select_option
data:
entity_id: input_select.zm_disable_select
option: Cameras on
- service: notify.group_everything
data:
message: "Camera timer has expired, cameras are back on"
title: Camera timer
data:
tag: camera_alert
priority: normal
importance: default
actions:
- action: cameras_off_5mins
title: +5min
- action: cameras_off_1hr
title: +1hr