# Connect two Node Red (Raspberry) together

**URL:** <https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370>\
**Category:** General\
**Created:** [29 January 2023 18:12 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370 "2023-01-29T18:12:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [29 January 2023 18:12 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370/1 "2023-01-29T18:12:45Z")

</div>

Hi there,

I got two raspberry pi and one needs information from the other.

What's the best way to connect them to each other. Ah, both are in the same network.

What is the most stable connection ... Mqtt? Webhook? Something I don't know?

Just to let you know about my project: I have one raspberry pi with node red which control and shows me the most information my house can show me. In this case I check my photovoltaic overpower and the second raspberry controls by pwm signal an heating system inside the water tank. So I'm able to set the exact watt of overpower into my hot water tank. To control this heater I use a Kemo M240. It works perfekt for my 1500W heater.

Thx in advance.  
Felix

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [29 January 2023 18:33 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370/2 "2023-01-29T18:33:13Z")

</div>

If both are in the same network then any method you choose should be stable.  
I would recommend MQTT.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [29 January 2023 18:33 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370/3 "2023-01-29T18:33:43Z")

</div>

Mqtt is probably a popular choice in the forum.  
It's easy to setup, low overhead and very reliable.

Edit \> Snap! @ghayne

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [29 January 2023 18:36 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370/4 "2023-01-29T18:36:01Z")

</div>

> [@Paul-Reed](#):
>
> Edit \> Snap! @ghayne

🙂 "Great Minds"

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [29 January 2023 19:27 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370/5 "2023-01-29T19:27:45Z")

</div>

@Flixm although not the question that you asked, but have you considered building in a 'watchdog' in RP 2 to ensure that if RP 1 crashes/goes off-line/etc, then RP 2 will stop the Kemo instead of continuing to act on the most recent received instruction.  
I used a very basic solution by using a trigger node (in RP 2), which passed through the incoming messages, then waited for 2 minutes. If a further msg was not received in that time, then the trigger sends a 'OFF' command.

![watchdog](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/8/8891ae284e9f73e2556b44cadf991a331b0b697a.jpeg)

---

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [29 January 2023 21:16 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370/6 "2023-01-29T21:16:35Z")

</div>

@Paul-Reed  
Of course I'll do a fallback secured.  
I'll do different solutions to stop heating if anything goes wrong.  
First a separate temperature switch, then a relay hat that's the main switch for the Kemo and at least a watchdog to check that the signal is present.  
And also I do a signal pulldown after 5 second with no new signal.

But thanks for your hint 😉

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 February 2023 21:17 UTC](https://discourse.nodered.org/t/connect-two-node-red-raspberry-together/74370/7 "2023-02-12T21:17:11Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
