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

#1

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

0 Likes

#2

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

1 Like

#3

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).

0 Likes

#4

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.

0 Likes

#5

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

0 Likes

#6

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

#7

Awesome. It works.

1 Like

#8

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.

0 Likes