# Flow with two magnet sensors controlling if a heater is allowed to run or not

**URL:** <https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767>\
**Category:** General\
**Created:** [12 March 2022 18:07 UTC](https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767 "2022-03-12T18:07:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pimmen85](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pimmen85/32/58378_2.png) [@pimmen85](https://discourse.nodered.org/u/pimmen85)\
**Post date:** [12 March 2022 18:07 UTC](https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767/1 "2022-03-12T18:07:52Z")

</div>

i have one magnet sensor for each entry to my garage, and i have a backup heater fan, i would like to create a flow that basically does the following "when one of the doors are open a plug that controlls the heater should turn off, and when both doors are closed again i want the heater to start again"

ask more if i havent explaned enough what i want to achieve with the flow.

im still in the phase that i dont really understand what things do what in node-red.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 March 2022 18:11 UTC](https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767/2 "2022-03-12T18:11:46Z")

</div>

So where have you got to so far?

Can we assume that you understand that you need a magnetic door sensor capable of either directly feeding a signal somewhere or that you can connect via an Arduino or ESP microprocessor device?

Similarly, you need a remote controlled plug that can be controlled from Node-RED.

The rest is some fairly simple logic written as a Node-RED flow. AKA "the easy bit" 🙂

So the first task is to chose what kind of IoT standard you want to use. Zigbee is a great choice. WiFi also pretty good. Old fashioned 433MHz (or your local equivalent depending on where you are in the world) can also work. Or even wired connections. Node-RED is very good at connecting these things together.

Let us know what you think.

---

<div class="post-metadata">

**Author:** ![pimmen85](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pimmen85/32/58378_2.png) [@pimmen85](https://discourse.nodered.org/u/pimmen85)\
**Post date:** [12 March 2022 18:17 UTC](https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767/3 "2022-03-12T18:17:27Z")

</div>

sorry i always kinda forget that node red isnt ALWAYS associated with Home assistant, but in my case it is, i have every device i need in home assistant already, basically from my understanding i should be able to tell the plug "one of the doors are open, dont start the heater now" and then "activate plug and start the heater connected to it"

i just dont know what nodes to use etc.

did a test with the "events: state" node and managed to get some info to a debug node, but then im stuck basically.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 March 2022 11:39 UTC](https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767/4 "2022-03-13T11:39:23Z")

</div>

If I understand correctly you want the heater ON if both doors are closed, and OFF otherwise. If that is it then you could use [node-red-contrib-boolean-logic-ultimate](https://github.com/Supergiovane/node-red-contrib-boolean-logic-ultimate) to do the logic.

---

<div class="post-metadata">

**Author:** ![pimmen85](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pimmen85/32/58378_2.png) [@pimmen85](https://discourse.nodered.org/u/pimmen85)\
**Post date:** [13 March 2022 14:35 UTC](https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767/5 "2022-03-13T14:35:34Z")

</div>

Yes, that's basically it, I will try it out when I get to the the computer.

Thank you

---

<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 May 2022 14:36 UTC](https://discourse.nodered.org/t/flow-with-two-magnet-sensors-controlling-if-a-heater-is-allowed-to-run-or-not/59767/6 "2022-05-12T14:36:19Z")

</div>

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