Skip to content

Commit 44611ba

Browse files
committed
HA Restart Automation
1 parent 74d17e7 commit 44611ba

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,35 @@ Once downloaded AppDaemon should see the app and attempt to load it using the de
272272
16:53:23 WARNING: read_only = True Source: system default. Not in YAML.
273273
```
274274
275+
<h3>13. Add an Automation to Restart AppDAemon when HA Restarts (Optional)</h3>
276+
277+
Restarts between Home Assistant and Add-Ons are not synchronised so it is helpful to set up an Automation to restart AppDAemon if HA is restarted. An example is shown below and included in this repo as `ha_restart_automation.yaml`. The `wait_template` section ensures that key integrations (in this case Solcast and Solax) have numeric values before AppDaemon is started.
278+
279+
alias: Restart AppDaemon on HA Restart
280+
description: ""
281+
trigger:
282+
- event: start
283+
platform: homeassistant
284+
condition: []
285+
action:
286+
- service: hassio.addon_stop
287+
data:
288+
addon: a0d7b954_appdaemon
289+
- delay:
290+
hours: 0
291+
minutes: 1
292+
seconds: 0
293+
milliseconds: 0
294+
- wait_template: >
295+
{{(states('sensor.solcast_pv_forecast_forecast_today')| float(-1)>0) and
296+
(states('sensor.solis_battery_soc')| float(-1)>0)}}
297+
continue_on_timeout: true
298+
- service: hassio.addon_start
299+
data:
300+
addon: a0d7b954_appdaemon
301+
mode: single
302+
303+
275304
<h2>Configuration</h2>
276305
277306
If you have the Solcast, Octopus and Solax integrations set up as specified above, there should be minimal configuration required.

ha_restart_automation.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
alias: Restart AppDaemon on HA Restart
2+
description: ""
3+
trigger:
4+
- event: start
5+
platform: homeassistant
6+
condition: []
7+
action:
8+
- service: hassio.addon_stop
9+
data:
10+
addon: a0d7b954_appdaemon
11+
- delay:
12+
hours: 0
13+
minutes: 1
14+
seconds: 0
15+
milliseconds: 0
16+
- wait_template: >
17+
{{(states('sensor.solcast_pv_forecast_forecast_today')| float(-1)>0) and
18+
(states('sensor.solis_battery_soc')| float(-1)>0)}}
19+
continue_on_timeout: true
20+
- service: hassio.addon_start
21+
data:
22+
addon: a0d7b954_appdaemon
23+
mode: single

0 commit comments

Comments
 (0)