-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathairco script.txt
147 lines (147 loc) · 5.08 KB
/
airco script.txt
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
alias: "Airco - Action an AC with params "
variables:
ac_name: none
ac_mode: "off"
ac_temp: 20
ac_suffix: none
ac_pwsave: "off"
sequence:
- if:
- condition: template
value_template: "{{ (ac_name != 'none') and (states(ac_name) != ac_mode) }}"
then:
- service: climate.set_hvac_mode
data:
hvac_mode: "{{ ac_mode }}"
target:
entity_id: "{{ ac_name }}"
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.allow_airco_start_stop
- if:
- condition: template
value_template: >-
{{ (ac_name != 'none') and (ac_suffix != 'none') and (ac_mode !=
'off') }}
then:
- if:
- condition: template
value_template: >-
{{ state_attr(ac_name, 'temperature') | float(0) != ac_temp |
float(0) }}
then:
- service: climate.set_temperature
data:
temperature: "{{ ac_temp }}"
target:
entity_id: "{{ ac_name }}"
- if:
- condition: template
value_template: |
{{ is_state('input_boolean.home_occupation','on') and
((now().hour >= 21) or (now().hour < 9)) }}
then:
- if:
- condition: template
value_template: |
{{ state_attr(ac_name, 'fan_mode') != 'Low' }}
then:
- service: climate.set_fan_mode
data:
fan_mode: Low
target:
entity_id: "{{ ac_name }}"
- if:
- condition: template
value_template: "{{ is_state('input_boolean.ac_sleep_'+ac_suffix,'off') }}"
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: "{{ 'input_boolean.ac_sleep_' + ac_suffix }}"
- if:
- condition: template
value_template: >-
{{ state_attr(ac_name, 'swing_mode') != 'Fixed in the upmost
position' }}
then:
- service: climate.set_swing_mode
data:
swing_mode: Fixed in the upmost position
target:
entity_id: "{{ ac_name }}"
else:
- if:
- condition: template
value_template: |
{{ (ac_mode != 'dry') and
(ac_pwsave != 'on') and
(state_attr(ac_name, 'fan_mode') != 'Auto') }}
then:
- service: climate.set_fan_mode
data:
fan_mode: Auto
target:
entity_id: "{{ ac_name }}"
- if:
- condition: template
value_template: "{{ is_state('input_boolean.ac_sleep_'+ac_suffix,'on') }}"
then:
- service: input_boolean.turn_off
data: {}
target:
entity_id: "{{ 'input_boolean.ac_sleep_' + ac_suffix }}"
- if:
- condition: template
value_template: >-
{{ state_attr(ac_name, 'swing_mode') != 'Swing in full range'
}}
then:
- service: climate.set_swing_mode
data:
swing_mode: Swing in full range
target:
entity_id: "{{ ac_name }}"
- if:
- condition: template
value_template: >
{{ is_state('input_boolean.home_occupation','off') and
is_state('input_boolean.ac_health_'+ac_suffix,'on')}}
then:
- service: input_boolean.turn_off
data: {}
target:
entity_id: "{{ 'input_boolean.ac_health_' + ac_suffix }}"
- if:
- condition: template
value_template: >
{{ is_state('input_boolean.home_occupation','on') and
is_state('input_boolean.ac_health_'+ac_suffix,'off')}}
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: "{{ 'input_boolean.ac_health_' + ac_suffix }}"
- if:
- condition: template
value_template: >
{{ (states(ac_name) in ['cool', 'dry']) and
is_state('input_boolean.ac_xfan_'+ac_suffix,'off')}}
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: "{{ 'input_boolean.ac_xfan_' + ac_suffix }}"
- if:
- condition: template
value_template: >-
{{ not (is_state('input_boolean.ac_powersave_' + ac_suffix,
ac_pwsave)) }}
then:
- service: input_boolean.toggle
data: {}
target:
entity_id: "{{ 'input_boolean.ac_powersave_' + ac_suffix }}"
mode: parallel
max: 10