"simple" boolean logic (without external nodes)

Hi,

im using NodeRed for a year now and recently bought some new sensors and now im overhauling all my automations.
Then I stumbled again over some simple boolean/ logic gate issues and while I found some custom components and I can work around that by e.g. using conditional logic sometimes, it feels a bit to complicated.

So I wonder how would someone do that with just standard nodes.

[{"id":"347bc33fef92f409","type":"tab","label":"Morning routine","disabled":false,"info":"","env":[]},{"id":"03653c84e8df488c","type":"bigtimer","z":"347bc33fef92f409","outtopic":"","outpayload1":"","outpayload2":"","name":"Time from 0600 AM - 0700 AM","comment":"","lat":0,"lon":0,"starttime":"450","endtime":"450","starttime2":0,"endtime2":0,"startoff":"-10","endoff":"+10","startoff2":0,"endoff2":0,"offs":0,"outtext1":"on","outtext2":"off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":0,"xmonth7":0,"xday8":0,"xmonth8":0,"xday9":0,"xmonth9":0,"xday10":0,"xmonth10":0,"xday11":0,"xmonth11":0,"xday12":0,"xmonth12":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":330,"y":340,"wires":[["cfda4e8961e7681f"],[],[]]},{"id":"cbb2c8910737329c","type":"server-state-changed","z":"347bc33fef92f409","name":"Motion sensor triggered/roompresence active","server":"bea192a0.36665","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.bedroom_presence","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":290,"y":220,"wires":[["cfda4e8961e7681f"],[]]},{"id":"9ab221e3771ba30a","type":"api-call-service","z":"347bc33fef92f409","name":"Lights on","server":"bea192a0.36665","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":280,"wires":[[]]},{"id":"3bfbe8cedf168e7c","type":"comment","z":"347bc33fef92f409","name":"\"some conditional logic function\"","info":"","x":630,"y":340,"wires":[]},{"id":"3161067fa9003f28","type":"link in","z":"347bc33fef92f409","name":"link in 1","links":[],"x":685,"y":280,"wires":[["9ab221e3771ba30a"]]},{"id":"cfda4e8961e7681f","type":"link out","z":"347bc33fef92f409","name":"link out 1","mode":"link","links":[],"x":655,"y":280,"wires":[]},{"id":"f46ace14342d7d3b","type":"comment","z":"347bc33fef92f409","name":"If in the morning I trigger the motionsensor, turn on the lights.","info":"","x":620,"y":160,"wires":[]},{"id":"bea192a0.36665","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]

First of all: without bigtimer or a custom time range switch I feel a “if between time x and y” node would be rather useful in the standard HA nodes.

But mainly the other thing that gives me a hiccup is that the events:state node doesnt have an input and while I could solve this particular case with conditionally setting bigtimer node after the events:state framing this automation as a logic gate seems more intuitive to me. Especially if you were to build in more than two inputs for the “gate descision” lining the triggers up after each other will be problematic.

Or what if I had two different input.bools that im checking with an events state node and I needed both of them to trigger an automation.

Basically what would be the simplest approach in node red to do stuff like that?

why do you want a HA node when there are many nodes just for that kind of job exists? For example I find “time range switch” node extremely useful and simple.

I think that’s the strongest point of node-red. there is almost always a “contrib” node for the job and it’s extremely easy to install them. At the end HA nodes themselves are custom nodes maintained by someone else who is not part of the core node-red team.

yeah true, its great to have so many contributions but its take extra effort to find extra nodes, learn their logic and test their reliability. having a “build in” set would take all that off your shoulders. and i find that these functions are basic enough to be included by default

for the logic gate nodes its maybe a bit more complicated. i found 3 packages that all work a bit different but none of them does intuitively what id like them to do, or maybe havent spend enough time to understand them

anyway its also a bit like with excel :slight_smile: if youre want to some cool formular magic for a custom report/dashboard I feel the natural order wourld be to look first for build in excel formular before programming a macro and getting some add on