Repository navigation
Expand file tree
/
Copy pathAutomations
More file actions
306 lines (300 loc) · 8.65 KB
/
Copy pathAutomations
File metadata and controls
306 lines (300 loc) · 8.65 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
******************************************************************************************************
Copy below automations into your HA instance.
1. Go to Settings > Automations & Scenes > "+ Create Automation" > Create new automation
2. Click the three dots top right and Choose Edit in YAML
3. Paste each automation below into the code field
4. Hit SAVE and name the automations EXACTLY as detailed on each automation's Line 1 after "alias:"
******************************************************************************************************
alias: Flux - Discharge Cutout
description: >-
Stops Flux battery discharging if the remaining SoC drops to 50% between the
hours of 16:00 and 19:00 with Flux discharging enabled
trigger:
- platform: state
entity_id:
- sensor.solax_battery_soc
from: "51"
to: "50"
condition:
- condition: time
after: "16:00:00"
before: "19:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
- condition: state
entity_id: input_boolean.flux_discharge
state: "on"
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.flux_discharge
mode: single
******************************************************************************************************
alias: Flux - Discharge Off
description: >-
Sets the Battery to Not Discharge to the grid. Both Solax discharge values
set to 16:00
trigger:
- platform: state
entity_id:
- input_boolean.flux_discharge
from: "on"
to: "off"
condition: []
action:
- parallel:
- service: number.set_value
data:
value: "16"
target:
entity_id: number.solax_timed_discharge_start_hours
- service: number.set_value
data:
value: "0"
target:
entity_id: number.solax_timed_discharge_start_minutes
- service: number.set_value
data:
value: "16"
target:
entity_id: number.solax_timed_discharge_end_hours
- service: number.set_value
data:
value: "0"
target:
entity_id: number.solax_timed_discharge_end_minutes
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: button.press
data: {}
target:
entity_id:
- button.solax_update_charge_discharge_times
mode: single
******************************************************************************************************
alias: Flux - Discharge On
description: >-
Sets the Battery to Discharge to the grid at full power between 16:00 and
19:00
trigger:
- platform: state
entity_id:
- input_boolean.flux_discharge
from: "off"
to: "on"
condition: []
action:
- parallel:
- service: number.set_value
data:
value: "16"
target:
entity_id: number.solax_timed_discharge_start_hours
- service: number.set_value
data:
value: "0"
target:
entity_id: number.solax_timed_discharge_start_minutes
- service: number.set_value
data:
value: "19"
target:
entity_id: number.solax_timed_discharge_end_hours
- service: number.set_value
data:
value: "0"
target:
entity_id: number.solax_timed_discharge_end_minutes
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: button.press
data: {}
target:
entity_id:
- button.solax_update_charge_discharge_times
mode: single
******************************************************************************************************
alias: Solar - Battery Charge Automation
description: Main automatic battery charging function
trigger:
- platform: time
at: "23:55:00"
condition: []
action:
- service: input_number.set_value
data:
value: "{{ states('sensor.solax_house_load_today') }}"
target:
entity_id: input_number.expected_consumption
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- parallel:
- service: number.set_value
data:
value: "{{ states('sensor.soc_charge_end_time_hhmm').split(':')[0] }}"
target:
entity_id: number.solax_timed_charge_end_hours
- service: number.set_value
data:
value: "{{ states('sensor.soc_charge_end_time_hhmm').split(':')[1] }}"
target:
entity_id: number.solax_timed_charge_end_minutes
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: button.press
data: {}
target:
entity_id: button.solax_update_charge_discharge_times
mode: single
******************************************************************************************************
alias: Solar - Charge Current Settings
description: >-
This Automation automatically sets the Solax Timed Charge Current to match the
user inputs of battery capacity, overdischarge soc and forcecharge soc
trigger:
- platform: state
entity_id:
- input_number.battery_capacity
- input_number.overdischarge_soc
- input_number.force_charge_soc
condition: []
action:
- service: number.set_value
data:
value: "{{ states('sensor.calculated_charge_current') }}"
target:
entity_id: number.solax_timed_charge_current
mode: single
******************************************************************************************************
alias: Solar - Expected Consumption Low State Tracker
description: >-
If the number input number 'Expected Consumption' is overtaken by the Solis
sensor 'Solax House Load Today', the value from the sensor is set to the
number input to avoid peculiarities in battery SoC forecasting.
trigger:
- platform: state
entity_id:
- sensor.solax_house_load_today
condition:
- condition: numeric_state
entity_id: sensor.solax_house_load_today
above: input_number.expected_consumption
action:
- service: input_number.set_value
data:
value: "{{ states('sensor.solax_house_load_today') }}"
target:
entity_id: input_number.expected_consumption
mode: single
******************************************************************************************************
alias: Solar - Restore Consumption Defaults
description: >-
Sets todays expected consumption and tomorrows expected consumption to 10,
Target SoC to 4.5, base load to 0.23, and boost charge to 0
trigger:
- platform: state
entity_id:
- input_button.reset_consumption_defaults
condition: []
action:
- service: input_number.set_value
data:
value: 10
target:
entity_id: input_number.expected_consumption
- service: input_number.set_value
data:
value: 10
target:
entity_id: input_number.expected_consumption_tomorrow
- service: input_number.set_value
data:
value: 4.5
target:
entity_id: input_number.target_usable_soc
- service: input_number.set_value
data:
value: 0.23
target:
entity_id:
- input_number.base_load
- service: input_number.set_value
data:
value: 0
target:
entity_id: input_number.boost_charge
- service: number.set_value
data:
value: "55"
target:
entity_id: number.solax_timed_charge_current
mode: single
******************************************************************************************************
alias: Solar - Update Times
description: >-
Manually updates Inverter Charge and Discharge Times from Solax Modbus
Integration
trigger: []
condition: []
action:
- parallel:
- service: number.set_value
data:
value: "{{ states('sensor.soc_charge_end_time_hhmm').split(':')[0] }}"
target:
entity_id: number.solax_timed_charge_end_hours
- service: number.set_value
data:
value: "{{ states('sensor.soc_charge_end_time_hhmm').split(':')[1] }}"
target:
entity_id: number.solax_timed_charge_end_minutes
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: button.press
data: {}
target:
entity_id:
- button.solax_update_charge_discharge_times
mode: single
******************************************************************************************************
alias: Solcast - API Poll Schedule
description: New API call Solcast
trigger:
- platform: time
at: "06:00:00"
- platform: time
at: "10:00:00"
- platform: time
at: "14:00:00"
- platform: time
at: "18:00:00"
- platform: time
at: "23:50:00"
condition: []
action:
- service: solcast_solar.update_forecasts
data: {}
mode: single
******************************************************************************************************