Hi all
I am trying to bring one of my automations to the next level of usefulness using actionable notifications.
I currently have an automation that turns on my garage lights when I open either of the garage doors.
A second automation will then turn the lights off again 1 minute after I close the doors again (theory being I would leave the doors open whilst I am in there).
Thinking ahead, during winter, I may want to be in the garage and have the doors closed. What I would like is for HA to send me an actionable notification asking if I am still in the garage and want to leave the lights ON.
If I select “No” or don’t respond at all, I would like the automation to run as before and turn off the lights. If I select “Yes” then I want the lights to stay on until the automation re-runs (i.e. I open the doors again and leave).
I am using a helper to toggle the “lights stay on request”, but I can’t get the two possible outcomes of the automation to run.
Here is what I have in my yaml:
alias: Garage Lights On Alert with Door Closed
description: ''
trigger: # If either garage door gets closed having previously been open
- type: not_opened
platform: device
device_id: 6d5c85e2f0679194964493cee3c3e251
entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_03765f07_on_off
domain: binary_sensor
- type: not_opened
platform: device
device_id: 67587962dbffa3c81725d3a0abd7da48
entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_ea3e3908_on_off
domain: binary_sensor
condition: # If either of the garage lights are already on
- condition: or
conditions:
- condition: device
type: is_on
device_id: 977e50d28b13e909b88a13151ab81b67
entity_id: light.garage_light_1
domain: light
- condition: device
type: is_on
device_id: 977e50d28b13e909b88a13151ab81b67
entity_id: light.garage_light_2
domain: light
action: # Send a notification to my phone with two options
- service: notify.mobile_app_sm_g781b
data:
title: Garage Lights are ON
message: And the doors are shut.
data:
actions:
- action: KEEP_GARAGE_LIGHTS_ON
title: Keep Lights On
- action: SWITCH_GARAGE_LIGHTS_OFF
title: Switch Lights Off
- wait_for_trigger: # If the "Keep Lights On" action is requested turn on the "keep garage lights on" helper. Otherwise, timeout after 1 minute.
- platform: event
event_type: mobile_app_notification_action
event_data:
action: KEEP_GARAGE_LIGHTS_ON
timeout: '00:01:00'
continue_on_timeout: true
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.keep_garage_lights_on_helper
- choose:
- conditions: # Check the state of the "keep lights on helper". If it is OFF then continue to turn off the lights
- condition: state
entity_id: input_boolean.keep_garage_lights_on_helper
state: 'off'
sequence:
- type: turn_off
device_id: 977e50d28b13e909b88a13151ab81b67
entity_id: light.garage_light_1
domain: light
- type: turn_off
device_id: 977e50d28b13e909b88a13151ab81b67
entity_id: light.garage_light_2
domain: light
default: # Reset the helper to OFF to allow it to run again
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.keep_garage_lights_on_helper
mode: single
First time trying my hand at actionable notifications so I am sure I am doing something silly and obvious! All help gratefully recevied.