Start a process when HA starts

I’m pretty sure I have the solution in front of me, but I’m not able to see or find it. So I’d like to run some flows (processes) if HA restarts or starts. What should I use as a trigger?

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/starting-flow-after-home-assistant-restart.html

The same question is answered here: Automation triggered at restart HASS - #14 by Erisian

Thank you, maybe I coulnd’t explain my issue. I’d like to do it in Node-Red under HA, but not in HA automations.

So it seems I have to make a normal automation to trigger an event state cange in Node-ed. Is Node-Red can do it without normal HA automation?

Home Assistant has a “started” event that it fires when it starts but will go off before NR has a chance to connect to HA. So NR will never see the event.

If you want you can use my flow.

[{"id":"b46e7e0a.fef1f","type":"switch","z":"6b8efe0d.bc75e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"running","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":3640,"wires":[["8cf686db2e638512","f5d7aa28a80983e2"]]},{"id":"e486ca61ff1b4782","type":"server-events","z":"6b8efe0d.bc75e","name":"","server":"","version":1,"event_type":"home_assistant_client","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":120,"y":3640,"wires":[["b46e7e0a.fef1f"]]},{"id":"0703ecd407a5d482","type":"comment","z":"6b8efe0d.bc75e","name":"Notification on HA Restart","info":"","x":110,"y":3580,"wires":[]},{"id":"f5d7aa28a80983e2","type":"link out","z":"6b8efe0d.bc75e","name":"restart detected IN","mode":"link","links":["aa15cffc9a2818bc","c004530e1a68b695","0fa1b06a82488a0b","f3ae98820a1a978e","68df754eecf5362e"],"x":530,"y":3700,"wires":[],"l":true},{"id":"aa15cffc9a2818bc","type":"link in","z":"6b8efe0d.bc75e","name":"Restart Detected Out","links":["f5d7aa28a80983e2"],"x":695,"y":3700,"wires":[[]]}]

image

I use this as a base for several automations.
Simply connect the link in to any node you want to be triggered by a HA restart.

In my code copy I did not add the message and telegram notification, as this can simply be added with your own notification service if required

2 Likes