-
Notifications
You must be signed in to change notification settings - Fork 6
/
Door_WidowsControlledHeating.yml
76 lines (74 loc) · 2.07 KB
/
Door_WidowsControlledHeating.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#
# Home Assistant Automation Blueprint
#
# Automatically turns of heating if door or Windows is open for a specific amount of time
#
# Modified by Johan Schelin, Mar. 2021
#
blueprint:
name: Door/Window controlled heating
description: Turns off heating when opening window and turn on with delay
domain: automation
input:
heating_target:
name: Heater
selector:
entity:
domain: climate
window_entity:
name: Door/Window Sensor
description: 'The window or door sensor that triggers the automation.'
selector:
entity: {}
window_closed_wait:
name: Wait time open
description: Time to leave the heating on after window or door is opened.
default: 300
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
window_opened_wait:
name: Wait time closed
description: Time to leave the heating off after window or door is closed.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
# If window or door is closed within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
variables:
heating_target: !input 'heating_target'
heating_temperature: '{{ state_attr(heating_target, ''temperature'') }}'
trigger:
platform: state
entity_id: !input 'window_entity'
from: 'off'
to: 'on'
action:
# timer waiting for door or window being open for X seconds (not turning the heater off if just walking through a door)
- delay: !input window_opened_wait
- service: climate.set_hvac_mode
entity_id: !input 'heating_target'
data:
hvac_mode: 'off'
- wait_for_trigger:
platform: state
entity_id: !input 'window_entity'
from: 'on'
to: 'off'
# timer is reset is door is closed within this delay
- delay: !input window_closed_wait
- service: climate.set_hvac_mode
entity_id: !input 'heating_target'
data:
hvac_mode: heat
- service: climate.set_temperature
entity_id: !input 'heating_target'
data:
temperature: '{{heating_temperature}}'