# Safety node via function node —need help!

**URL:** <https://discourse.nodered.org/t/safety-node-via-function-node-need-help/79182>\
**Category:** General\
**Tags:** function-node\
**Created:** [13 June 2023 20:05 UTC](https://discourse.nodered.org/t/safety-node-via-function-node-need-help/79182 "2023-06-13T20:05:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruuuppi](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@ruuuppi](https://discourse.nodered.org/u/ruuuppi)\
**Post date:** [13 June 2023 20:05 UTC](https://discourse.nodered.org/t/safety-node-via-function-node-need-help/79182/1 "2023-06-13T20:05:35Z")

</div>

Hello everyone,

i‘m new in programming.

For my project i would need a function with an „if/or“ rule.

i have 2 hysteresis nodes from my two warm- supply.  
so if one or both of them sends „on“, „1“, „true“.. i need to put the pump on.  
only when both are off, 0 or false the pump should be of.

right now if the pump is on & the the lower hysteresis reaches the lower point the pump shuts off & my solar-panel is overheating..

i hope that somebody could help me,  
thanks in advance!  
-ruppi

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c45ce52b942cf3c2467e57754a52f8156c1a71f0.jpeg)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [14 June 2023 11:41 UTC](https://discourse.nodered.org/t/safety-node-via-function-node-need-help/79182/2 "2023-06-14T11:41:02Z")

</div>

Hi @ruuuppi - welcome to the forums.

This is a quick drive by visit.

I would use something like a boolean logic node (in OR operation)  
Here is my fav.

> **[node-red-contrib-boolean-logic-ultimate](https://flows.nodered.org/node/node-red-contrib-boolean-logic-ultimate)**
>
> A set of Node-RED enhanced boolean logic and utility nodes, flow interruption, blinker, invert, filter, toggle etc.., with persistent values after reboot. Compatible also with Homeassistant values.

It will return `true` i.e turn on pump, if at least one of your inputs values are `true`, else it will return `false`

 ![Screenshot 2023-06-14 at 12.40.11](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d5a672455ad69634726fcb26a203e5c791494d18.png)

Export

```auto
[{"id":"83aed8db904ad634","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"45c4d08af0e5f693","type":"BooleanLogicUltimate","z":"83aed8db904ad634","name":"","payloadPropName":"payload","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","restrictinputevaluation":false,"delayEvaluation":0,"x":415,"y":215,"wires":[[],["038f7b9567c2f923"],[]]},{"id":"d15a5d27d62ea02a","type":"inject","z":"83aed8db904ad634","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Hysteresis1","payload":"true","payloadType":"bool","x":230,"y":135,"wires":[["45c4d08af0e5f693"]]},{"id":"e4d33954d05569a7","type":"inject","z":"83aed8db904ad634","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Hysteresis1","payload":"false","payloadType":"bool","x":230,"y":180,"wires":[["45c4d08af0e5f693"]]},{"id":"32084b8614fdc479","type":"inject","z":"83aed8db904ad634","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Hysteresis2","payload":"true","payloadType":"bool","x":220,"y":280,"wires":[["45c4d08af0e5f693"]]},{"id":"eb4af54ebdf4f705","type":"inject","z":"83aed8db904ad634","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Hysteresis2","payload":"false","payloadType":"bool","x":220,"y":325,"wires":[["45c4d08af0e5f693"]]},{"id":"038f7b9567c2f923","type":"debug","z":"83aed8db904ad634","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":215,"wires":[]},{"id":"3f05eab285965fd3","type":"comment","z":"83aed8db904ad634","name":"Turn on pump?","info":"","x":790,"y":175,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![ruuuppi](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@ruuuppi](https://discourse.nodered.org/u/ruuuppi)\
**Post date:** [15 June 2023 07:29 UTC](https://discourse.nodered.org/t/safety-node-via-function-node-need-help/79182/3 "2023-06-15T07:29:31Z")

</div>

Hello @marcus-j-davies,

thanks for your help - it works perfectly now!

Best regards!  
-ruppi

---

<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:** [29 June 2023 07:30 UTC](https://discourse.nodered.org/t/safety-node-via-function-node-need-help/79182/4 "2023-06-29T07:30:01Z")

</div>

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