One node-red to another (different rpi's)

I have one RPi with a hardware buttons wired up to it that I would like to speak to another RPi with an output (controlling a HW relay) - both running node-red obviously.

How do I send a message from the one rpi to the other? They are on the same network.

M

I think using MQTT would be your best bet/solution as it's quick and easy to set-up.

1 Like

I will have a play with that - thanks.

Btw, the Rpi's are not on a internet accessible network. (dont know if that makes a difference to the solution).

That shouldn't matter - in fact it's safer.

Have a look at installing Mosquitto (MQTT broker) on both RPi, then you could use the MQTT In and Out nodes to transfer data between the Pi(es).

I think you should find a number of articles on the forum about what you are trying to do.

Thanks again. So I need a broker on both pi's I take it?

No, you do not need a broker on both Pis.

You can pick one of your Pis to run the broker, and connect to it from all of the Pis (including itself).

1 Like

Awesome. It works.

1 Like

Just for reference, you could have used raw TCP, websocket or http nodes as well. All would work but undoubtedly, MQTT gives you a much more resilient solution without having to do the donkey work yourself.