|
script: |
|
turn_down_hvac: |
|
alias: HVACW - Turn down HVAC |
|
description: Turn down a HVAC as a result of an open window |
|
fields: |
|
hvac: |
|
name: HVAC thermostat |
|
description: The climate component which controls the HVAC in the room/area |
|
selector: |
|
entity: |
|
domain: climate |
|
snapshot_scene: |
|
name: Snapshot scene |
|
description: A scene entity which holds the state of the HVAC prior to it being changed |
|
selector: |
|
entity: |
|
domain: scene |
|
override_boolean: |
|
name: Override indicator (optional) |
|
description: An input_boolean where to store whether the HVAC temperature was overridden while the door/window was open |
|
selector: |
|
entity: |
|
domain: input_boolean |
|
default: "a.b" |
|
variables: |
|
hvac: !input hvac |
|
snapshot_scene: !input snapshot_scene |
|
override_boolean: !input override_boolean |
|
sequence: |
|
- service: scene.create |
|
data: |
|
scene_id: "{{snapshot_scene[6:]}}" # exclude 'scene.' |
|
snapshot_entities: "{{hvac}}" |
|
##### THIS IS THE PART THAT YOU SHOULD MODIFY ###### |
|
- service: climate.set_preset_mode |
|
data: |
|
preset_mode: eco |
|
target: |
|
entity_id: "{{hvac}}" |
|
##### /THIS IS THE PART THAT YOU SHOULD MODIFY ###### |
|
mode: restart |
|
|
|
turn_hvac_back_up: |
|
alias: HVACW - Turn HVAC back up |
|
description: Turn a HVAC back up as a result of a window being closed |
|
fields: |
|
hvac: |
|
name: HVAC thermostat |
|
description: The climate component which controls the HVAC in the room/area |
|
selector: |
|
entity: |
|
domain: climate |
|
snapshot_scene: |
|
name: Snapshot scene |
|
description: A scene entity which holds the state of the HVAC prior to it being changed |
|
selector: |
|
entity: |
|
domain: scene |
|
override_boolean: |
|
name: Override indicator (optional) |
|
description: An input_boolean where to store whether the HVAC temperature was overridden while the door/window was open |
|
selector: |
|
entity: |
|
domain: input_boolean |
|
default: "a.b" |
|
variables: |
|
hvac: !input hvac |
|
snapshot_scene: !input snapshot_scene |
|
override_boolean: !input override_boolean |
|
sequence: |
|
- service: scene.turn_on |
|
target: |
|
entity_id: "{{snapshot_scene}}" |
|
mode: restart |
|
|
|
turn_hvac_back_up_override: |
|
alias: HVACW - Turn HVAC back up user override |
|
description: Turn a HVAC back up as a result of a user overriding the automation |
|
fields: |
|
hvac: |
|
name: HVAC thermostat |
|
description: The climate component which controls the HVAC in the room/area |
|
selector: |
|
entity: |
|
domain: climate |
|
snapshot_scene: |
|
name: Snapshot scene |
|
description: A scene entity which holds the state of the HVAC prior to it being changed |
|
selector: |
|
entity: |
|
domain: scene |
|
override_boolean: |
|
name: Override indicator (optional) |
|
description: An input_boolean where to store whether the HVAC temperature was overridden while the door/window was open |
|
selector: |
|
entity: |
|
domain: input_boolean |
|
default: "a.b" |
|
variables: |
|
hvac: !input hvac |
|
snapshot_scene: !input snapshot_scene |
|
override_boolean: !input override_boolean |
|
sequence: |
|
- if: |
|
- condition: template |
|
value_template: "{{ states[override_boolean].state is defined }}" |
|
then: |
|
- service: input_boolean.turn_on |
|
target: |
|
entity_id: "{{override_boolean}}" |
|
- service: notify.family |
|
data: |
|
message: clear_notification |
|
data: |
|
tag: "open_window_{{hvac|replace('.', '_')}}" |
|
- service: script.turn_hvac_back_up |
|
data: |
|
hvac: "{{hvac}}" |
|
snapshot_scene: "{{snapshot_scene}}" |
|
override_boolean: "{{override_boolean}}" |
|
mode: restart |
|
|
|
notify_hvac_modified: |
|
alias: HVACW - Notify that the HVAC was modified |
|
description: Notify that a HVAC was turned down due to an open window/door and ask for confirmation to turn it back up or that it was turned up due to a window closing |
|
fields: |
|
window_name: |
|
name: Window name |
|
description: The name of the open window which triggered the notification |
|
selector: |
|
text: |
|
allow_user_override: |
|
name: Allow user override |
|
description: Show action in notification which allows user override |
|
default: false |
|
selector: |
|
boolean: |
|
action_script: |
|
name: Action script |
|
description: The script to call if the user taps the action in the notification |
|
selector: |
|
entity: |
|
domain: |
|
- script |
|
hvac: |
|
name: HVAC thermostat |
|
description: The climate component which controls the HVAC in the room/area |
|
selector: |
|
entity: |
|
domain: climate |
|
snapshot_scene: |
|
name: Snapshot scene |
|
description: A scene entity which holds the state of the HVAC prior to it being changed |
|
selector: |
|
entity: |
|
domain: scene |
|
override_boolean: |
|
name: Override indicator (optional) |
|
description: An input_boolean where to store whether the HVAC temperature was overridden while the door/window was open. This is passed to the relevant script |
|
selector: |
|
entity: |
|
domain: input_boolean |
|
default: "a.b" |
|
variables: |
|
window_name: !input window_name |
|
allow_user_override: !input allow_user_override |
|
action_script: !input action_script |
|
hvac: !input hvac |
|
snapshot_scene: !input snapshot_scene |
|
override_boolean: !input override_boolean |
|
sequence: |
|
- alias: "Set up variables" |
|
variables: |
|
action_id: "{{ 'HVAC_MODIFIED_' ~ context.id }}" |
|
##### THIS IS THE PART YOU SHOULD MODIFY ##### |
|
- if: |
|
- alias: "Nobody is home" |
|
condition: state |
|
entity_id: zone.home |
|
state: "0" |
|
then: |
|
- service: script.send_hvac_notification |
|
data: |
|
notify_service: "notify.family" |
|
notification_message: "The {{ state_attr(hvac, 'friendly_name')|lower }} was turned down because the {{ window_name }} is open. Would you like to turn it back up?" |
|
notification_tag: "open_window_{{hvac|replace('.', '_')}}" |
|
action_needed: "{{allow_user_override}}}" |
|
action_id: "{{action_id}}" |
|
action_title: "Turn it back up" |
|
# the URL should be used if you have room-based dashboards |
|
action_url: > |
|
/lovelace-rooms/{{ hvac|regex_replace('climate\.([a-z_]+)_floor_heating', '\\1') }} |
|
else: |
|
- if: |
|
- alias: "Send messages to those who are home" |
|
condition: state |
|
entity_id: person.your_name |
|
state: home |
|
then: |
|
- service: script.send_hvac_notification |
|
data: |
|
notify_service: "notify.your_name" |
|
notification_message: "The {{ state_attr(hvac, 'friendly_name')|lower }} was turned down because the {{ window_name }} is open. Would you like to turn it back up?" |
|
notification_tag: "open_window_{{hvac|replace('.', '_')}}" |
|
action_needed: "{{allow_user_override}}" |
|
action_id: "{{action_id}}" |
|
action_title: "Turn it back up" |
|
# the URL should be used if you have room-based dashboards |
|
action_url: > |
|
/lovelace-rooms/{{ hvac|regex_replace('climate\.([a-z_]+)_floor_heating', '\\1') }} |
|
##### /THIS IS THE PART YOU SHOULD MODIFY ##### |
|
- if: |
|
- condition: template |
|
value_template: "{{allow_user_override}}" |
|
then: |
|
- alias: "Awaiting response" |
|
wait_for_trigger: |
|
- platform: event |
|
event_type: mobile_app_notification_action |
|
event_data: |
|
action: "{{ action_id }}" |
|
timeout: "06:00:00" |
|
- if: |
|
- condition: template |
|
value_template: "{{ False if (wait.trigger is None) else (wait.trigger.event.data.action == action_id) }}" |
|
then: |
|
- service: "{{action_script}}" |
|
data: |
|
hvac: "{{hvac}}" |
|
snapshot_scene: "{{snapshot_scene}}" |
|
override_boolean: "{{override_boolean}}" |
|
mode: restart |
|
send_hvac_notification: |
|
alias: HVACW - Send HVAC modification notification |
|
description: actually send the notification |
|
fields: |
|
notify_service: |
|
name: Notify service |
|
description: The notify service to use (i.e. who should be getting the notification) |
|
selector: |
|
entity: |
|
domain: notify |
|
notification_message: |
|
name: Notification message |
|
description: The text of the notification message |
|
selector: |
|
text: |
|
notification_tag: |
|
name: Notification tag |
|
description: The tag used for the companion app notification |
|
selector: |
|
text: |
|
action_needed: |
|
name: Include action |
|
description: Whether an action button should be attached to the notification |
|
selector: |
|
boolean: |
|
action_id: |
|
name: Action ID |
|
description: The action ID that should be sent as an event if the user clicks the action |
|
action_title: |
|
name: User action title |
|
description: The button label that will be on the notification, which the user can click to trigger an action |
|
action_url: |
|
name: Action URL |
|
description: The URL to go to when the user clicks the action |
|
variables: |
|
notify_service: !input notify_service |
|
notification_message: !input notification_message |
|
notification_tag: !input notification_tag |
|
action_needed: !input action_needed |
|
action_id: !input action_id |
|
action_title: !input action_title |
|
action_url: !input action_url |
|
sequence: |
|
- if: |
|
- condition: template |
|
value_template: "{{action_needed}}" |
|
then: |
|
- service: "{{notify_service}}" |
|
data: |
|
message: "{{notification_message}}" |
|
data: |
|
tag: "{{notification_tag}}" |
|
actions: |
|
- action: "{{action_id}}" |
|
title: "{{action_title}}" |
|
sticky: true |
|
url: "{{action_url}}" |
|
clickAction: "{{action_url}}" |
|
else: |
|
- service: "{{notify_service}}" |
|
data: |
|
message: "{{notification_message}}" |
|
data: |
|
tag: "{{notification_tag}}" |
|
sticky: true |
|
url: "{{action_url}}" |
|
clickAction: "{{action_url}}" |
|
|
|
clear_hvac_modified_notifications: |
|
alias: HVACW - Clear HVAC notifications |
|
description: Optionally clear notifications about energy saving on mobile terminals |
|
fields: |
|
notification_tag: |
|
name: Notification tag |
|
description: The tag used for the companion app notification |
|
selector: |
|
text: |
|
variables: |
|
notification_tag: !input notification_tag |
|
sequence: |
|
##### THIS IS THE PART YOU SHOULD MODIFY ##### |
|
- service: "notify.family" |
|
data: |
|
message: clear_notification |
|
data: |
|
tag: "{{notification_tag}}" |
|
##### /THIS IS THE PART YOU SHOULD MODIFY ##### |