Most Alexa actionable notification examples are using NODE RED I thought I would share how using Home Assistant UI automation editor.
I am no expert this is just how I figured out how to make things work with Home assistant automation editor for I am slowly moving all my NODE RED automations to HA . If you have some good examples of better ways of improving please share in the comments.
This automates a Alexa Actionable notification if something is open for 3 minutes and the A/C system is in COOLING
HVAC action.
Alexa announces :
ATTENTION… The AC is cooling and something is left open… Would you like me to shut off the AC?
When told YES then the A/C system with be turned OFF
When told NO or NO response the automation will wait 3 minutes and then Re trigger (automation.trigger) the Actionable notification automation to ask again.
A 3rd automation (A/C off if something open 30m) will shut off the A/C if something is open and COOLING or HEATING for 33 minutes.
This Actionable notification has several components.
-
Alexa actionable Notification Setup. Actionable Notifications via Alexa Media Player
-
Door and window group
binary_sensor.doors_and_windows
with all monitored doors and windows.
Using Helpers go to helpers - group - binary sensor group to create a binary group sensor.
-
Value_templatet Sensor
ac_state_with_doorsandwindows
using AC systems HVAC action (cooling, heating and Idle) combined with Door and window group That gives each state if a door or window is open and AC has HVAC action active.
(window-open-cooling, window-open-heating, window-open-idle, IDLE, heating and cooling) -
Two Automations using HA UI automation editor
actionable notification and Actionable Response -
An Additional fail safe 3rd automation
Automation to shut off AC if something is open and HEATING OR COOLING for 30 minutes
Value_templatet Sensor Located in template.yaml
Open template.yaml with your file editor and Paste in the below yaml
# sensor for each heating mode and any doors and windows open using multiple entities
- sensors:
# Give the sensor a name
ac_state_with_doorsandwindows:
# Provide a friendly name
friendly_name: House AC State with door and windows
# Set the state based on the state of a seperate sensor
value_template: >-
{%-if is_state('binary_sensor.doors_and_windows', 'on') and is_state_attr("climate.house_a_c", "hvac_action", "cooling") %}
window-open-cooling
{%-elif is_state('binary_sensor.doors_and_windows', 'on') and is_state_attr("climate.house_a_c", "hvac_action", "heating") %}
window-open-heating
{%-elif is_state('binary_sensor.doors_and_windows', 'on') and is_state_attr("climate.house_a_c", "hvac_action", "idle") %}
window-open-idle
{%-elif is_state_attr("climate.house_a_c", "hvac_action", "idle") %}
IDLE
{%-elif is_state_attr("climate.house_a_c", "hvac_action", "cooling") %}
cooling
{%-elif is_state_attr("climate.house_a_c", "hvac_action", "heating") %}
heating
{% else %}
Not available
{% endif %}
Automation 1
Alexa actionable notification A/C is COOLING and something open automation
Open a new automation go to Edit in YAML Paste in the below yaml
alias: alexa actionable notification A/C on and something open
description: >-
If "sensor.ac_state_with_doorsandwindows" state is "window-open-cooling"
Alexa will announce AC is cooling and something is open. and asked if you want
to shut OFF A/C?
The automation "Alexa Actionable Response something open" handles your response of YES, NO or NO response.
I also have a fail safe Automation "A/C off if something open 30m" if "House
AC State with door and windows" state is "window-open-cooling" or
"window-open-heating" for 30 minutes it will shut off A/C
trigger:
- platform: state
entity_id:
- sensor.ac_state_with_doorsandwindows
for:
hours: 0
minutes: 3
seconds: 0
to: window-open-cooling
from: null
condition:
- condition: time
after: "07:00:00"
before: "23:59:00"
weekday:
- sun
- mon
- tue
- wed
- thu
- fri
- sat
action:
- action: media_player.volume_set
metadata: {}
data:
volume_level: 0.81
target:
entity_id:
- media_player.kitchen
- media_player.mom_s_room
- action: script.activate_alexa_actionable_notification
data:
text: " ATTENTION... The AC is cooling and something is left open... Would you like me to shut off the AC?"
event_id: ac_on
alexa_device: media_player.mom_s_room
- action: script.activate_alexa_actionable_notification
data:
text: " ATTENTION... The AC is cooling and something is left open... Would you like me to shut off the AC?"
event_id: ac_on
alexa_device: media_player.kitchen
enabled: true
mode: restart
Automation 2
Alexa Actionable Response smething open and AC cooling Automation
Open a new automation go to Edit in YAML Paste in the below yaml
alias: Alexa Actionable Response something open
description: >-
Turn off AC if YES
Will Run notification Automation again if "NO" or No response is given and
something still open after 10 minutes.
Is triggered by event ID "ac_on" of the automation of "alexa actionable
notification A/C on and something open"
I also have a fail safe Automation "A/C off if something open 30m" if "House
AC State with door and windows" state is "window-open-cooling" or
"window-open-heating" for 30 minutes it will shut off A/C
trigger:
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: ac_on
event_response_type: ResponseYes
id: "yes"
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: ac_on
event_response_type: ResponseNo
id: "no"
- platform: event
event_type: alexa_actionable_notification
event_data:
event_id: ac_on
event_response_type: ResponseNone
id: no response
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- "yes"
sequence:
- action: climate.turn_off
metadata: {}
data: {}
target:
device_id: c95b720c4d7bd743ea80f07822cf4863
enabled: true
- conditions:
- condition: or
conditions:
- condition: trigger
id:
- no response
- "no"
sequence:
- delay:
hours: 0
minutes: 3
seconds: 0
milliseconds: 0
- condition: state
entity_id: sensor.ac_state_with_doorsandwindows
state: window-open-cooling
- action: automation.trigger
data:
skip_condition: true
target:
entity_id: automation.ac_on
mode: single
Automation to shut off AC if something is open and HEATING OR COOLING for 30 minutes
Open a new automation go to Edit in YAML Paste in the below yaml
alias: A/C off if something open 30m
description: shuts off heating or cooling if something open for 30 minutes
trigger:
- platform: state
entity_id:
- sensor.ac_state_with_doorsandwindows
from: null
to: window-open-cooling
for:
hours: 0
minutes: 33
seconds: 0
- platform: state
entity_id:
- sensor.ac_state_with_doorsandwindows
from: null
to: window-open-heating
for:
hours: 0
minutes: 33
seconds: 0
condition: []
action:
- action: climate.turn_off
metadata: {}
data: {}
target:
device_id: c95b720c4d7bd743ea80f07822cf4863
mode: single
Alexa text to speech tip…
add ...
between phases for a pause in speech.
Notes are included in each automation Descriptions