It appears that an event is fired when HA is ready, so I have a set of nodes that listens for a home_assistant_client
events, and then if the payload is services_loaded
, HA and Node-RED are ready to go. I use the nodes below and just have a switch on the payload, though I don’t do anything with the switch. It then goes to a link out and I use a link in for other nodes that need to know when HA is ready.
[{"id":"f44c410e38cbeeea","type":"switch","z":"a42ea764.b87b98","name":"State","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"connecting","vt":"str"},{"t":"eq","v":"connected","vt":"str"},{"t":"eq","v":"states_loaded","vt":"str"},{"t":"eq","v":"services_loaded","vt":"str"},{"t":"eq","v":"disconnected","vt":"str"},{"t":"eq","v":"running","vt":"str"}],"checkall":"true","repair":false,"outputs":6,"x":373,"y":798,"wires":[[],[],[],["5f38473fcb6ee383"],[],[]]},{"id":"d1e9d73ad671b600","type":"server-events","z":"a42ea764.b87b98","name":"","server":"d83da4b3.5bea38","version":2,"eventType":"home_assistant_client","exposeToHomeAssistant":false,"eventData":"","haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"}],"x":163,"y":798,"wires":[["f44c410e38cbeeea"]]},{"id":"5f38473fcb6ee383","type":"link out","z":"a42ea764.b87b98","name":"HA Ready","mode":"link","links":["062976db5a737458","16754f0e173efca7","1b2fc147088746fb","2ab41a6a39456aba","3e8003d44c9a1412","9253783814e839f3","a723366d6c7306ff","dfb0b21903ffee14","e3d3f4ee9c08816a","eeea041ba45d426e","5738416c557ce9a6","68c1f5a84e5d5beb"],"x":563,"y":798,"wires":[],"l":true},{"id":"d83da4b3.5bea38","type":"server","name":"Home Assistant","version":5,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]