Skip to content

Instantly share code, notes, and snippets.

@chrisbrownie
Created April 27, 2023 07:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisbrownie/50cd0ab73a659a631f6dd6efc6aeaa1b to your computer and use it in GitHub Desktop.
Save chrisbrownie/50cd0ab73a659a631f6dd6efc6aeaa1b to your computer and use it in GitHub Desktop.
Prompt to turn the electric blanket on on a cool evening
alias: Bedroom - Electric Blanket Question 2130
description: "Prompts to turn the electric blanket on if the temperature is below 13 deg C at 2130 and I'm home."
trigger:
- platform: time
at: "21:30:00"
condition:
- condition: zone
entity_id: person.me
zone: zone.home
- condition: template
value_template: "{{ state_attr('weather.home', 'temperature') < 13 }}"
action:
- alias: Set up variables for the actions
variables:
action_on: "{{ 'ON_' ~ context.id }}"
- alias: Ask to turn on the electric blanket
service: notify.mobile_app_phone
data:
message: Cool tonight, turn on the electric blanket?
title: Cool Night Ahead
data:
actions:
- action: "{{ action_on }}"
title: Yes, turn it on
icon: sfsymbols:bed.double
- alias: Wait for a response
wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{ action_on }}"
timeout:
hours: 2
minutes: 0
seconds: 0
milliseconds: 0
continue_on_timeout: false
- alias: Perform the action
choose:
- conditions: "{{ wait.trigger.event.data.action == action_on }}"
sequence:
- service: light.turn_on
data: {}
target:
entity_id: light.electric_blanket
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment