Home Assistant reboot

Hello all

Trying to automate the start (wol) of my dell r720 server (and it works) then after a delay restart HAOS
I built a simple flow in node red

at time wol server delay 7 seconds restart Home assistant

in node red my flow contains a node that is to restart Home assistant. On a newly developed flow the restart operation works fine. However as HA restarts the node red node to restart HA shows an error.
if i trye to restart the flow a second time the server starts however it does not reboot

Note: HAOS is installed on a different laptop
the node red node has
name
server name : |Home assistant (i only have this server installed in node red)
action:homeassistant.restart
data: on
merge: blank
queue: do not queue messages

What am i missing
Thank you in advance

Update

I created an automation in home assistant and all works fine

However because of my mental condition i prefer using node red

In the node red flow all works fine and the dell power up and after a delay home assistant restarts, it works

however the action node in node red shows an error once HAOS is restarted.

Blockquote

the ereo is (from the debug node)

2/10/2025, 8:49:59 AMnode: Restart HAOSmsg : error

error

name: “Error”

message: string

Unrecognized error: {“type”:“result”,“success”:false,“error”:{“code”:3,“message”:“Connection lost”}}

stack: string

Error: Unrecognized error: {“type”:“result”,“success”:false,“error”:{“code”:3,“message”:“Connection lost”}} at getErrorData (/config/node_modules/node-red-contrib-home-assistant-websocket/dist/common/errors/inputErrorHandler.js:65:13) at inputErrorHandler (/config/node_modules/node-red-contrib-home-assistant-websocket/dist/common/errors/inputErrorHandler.js:73:38) at ActionController._InputOutputController_preOnInput (/config/node_modules/node-red-contrib-home-assistant-websocket/dist/common/controllers/InputOutputController.js:69:51) at processTicksAndRejections (node:internal/process/task_queues:105:5)

> Blockquote

Blockquote

Can this be fixed and how

Thank you in advance for your assitance

It is not really an error as it is expected.

Node-RED HA Nodes communicate with Home Assistant via a WebSocket. The Action node sends a message to HA to run a given action. All HA Actions now return a response, either returned data value or just to say the action has completed.

When the action is ‘homeassistant.restart’ the action restarts Home Assistant, and the first thing HA does is a clean shutdown, which terminates all WebSockets, including the one between Node-RED and HA.

Therefore, the Action node is waiting for a reply to say the action has completed, and the WebSocket connection gets cut, so the node issues an error message to say that the connection has closed (before it saw a reply).

I have found a way to get around this.

  • in Home Assistant, using the Helper, create a Button (input_button) and call it “Restart HA”
  • in Home Assistant, create a new Automation, called “Restart HA”.
    • add an Entity-State as trigger, using the ‘input_button.restart_ha’ you just created
    • add an Action ‘homeassistant.restart’

Now, when the button “Restart HA” is pressed, the automation will trigger and restart HA.

In Node-RED you can now use the Action “input_button.press” and the target “input_button.restart_ha”.

Calling this action just presses a button, which provides a return before the HA automation triggers to restart HA.

Home Assistant restarts, and no error message seen.

@Biscuit

Thank you for your quick reply.

I modified my flow to reflect your suggestions.

I restarted HAOS manually and the ran the flow …an it worked.

Thank you once again and to all happy holidays peace and good health to all