Last active
January 4, 2024 13:51
-
-
Save Blackshome/06f6f28e76299267b813dac48608f549 to your computer and use it in GitHub Desktop.
state-notifications-and-actions.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: State Notifications & Actions | |
description: > | |
# 📍 State Notifications & Actions | |
**Version: 1.2** | |
Let us know what you think of this blueprint and for community support including updates: [Click Here](https://community.home-assistant.io/t/state-notifications-actions/612617?u=blacky) | |
**The Automation Process:** | |
- Triggers on an entity state change or on numeric state changes to above or below a set value. There are two triggers that are called "Start Entities" and "End Entities". | |
- When an entity changes to the entered state or on a numeric state change, you have the option to send notifications to one or multiple devices. The notification has options to include 3 action buttons + a cancel button. You also have the option to send a confirmation message when an action button is pressed. This can be useful when sending notifications to multiple devices as it will let the other devices know when an action has been pressed. | |
- You can input one or more global conditions. | |
- Notifications can work with Apple IOS and Android devices. One for all, and all for one. | |
- When an entity changes to the entered state or on a numeric state change, you have the option to set 3 different action groups. Each action group can have as many actions you like. | |
Required = * | |
The Settings & Best Practice Guidelines: [Click Here](https://community.home-assistant.io/t/state-notifications-actions/612617/3?u=blacky) | |
Need help? See our FAQ: [Click Here](https://community.home-assistant.io/t/state-notifications-actions/612617/2?u=blacky) | |
**If you like my blueprints, and would like to show your support or just say thank you?** [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8) 🙂 | |
domain: automation | |
input: | |
# Trigger | |
entity_a_trigger: | |
name: Start Entities * | |
description: Select the entities that you would like to use. You can enter one or multiple entities. | |
selector: | |
entity: | |
multiple: true | |
choose_entity_a_state: | |
name: Start Trigger - Fixed State or Numeric State Options | |
description: Choose the type of trigger you would like to use. Fixed state is for "on, off, unavalible, etc" and numeric state is for a number value. | |
The numeric state trigger will be when the value crosses over to below or to above the set value. | |
default: enable_fixed_state_option | |
selector: | |
select: | |
options: | |
- label: 1 - Enable fixed state option | |
value: "enable_fixed_state_option" | |
- label: 2 - Enable numeric state - Below option | |
value: "enable_numeric_state_below_option" | |
- label: 3 - Enable numeric state - Above option | |
value: "enable_numeric_state_above_option" | |
entity_a_state: | |
name: Start Trigger - Fixed State Option | |
description: Input the entity state that will trigger the automation. | |
default: [] | |
selector: | |
text: | |
below_vale_a_state: | |
name: Start Trigger - Numeric State Below Option | |
description: Set the below value. The numeric state trigger will be when the value crosses over to below the set value. | |
default: 0 | |
selector: | |
number: | |
min: -20 | |
max: 100 | |
step: 1 | |
unit_of_measurement: value | |
above_vale_a_state: | |
name: Start Trigger - Numeric State Above Option | |
description: Set the above value. The numeric state trigger will be when the value crosses over to above the set value. | |
default: 0 | |
selector: | |
number: | |
min: -20 | |
max: 100 | |
step: 1 | |
unit_of_measurement: value | |
time_delay_a_state: | |
name: Start Trigger - Time Delay | |
description: The state trigger will only fire if the state holds for the set time delay. It is used as a buffer to stop false triggers. | |
default: 0 | |
selector: | |
number: | |
min: 0 | |
max: 10 | |
step: 0.5 | |
unit_of_measurement: minutes | |
entity_b_trigger: | |
name: End Entities | |
description: Select the entities that you would like to use. You can enter one or multiple entities. | |
default: [] | |
selector: | |
entity: | |
multiple: true | |
choose_entity_b_state: | |
name: End Trigger - Fixed State or Numeric State Options | |
description: Choose the type of trigger you would like to use. Fixed state is for "on, off, unavalible, etc" and numeric state is for a number value. | |
The numeric state trigger will be when the value crosses over to below or to above the set value. | |
default: enable_fixed_state_option | |
selector: | |
select: | |
options: | |
- label: 1 - Enable fixed state option | |
value: "enable_fixed_state_option" | |
- label: 2 - Enable numeric state - Below option | |
value: "enable_numeric_state_below_option" | |
- label: 3 - Enable numeric state - Above option | |
value: "enable_numeric_state_above_option" | |
entity_b_state: | |
name: End Trigger - Fixed State Option | |
description: Input the entity state that will trigger the automation. | |
default: [] | |
selector: | |
text: | |
below_vale_b_state: | |
name: End Trigger - Numeric State Below Option | |
description: Set the below value. The numeric state trigger will be when the value crosses over to below the set value. | |
default: 0 | |
selector: | |
number: | |
min: -20 | |
max: 100 | |
step: 1 | |
unit_of_measurement: value | |
above_vale_b_state: | |
name: End Trigger - Numeric State Above Option | |
description: Set the above value. The numeric state trigger will be when the value crosses over to above the set value. | |
default: 0 | |
selector: | |
number: | |
min: -20 | |
max: 100 | |
step: 1 | |
unit_of_measurement: value | |
time_delay_b_state: | |
name: End Trigger - Time Delay | |
description: The state trigger will only fire if the state holds for the set time delay. It is used as a buffer to stop false triggers. | |
default: 0 | |
selector: | |
number: | |
min: 0 | |
max: 10 | |
step: 0.5 | |
unit_of_measurement: minutes | |
global_conditions: | |
name: Global Conditions | |
description: Enter any global conditions you would like to apply to the automation. | |
default: [] | |
selector: | |
condition: | |
include_start_notify: | |
name: Use The Start Notify Options (Optional) | |
description: Select enable if you would like to be notified when the entity changes to its set state. | |
default: disable_start_notify_options | |
selector: | |
select: | |
options: | |
- label: Enable Start Notify Options | |
value: "enable_start_notify_options" | |
- label: Disable Start Notify Options | |
value: "disable_start_notify_options" | |
start_notify_device: | |
name: Start Notify - Devices To Notify | |
description: Select the devices to be notified when the entity changes to its set state. | |
default: [] | |
selector: | |
device: | |
filter: | |
- integration: mobile_app | |
multiple: true | |
start_title: | |
name: Start Notify - Title | |
description: The notification title when the entity changes to its set state. | |
default: [] | |
selector: | |
text: | |
start_message: | |
name: Start Notify - Message | |
description: The notification message when the entity changes to its set state. | |
default: [] | |
selector: | |
text: | |
include_start_action_buttons: | |
name: Start Notify - Action Buttons Options (Optional) | |
description: Enable the action buttons you would like to use. Action buttons will be shown in the notification, allowing you to perform the action when you click on the button. | |
**NOTE** - You do not need to select any notification action buttons to run an action. | |
default: [] | |
selector: | |
select: | |
options: | |
- label: Enable action button 1 | |
value: "enable_start_action_button_1" | |
- label: Enable action button 2 | |
value: "enable_start_action_button_2" | |
- label: Enable action button 3 | |
value: "enable_start_action_button_3" | |
multiple: true | |
start_action_button_1: | |
name: Start Notify - Action Button 1 | |
description: Enter the button name to be displayed in the notification. | |
This button runs all the actions entered into "Start - Action 1" input below. | |
default: [] | |
selector: | |
text: | |
start_action_button_2: | |
name: Start Notify - Action Button 2 | |
description: Enter the button name to be displayed in the notification. | |
This button runs all the actions entered into "Start - Action 2" input below. | |
default: [] | |
selector: | |
text: | |
start_action_button_3: | |
name: Start Notify - Action Button 3 | |
description: Enter the button name to be displayed in the notification. | |
This button runs all the actions entered into "Start - Action 3" input below. | |
default: [] | |
selector: | |
text: | |
start_action_button_stop: | |
name: Start Notify - CANCEL Action Button | |
description: Enter the CANCEL button name to be displayed in the notification. | |
This button will cancel all actions and stop the automation. | |
It will be automatically included in the notification if you have enabled an action button above. | |
default: [] | |
selector: | |
text: | |
start_time_delay: | |
name: Start Notify - Time Delay | |
description: The time delay after which the automation will continue its execution if an action button has not been pressed. | |
default: | |
hours: 0 | |
minutes: 30 | |
seconds: 0 | |
selector: | |
duration: | |
include_start_action_button_confirmation: | |
name: Start Notify - Action Button Confirmation Option (Optional) | |
description: Select enable if you would like to notify all the devices when an action button has been pressed. | |
This is handy when notifying multiple devices. It lets the other devices know that an action has been pressed. | |
default: disable_start_action_button_confirmation | |
selector: | |
select: | |
options: | |
- label: Enable Action Button Confirmation | |
value: "enable_start_action_button_confirmation" | |
- label: Disable Action Button Confirmation | |
value: "disable_start_action_button_confirmation" | |
start_action_button_confirmation_title: | |
name: Start Notify - Action Button Confirmation Title | |
description: The notification title when an action button is pressed or the time delay has passed. | |
default: [] | |
selector: | |
text: | |
start_action_button_confirmation_message: | |
name: Start Notify - Action Button Confirmation Message | |
description: The notification message when an action button is pressed. | |
default: [] | |
selector: | |
text: | |
start_time_delay_confirmation_message: | |
name: Start Notify - Time Delay Confirmation Message | |
description: The notification message when the time delay has passed. | |
default: [] | |
selector: | |
text: | |
include_start_auto_actions: | |
name: Use The Start Auto Action Options (Optional) | |
description: Enabling an auto option will allow the "Start Actions" below to run when the entity changes to its set state. | |
When using action buttons in a notification, you do not need to enable these options for the start actions to work. | |
If you miss the notification and didn't press an action button, then enabling a start auto action option will make sure the action still runs. | |
default: [] | |
selector: | |
select: | |
options: | |
- label: Enable start auto action 1 | |
value: "enable_start_action_1" | |
- label: Enable start auto action 2 | |
value: "enable_start_action_2" | |
- label: Enable start auto action 3 | |
value: "enable_start_action_3" | |
multiple: true | |
start_action_1: | |
name: Start Action - Action 1 | |
description: Enter the actions you would like to run when the entity changes to its set state. | |
This action is also linked to "Start Notify - Action Button 1" in the start notifications. | |
default: [] | |
selector: | |
action: | |
start_action_2: | |
name: Start Action - Action 2 | |
description: Enter the actions you would like to run when the entity changes to its set state. | |
This action is also linked to "Start Notify - Action Button 2" in the start notifications. | |
default: [] | |
selector: | |
action: | |
start_action_3: | |
name: Start Action - Action 3 | |
description: Enter the actions you would like to run when the entity changes to its set state. | |
This action is also linked to "Start Notify - Action Button 3" in the start notifications. | |
default: [] | |
selector: | |
action: | |
include_end_notify: | |
name: Use The End Notify Options (Optional) | |
description: Select enable if you would like to be notified when the entity changes to its set state. | |
default: disable_end_notify_options | |
selector: | |
select: | |
options: | |
- label: Enable End Notify Options | |
value: "enable_end_notify_options" | |
- label: Disable End Notify Options | |
value: "disable_end_notify_options" | |
end_notify_device: | |
name: End Notify - Devices To Notify | |
description: Select the devices to be notified when the entity changes to its set state. | |
default: [] | |
selector: | |
device: | |
filter: | |
- integration: mobile_app | |
multiple: true | |
end_title: | |
name: End Notify - Title | |
description: The notification title when the entity changes to its set state. | |
default: [] | |
selector: | |
text: | |
end_message: | |
name: End Notify - Message | |
description: The notification message when the entity changes to its set state. | |
default: [] | |
selector: | |
text: | |
include_end_action_buttons: | |
name: End Notify - Action Buttons Options (Optional) | |
description: Enable the action buttons you would like to use. Action buttons will be shown in the notification, allowing you to perform the action when you click on the button. | |
**NOTE** - You do not need to select any notification action buttons to run an action. | |
default: [] | |
selector: | |
select: | |
options: | |
- label: Enable action button 1 | |
value: "enable_end_action_button_1" | |
- label: Enable action button 2 | |
value: "enable_end_action_button_2" | |
- label: Enable action button 3 | |
value: "enable_end_action_button_3" | |
multiple: true | |
end_action_button_1: | |
name: End Notify - Action Button 1 | |
description: Enter the button name to be displayed in the notification. | |
This button runs all the actions entered into "End - Action 1" input below. | |
default: [] | |
selector: | |
text: | |
end_action_button_2: | |
name: End Notify - Action Button 2 | |
description: Enter the button name to be displayed in the notification. | |
This button runs all the actions entered into "End - Action 2" input below. | |
default: [] | |
selector: | |
text: | |
end_action_button_3: | |
name: End Notify - Action Button 3 | |
description: Enter the button name to be displayed in the notification. | |
This button runs all the actions entered into "End - Action 3" input below. | |
default: [] | |
selector: | |
text: | |
end_action_button_stop: | |
name: End Notify - CANCEL Action Button | |
description: Enter the CANCEL button name to be displayed in the notification. | |
This button will cancel all actions and stop the automation. | |
It will be automatically included in the notification if you have enabled an action button above. | |
default: [] | |
selector: | |
text: | |
end_time_delay: | |
name: End Notify - Time Delay | |
description: The time delay after which the automation will continue its execution if an action button has not been pressed. | |
default: | |
hours: 0 | |
minutes: 30 | |
seconds: 0 | |
selector: | |
duration: | |
include_end_action_button_confirmation: | |
name: End Notify - Action Button Confirmation Option (Optional) | |
description: Select enable if you would like to notify all the devices when an action button has been pressed. | |
This is handy when notifying multiple devices. It lets the other devices know that an action has been pressed. | |
default: disable_end_action_button_confirmation | |
selector: | |
select: | |
options: | |
- label: Enable Action Button Confirmation | |
value: "enable_end_action_button_confirmation" | |
- label: Disable Action Button Confirmation | |
value: "disable_end_action_button_confirmation" | |
end_action_button_confirmation_title: | |
name: End Notify - Action Button Confirmation Title | |
description: The notification title when an action button is pressed or the time delay has passed. | |
default: [] | |
selector: | |
text: | |
end_action_button_confirmation_message: | |
name: End Notify - Action Button Confirmation Message | |
description: The notification message when an action button is pressed. | |
default: [] | |
selector: | |
text: | |
end_time_delay_confirmation_message: | |
name: End Notify - Time Delay Confirmation Message | |
description: The notification message when the time delay has passed. | |
default: [] | |
selector: | |
text: | |
include_end_auto_actions: | |
name: Use The End Auto Action Options (Optional) | |
description: Enabling an auto option will allow the "End Actions" below to run when the entity changes to its set state. | |
When using action buttons in a notification, you do not need to enable these options for the end actions to work. | |
If you miss the notification and didn't press an action button, then enabling an end auto action option will make sure the action still runs. | |
default: [] | |
selector: | |
select: | |
options: | |
- label: Enable auto end action 1 option | |
value: "enable_end_action_1" | |
- label: Enable auto end action 2 option | |
value: "enable_end_action_2" | |
- label: Enable auto end action 3 option | |
value: "enable_end_action_3" | |
multiple: true | |
end_action_1: | |
name: End Action - Action 1 | |
description: Enter the actions you would like to run when the entity changes to its set state. | |
This action is also linked to "End Notify - Action Button 1" in the end notifications. | |
default: [] | |
selector: | |
action: | |
end_action_2: | |
name: End Action - Action 2 | |
description: Enter the actions you would like to run when the entity changes to its set state. | |
This action is also linked to "End Notify - Action Button 2" in the end notifications. | |
default: [] | |
selector: | |
action: | |
end_action_3: | |
name: End Action - Action 3 | |
description: Enter the actions you would like to run when the entity changes to its set state. | |
This action is also linked to "End Notify - Action Button 3" in the end notifications. | |
default: [] | |
selector: | |
action: | |
mode: restart | |
max_exceeded: silent | |
variables: | |
entity_a_trigger: !input entity_a_trigger | |
choose_entity_a_state: !input choose_entity_a_state | |
entity_a_state: !input entity_a_state | |
below_vale_a_state: !input below_vale_a_state | |
above_vale_a_state: !input above_vale_a_state | |
time_delay_a_state: !input time_delay_a_state | |
entity_b_trigger: !input entity_b_trigger | |
choose_entity_b_state: !input choose_entity_b_state | |
entity_b_state: !input entity_b_state | |
below_vale_b_state: !input below_vale_b_state | |
above_vale_b_state: !input above_vale_b_state | |
time_delay_b_state: !input time_delay_b_state | |
global_conditions: !input global_conditions | |
include_start_notify: !input include_start_notify | |
start_notify_device: !input start_notify_device | |
start_title: !input start_title | |
start_message: !input start_message | |
include_start_action_buttons: !input include_start_action_buttons | |
start_action_button_1: !input start_action_button_1 | |
start_action_button_2: !input start_action_button_2 | |
start_action_button_3: !input start_action_button_3 | |
start_action_button_stop: !input start_action_button_stop | |
start_time_delay: !input start_time_delay | |
include_start_action_button_confirmation: !input include_start_action_button_confirmation | |
start_action_button_confirmation_title: !input start_action_button_confirmation_title | |
start_action_button_confirmation_message: !input start_action_button_confirmation_message | |
start_time_delay_confirmation_message: !input start_time_delay_confirmation_message | |
include_start_auto_actions: !input include_start_auto_actions | |
start_action_1: !input start_action_1 | |
start_action_2: !input start_action_2 | |
start_action_3: !input start_action_3 | |
include_end_notify: !input include_end_notify | |
end_notify_device: !input end_notify_device | |
end_title: !input end_title | |
end_message: !input end_message | |
include_end_action_buttons: !input include_end_action_buttons | |
end_action_button_1: !input end_action_button_1 | |
end_action_button_2: !input end_action_button_2 | |
end_action_button_3: !input end_action_button_3 | |
end_action_button_stop: !input end_action_button_stop | |
end_time_delay: !input end_time_delay | |
include_end_action_button_confirmation: !input include_end_action_button_confirmation | |
end_action_button_confirmation_title: !input end_action_button_confirmation_title | |
end_action_button_confirmation_message: !input end_action_button_confirmation_message | |
end_time_delay_confirmation_message: !input end_time_delay_confirmation_message | |
include_end_auto_actions: !input include_end_auto_actions | |
end_action_1: !input end_action_1 | |
end_action_2: !input end_action_2 | |
end_action_3: !input end_action_3 | |
trigger: | |
- platform: state | |
id: "t0" | |
entity_id: !input entity_a_trigger | |
to: !input entity_a_state | |
for: | |
minutes: !input time_delay_a_state | |
- platform: numeric_state | |
id: "t0_1" | |
entity_id: !input entity_a_trigger | |
below: !input below_vale_a_state | |
for: | |
minutes: !input time_delay_a_state | |
- platform: numeric_state | |
id: "t0_2" | |
entity_id: !input entity_a_trigger | |
above: !input above_vale_a_state | |
for: | |
minutes: !input time_delay_a_state | |
- platform: state | |
id: "t1" | |
entity_id: !input entity_b_trigger | |
to: !input entity_b_state | |
for: | |
minutes: !input time_delay_b_state | |
- platform: numeric_state | |
id: "t1_1" | |
entity_id: !input entity_b_trigger | |
below: !input below_vale_b_state | |
for: | |
minutes: !input time_delay_b_state | |
- platform: numeric_state | |
id: "t1_2" | |
entity_id: !input entity_b_trigger | |
above: !input above_vale_b_state | |
for: | |
minutes: !input time_delay_b_state | |
# All Conditions | |
condition: | |
#Trigger conditions | |
- condition: or | |
conditions: | |
- condition: and # trigger by start of event | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_fixed_state_option' in choose_entity_a_state }}" | |
- condition: trigger | |
id: 't0' | |
- condition: state | |
entity_id: !input entity_a_trigger | |
match: any | |
state: !input entity_a_state | |
- condition: template | |
value_template: "{{ ('enable_start_notify_options' in include_start_notify) or ('enable_start_action_1' in include_start_auto_actions) or ('enable_start_action_2' in include_start_auto_actions) or ('enable_start_action_3' in include_start_auto_actions) }}" | |
- condition: and # trigger by numeric state below | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_numeric_state_below_option' in choose_entity_a_state }}" | |
- condition: trigger | |
id: 't0_1' | |
- condition: template | |
value_template: "{{ ('enable_start_notify_options' in include_start_notify) or ('enable_start_action_1' in include_start_auto_actions) or ('enable_start_action_2' in include_start_auto_actions) or ('enable_start_action_3' in include_start_auto_actions) }}" | |
- condition: and # trigger by numeric state below | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_numeric_state_above_option' in choose_entity_a_state }}" | |
- condition: trigger | |
id: 't0_2' | |
- condition: template | |
value_template: "{{ ('enable_start_notify_options' in include_start_notify) or ('enable_start_action_1' in include_start_auto_actions) or ('enable_start_action_2' in include_start_auto_actions) or ('enable_start_action_3' in include_start_auto_actions) }}" | |
- condition: and # trigger by end of event | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_fixed_state_option' in choose_entity_b_state }}" | |
- condition: trigger | |
id: 't1' | |
- condition: state | |
entity_id: !input entity_b_trigger | |
match: any | |
state: !input entity_b_state | |
- condition: template | |
value_template: "{{ ('enable_end_notify_options' in include_end_notify) or ('enable_end_action_1' in include_end_auto_actions) or ('enable_end_action_2' in include_end_auto_actions) or ('enable_end_action_3' in include_end_auto_actions) }}" | |
- condition: and # trigger by numeric state below | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_numeric_state_below_option' in choose_entity_b_state }}" | |
- condition: trigger | |
id: 't1_1' | |
- condition: template | |
value_template: "{{ ('enable_end_notify_options' in include_end_notify) or ('enable_end_action_1' in include_end_auto_actions) or ('enable_end_action_2' in include_end_auto_actions) or ('enable_end_action_3' in include_end_auto_actions) }}" | |
- condition: and # trigger by numeric state above | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_numeric_state_above_option' in choose_entity_b_state }}" | |
- condition: trigger | |
id: 't1_2' | |
- condition: template | |
value_template: "{{ ('enable_end_notify_options' in include_end_notify) or ('enable_end_action_1' in include_end_auto_actions) or ('enable_end_action_2' in include_end_auto_actions) or ('enable_end_action_3' in include_end_auto_actions) }}" | |
# Global Conditions | |
- condition: and | |
conditions: !input global_conditions | |
action: | |
# Actions Variables | |
- alias: "Set up variables for the actions" | |
variables: | |
action_button_1: "{{ 'BUTTON_1_' ~ context.id }}" | |
action_button_2: "{{ 'BUTTON_2_' ~ context.id }}" | |
action_button_3: "{{ 'BUTTON_3_' ~ context.id }}" | |
action_button_stop: "{{ 'BUTTON_STOP_' ~ context.id }}" | |
# Automation | |
- choose: | |
- alias: "Start trigger" | |
conditions: | |
- condition: trigger | |
id: | |
- 't0' | |
- 't0_1' | |
- 't0_2' | |
sequence: | |
- choose: | |
- alias: "Check if the start of notification is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_start_notify_options' in include_start_notify }}" | |
sequence: | |
- choose: | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' in include_start_action_buttons) and ('enable_start_action_button_2' in include_start_action_buttons) and ('enable_start_action_button_3' in include_start_action_buttons) }}" | |
sequence: | |
- alias: "Send a notification to each device" | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input start_action_button_1 | |
- action: "{{ action_button_2 }}" | |
title: !input start_action_button_2 | |
- action: "{{ action_button_3 }}" | |
title: !input start_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input start_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' in include_start_action_buttons) and ('enable_start_action_button_2' in include_start_action_buttons) and ('enable_start_action_button_3' not in include_start_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input start_action_button_1 | |
- action: "{{ action_button_2 }}" | |
title: !input start_action_button_2 | |
- action: "{{ action_button_stop }}" | |
title: !input start_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' in include_start_action_buttons) and ('enable_start_action_button_2' not in include_start_action_buttons) and ('enable_start_action_button_3' in include_start_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input start_action_button_1 | |
- action: "{{ action_button_3 }}" | |
title: !input start_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input start_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' in include_start_action_buttons) and ('enable_start_action_button_2' not in include_start_action_buttons) and ('enable_start_action_button_3' not in include_start_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input start_action_button_1 | |
- action: "{{ action_button_stop }}" | |
title: !input start_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' not in include_start_action_buttons) and ('enable_start_action_button_2' in include_start_action_buttons) and ('enable_start_action_button_3' in include_start_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_2 }}" | |
title: !input start_action_button_2 | |
- action: "{{ action_button_3 }}" | |
title: !input start_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input start_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' not in include_start_action_buttons) and ('enable_start_action_button_2' in include_start_action_buttons) and ('enable_start_action_button_3' not in include_start_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_2 }}" | |
title: !input start_action_button_2 | |
- action: "{{ action_button_stop }}" | |
title: !input start_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' not in include_start_action_buttons) and ('enable_start_action_button_2' not in include_start_action_buttons) and ('enable_start_action_button_3' in include_start_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_3 }}" | |
title: !input start_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input start_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' not in include_start_action_buttons) and ('enable_start_action_button_2' not in include_start_action_buttons) and ('enable_start_action_button_3' not in include_start_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_title | |
message: !input start_message | |
data: | |
sticky: "true" | |
- choose: | |
- alias: "Check if any start action buttons are enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_start_action_button_1' in include_start_action_buttons) or ('enable_start_action_button_2' in include_start_action_buttons) or ('enable_start_action_button_3' in include_start_action_buttons) }}" | |
sequence: | |
- alias: "Wait for a response from the action button" | |
wait_for_trigger: | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_1 }}" | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_2 }}" | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_3 }}" | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_stop }}" | |
timeout: !input start_time_delay | |
- choose: | |
- alias: "Check if confirmation message is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_start_action_button_confirmation' in include_start_action_button_confirmation }}" | |
sequence: | |
- if: | |
- alias: "Confirmation from the actions buttons" | |
condition: template | |
value_template: "{{ wait.trigger.idx is defined }}" | |
then: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_action_button_confirmation_title | |
message: !input start_action_button_confirmation_message | |
- alias: "Perform the action button selected action" | |
choose: | |
- conditions: "{{ wait.trigger.event.data.action == action_button_1 }}" | |
sequence: !input start_action_1 | |
- conditions: "{{ wait.trigger.event.data.action == action_button_2 }}" | |
sequence: !input start_action_2 | |
- conditions: "{{ wait.trigger.event.data.action == action_button_3 }}" | |
sequence: !input start_action_3 | |
- conditions: "{{ wait.trigger.event.data.action == action_button_stop }}" | |
sequence: | |
- stop: "Stop the automation" | |
else: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input start_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input start_action_button_confirmation_title | |
message: !input start_time_delay_confirmation_message | |
- alias: "Check if confirmation message is disabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'disable_start_action_button_confirmation' in include_start_action_button_confirmation }}" | |
sequence: | |
- if: | |
- alias: "Confirmation from the actions buttons" | |
condition: template | |
value_template: "{{ wait.trigger.idx is defined }}" | |
then: | |
- alias: "Perform the action button selected action" | |
choose: | |
- conditions: "{{ wait.trigger.event.data.action == action_button_1 }}" | |
sequence: !input start_action_1 | |
- conditions: "{{ wait.trigger.event.data.action == action_button_2 }}" | |
sequence: !input start_action_2 | |
- conditions: "{{ wait.trigger.event.data.action == action_button_3 }}" | |
sequence: !input start_action_3 | |
- conditions: "{{ wait.trigger.event.data.action == action_button_stop }}" | |
sequence: | |
- stop: "Stop the automation" | |
- choose: | |
- alias: "Check if auto action 1 is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_start_action_1' in include_start_auto_actions }}" | |
sequence: !input start_action_1 | |
- choose: | |
- alias: "Check if auto action 2 is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_start_action_2' in include_start_auto_actions }}" | |
sequence: !input start_action_2 | |
- choose: | |
- alias: "Check if auto action 3 is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_start_action_3' in include_start_auto_actions }}" | |
sequence: !input start_action_3 | |
default: | |
- choose: | |
- alias: "End Trigger" | |
conditions: | |
- condition: trigger | |
id: | |
- 't1' | |
- 't1_1' | |
- 't1_2' | |
sequence: | |
- choose: | |
- alias: "Check if end of notification is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ include_end_notify == 'enable_end_notify_options' }}" | |
sequence: | |
- choose: | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' in include_end_action_buttons) and ('enable_end_action_button_2' in include_end_action_buttons) and ('enable_end_action_button_3' in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input end_action_button_1 | |
- action: "{{ action_button_2 }}" | |
title: !input end_action_button_2 | |
- action: "{{ action_button_3 }}" | |
title: !input end_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input end_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' in include_end_action_buttons) and ('enable_end_action_button_2' in include_end_action_buttons) and ('enable_end_action_button_3' not in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input end_action_button_1 | |
- action: "{{ action_button_2 }}" | |
title: !input end_action_button_2 | |
- action: "{{ action_button_stop }}" | |
title: !input end_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' in include_end_action_buttons) and ('enable_end_action_button_2' not in include_end_action_buttons) and ('enable_end_action_button_3' in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input end_action_button_1 | |
- action: "{{ action_button_3 }}" | |
title: !input end_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input end_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' in include_end_action_buttons) and ('enable_end_action_button_2' not in include_end_action_buttons) and ('enable_end_action_button_3' not in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_1 }}" | |
title: !input end_action_button_1 | |
- action: "{{ action_button_stop }}" | |
title: !input end_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' not in include_end_action_buttons) and ('enable_end_action_button_2' in include_end_action_buttons) and ('enable_end_action_button_3' in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_2 }}" | |
title: !input end_action_button_2 | |
- action: "{{ action_button_3 }}" | |
title: !input end_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input end_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' not in include_end_action_buttons) and ('enable_end_action_button_2' in include_end_action_buttons) and ('enable_end_action_button_3' not in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_2 }}" | |
title: !input end_action_button_2 | |
- action: "{{ action_button_stop }}" | |
title: !input end_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' not in include_end_action_buttons) and ('enable_end_action_button_2' not in include_end_action_buttons) and ('enable_end_action_button_3' in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
actions: | |
- action: "{{ action_button_3 }}" | |
title: !input end_action_button_3 | |
- action: "{{ action_button_stop }}" | |
title: !input end_action_button_stop | |
- alias: "Check the selected notification action buttons" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' not in include_end_action_buttons) and ('enable_end_action_button_2' not in include_end_action_buttons) and ('enable_end_action_button_3' not in include_end_action_buttons) }}" | |
sequence: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_title | |
message: !input end_message | |
data: | |
sticky: "true" | |
- choose: | |
- alias: "Check if any start action buttons are enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ ('enable_end_action_button_1' in include_end_action_buttons) or ('enable_end_action_button_2' in include_end_action_buttons) or ('enable_end_action_button_3' in include_end_action_buttons) }}" | |
sequence: | |
- alias: "Wait for a response from the action button" | |
wait_for_trigger: | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_1 }}" | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_2 }}" | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_3 }}" | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_button_stop }}" | |
timeout: !input end_time_delay | |
- choose: | |
- alias: "Check if confirmation message is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_end_action_button_confirmation' in include_end_action_button_confirmation }}" | |
sequence: | |
- if: | |
- alias: "Confirmation from the actions buttons" | |
condition: template | |
value_template: "{{ wait.trigger.idx is defined }}" | |
then: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_action_button_confirmation_title | |
message: !input end_action_button_confirmation_message | |
- alias: "Perform the action button selected action" | |
choose: | |
- conditions: "{{ action_button_1 in wait.trigger.event.data.action }}" | |
sequence: !input end_action_1 | |
- conditions: "{{ action_button_2 in wait.trigger.event.data.action }}" | |
sequence: !input end_action_2 | |
- conditions: "{{ action_button_3 in wait.trigger.event.data.action }}" | |
sequence: !input end_action_3 | |
- conditions: "{{ action_button_stop in wait.trigger.event.data.action }}" | |
sequence: | |
- stop: "Stop the automation" | |
else: | |
- alias: Send a notification to each device | |
repeat: | |
for_each: !input end_notify_device | |
sequence: | |
- service: "notify.mobile_app_{{ device_attr(repeat.item, 'name') | slugify }}" | |
data: | |
title: !input end_action_button_confirmation_title | |
message: !input end_time_delay_confirmation_message | |
- alias: "Check if confirmation message is disabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'disable_end_action_button_confirmation' in include_end_action_button_confirmation }}" | |
sequence: | |
- if: | |
- alias: "Perform the action button selected action" | |
condition: template | |
value_template: "{{ wait.trigger.idx is defined }}" | |
then: | |
- alias: "Perform the action" | |
choose: | |
- conditions: "{{ action_button_1 in wait.trigger.event.data.action }}" | |
sequence: !input end_action_1 | |
- conditions: "{{ action_button_2 in wait.trigger.event.data.action }}" | |
sequence: !input end_action_2 | |
- conditions: "{{ action_button_3 in wait.trigger.event.data.action }}" | |
sequence: !input end_action_3 | |
- conditions: "{{ action_button_stop in wait.trigger.event.data.action }}" | |
sequence: | |
- stop: "Stop the automation" | |
- choose: | |
- alias: "Check if auto action 1 is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_end_action_1' in include_end_auto_actions }}" | |
sequence: !input end_action_1 | |
- choose: | |
- alias: "Check if auto action 2 is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_end_action_2' in include_end_auto_actions }}" | |
sequence: !input end_action_2 | |
- choose: | |
- alias: "Check if auto action 3 is enabled" | |
conditions: | |
- condition: template | |
value_template: "{{ 'enable_end_action_3' in include_end_auto_actions }}" | |
sequence: !input end_action_3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment