Add NodeRED to Home Assistant garage controler

Hello all!
I am new to HA and I need some help.
I have RPi1 setup with NodeRED to open and close my garage doors. Now, I would like to add these controls to RPi2 where I have installed Home Assistant.
Anyone can help me understand step by step how to add remote Node-RED under HA? I was reading earlier posts here but I didn’t understand where to start from.

Node-RED always runs as an entirely separate programme to Home Assistant.

If it is run as an HASS addon, then it will be on the same machine, supervised by HA, but nevertheless quite separate.

At no point does Node-RED know anything about HA, even as an addon. However, HA exposes all sorts of things via API and WebSocket - and anything (not just Node-RED) can talk to HA.

Node-RED can manage much of a potential API/WebSocket connection between HA and NR using standard nodes, but there is a great contrib package of WebSocket nodes that setup, maintain, and use WebSocket and API calls back to HA.

If you have NR as an addon, then these nodes come included, and the necessary server configuration is ‘automatic’ as both HA and NR sit on the same machine under the same HA supervisor. You just have to install the NR companion in HA and set up the server configuration.

If you have NR running separately (same or different machine) then you need to

  1. install the WebSocket nodes yourself
  2. install the Node-RED companion integration in HA
  3. setup the HA server configuration node in Node-RED manually

Then you can use the wide range of WebSocket nodes to

  • create and update entities in HA from NR
  • create buttons and switches in HA than can trigger flows in NR
  • create nodes in NR that will read and respond to changes in HA entity states

Step By Step this is for a ‘stand alone’ Node-RED on a different machine to HA.

  • check your current version of Node-RED
  • check your current version of HA

There are version requirements of both for the current WebSocket nodes, and you may have to update prior to installation.

Then add the WebSocket nodes to Node-RED. You should be able to do this from the palette, and you can find all the details about these nodes at
https://github.com/zachowj/node-red-contrib-home-assistant-websocket?tab=readme-ov-file#node-red-contrib-home-assistant-websocket

Now you need to setup the Home Assistant server (which manages the connection in Node-RED back to HA).

The documentation is here
https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/#getting-started

just note that, when you create the configuration server node, you will need to untick the ‘Using the Home assistant Add-on’, and enter the base URL and long life token.

Check the ‘Enable Global context store’ too - this means that a saved copy of the HA state will be available in a Global context variable, a good way to check that it is all working.

At that point the server should now connect to HA.

I hope this answers your question!