OR Gate accept only ON Message

Is it possible to only pass through the "On" message with an OR gate and if both inputs are set to Off, then only the "Off" message
I'm making a URL call for my wallbox
Depending on the electricity price or the time, this should be switched on
but as soon as one of the two input nodes (Bigtimer and Poll State) sends Off, the Off is also passed through and the wallbox is deactivated again

[{"id":"7e8a93d03dbe219f","type":"tab","label":"wallbox","disabled":false,"info":"","env":[]},{"id":"0f45193de9e091df","type":"http request","z":"7e8a93d03dbe219f","name":"laden aktiviert","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.10.78/setStatus?active=true","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":680,"y":180,"wires":[[]]},{"id":"ac2149a6cb7ac543","type":"http request","z":"7e8a93d03dbe219f","name":"laden deaktiviert","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.10.78/setStatus?active=false","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":680,"y":300,"wires":[[]]},{"id":"ea2caec15091778e","type":"switch","z":"7e8a93d03dbe219f","name":"Steuerung","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":450,"y":240,"wires":[["0f45193de9e091df"],["ac2149a6cb7ac543"]]},{"id":"0f49cfcc82cc4b3c","type":"bigtimer","z":"7e8a93d03dbe219f","outtopic":"","outpayload1":"on","outpayload2":"off","name":"wallbox","comment":"","lat":"0","lon":"0","starttime":"0","endtime":"1020","starttime2":"0","endtime2":"0","startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","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":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"","month12":"","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":"","xmonth7":"","xday8":"","xmonth8":"","xday9":"","xmonth9":"","xday10":"","xmonth10":"","xday11":"","xmonth11":"","xday12":"","xmonth12":"","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":100,"y":180,"wires":[["62e7d4a0ea8a479f"],[],[]]},{"id":"62e7d4a0ea8a479f","type":"or-gate","z":"7e8a93d03dbe219f","name":"","rules":[{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload","topic":""},{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload","topic":"tibber-preis"}],"outputTopic":"","gateType":"or","emitOnlyIfTrue":false,"x":280,"y":240,"wires":[["ea2caec15091778e","5417a3e888eef624"]]},{"id":"f90535f0480cea92","type":"poll-state","z":"7e8a93d03dbe219f","name":"tibber preis \"CHEAP\"","server":"63bce175.9acd","version":3,"exposeAsEntityConfig":"","updateInterval":"2","updateIntervalType":"num","updateIntervalUnits":"minutes","outputInitially":true,"outputOnChanged":true,"entityId":"input_boolean.tibber_price_cheap_switch","stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputs":1,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"tibber-preis","valueType":"str"}],"x":140,"y":320,"wires":[["62e7d4a0ea8a479f"]]},{"id":"5417a3e888eef624","type":"debug","z":"7e8a93d03dbe219f","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":440,"y":300,"wires":[]},{"id":"63bce175.9acd","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"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","enableGlobalContextStore":true}]

as soon as one of the two input nodes sends Off, the Off is also passed through and the wallbox is deactivated again

I'm struggling to interpret your question.
Are you saying that you want the output to be "on" only if bigtimer is "on" AND wallbox is "on"?

no, sorry.
i want this:
on + off = on
off + on = on
on + on = on
off + off = off

but i want only the ON message at the output
and OFF Message only if both Input are OFF

Not sure about OR gate as i tend to use standard nodes if possible.

Using a join and switch it is possible.
e.g.

[{"id":"e92d8c98aea278b2","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"wallbox","payload":"On","payloadType":"str","x":240,"y":7360,"wires":[["c63efe7c8b810e40"]]},{"id":"c63efe7c8b810e40","type":"join","z":"d1395164b4eec73e","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":7440,"wires":[["516afb978b28dd21"]]},{"id":"c4a2359946173064","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"wallbox","payload":"Off","payloadType":"str","x":240,"y":7400,"wires":[["c63efe7c8b810e40"]]},{"id":"dae4e6b20e799f7f","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tiber","payload":"On","payloadType":"str","x":230,"y":7480,"wires":[["c63efe7c8b810e40"]]},{"id":"e3f7f1c0726cb103","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tiber","payload":"Off","payloadType":"str","x":240,"y":7520,"wires":[["c63efe7c8b810e40"]]},{"id":"516afb978b28dd21","type":"switch","z":"d1395164b4eec73e","name":"","property":"\"On\" in [$$.payload.*]","propertyType":"jsonata","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":7440,"wires":[["d64c58be1ee3d668"],["3ff609928996bb10"]]},{"id":"d64c58be1ee3d668","type":"debug","z":"d1395164b4eec73e","name":"at least 1 on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":7400,"wires":[]},{"id":"3ff609928996bb10","type":"debug","z":"d1395164b4eec73e","name":"all off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":7460,"wires":[]}]

Any on, true wire output.
All off false wire output.

Well that is indeed the description of an OR gate.
If the logic gate node does not work according to that table you must have it setup wrongly?
(I don't use logic gate nodes, Bigtimer or Poll State)

thanks.
could you help me to find the Error, please.
I see your Flow will work.
But not mine if i use you Node´s :frowning:

[{"id":"7e8a93d03dbe219f","type":"tab","label":"wallbox","disabled":false,"info":"","env":[]},{"id":"0f45193de9e091df","type":"http request","z":"7e8a93d03dbe219f","name":"laden aktiviert","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.10.78/setStatus?active=true","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":680,"y":180,"wires":[[]]},{"id":"ac2149a6cb7ac543","type":"http request","z":"7e8a93d03dbe219f","name":"laden deaktiviert","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.10.78/setStatus?active=false","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":680,"y":300,"wires":[[]]},{"id":"ea2caec15091778e","type":"switch","z":"7e8a93d03dbe219f","name":"Steuerung","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":370,"y":720,"wires":[[],[]]},{"id":"0f49cfcc82cc4b3c","type":"bigtimer","z":"7e8a93d03dbe219f","outtopic":"timer","outpayload1":"on","outpayload2":"off","name":"wallbox","comment":"","lat":"0","lon":"0","starttime":"0","endtime":"480","starttime2":"0","endtime2":"0","startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","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":"","month7":"","day8":"","month8":"","day9":"","month9":"","day10":"","month10":"","day11":"","month11":"","day12":"","month12":"","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":"","xmonth7":"","xday8":"","xmonth8":"","xday9":"","xmonth9":"","xday10":"","xmonth10":"","xday11":"","xmonth11":"","xday12":"","xmonth12":"","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":100,"y":180,"wires":[["2686edc6b21175fd"],[],[]]},{"id":"f90535f0480cea92","type":"poll-state","z":"7e8a93d03dbe219f","name":"tibber preis \"CHEAP\"","server":"63bce175.9acd","version":3,"exposeAsEntityConfig":"","updateInterval":"2","updateIntervalType":"num","updateIntervalUnits":"minutes","outputInitially":true,"outputOnChanged":true,"entityId":"input_boolean.tibber_price_cheap_switch","stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputs":1,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"tibber-preis","valueType":"str"}],"x":140,"y":320,"wires":[["2686edc6b21175fd"]]},{"id":"5417a3e888eef624","type":"debug","z":"7e8a93d03dbe219f","name":"laden aktiviert","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":100,"wires":[]},{"id":"59cd599cf73f3c81","type":"switch","z":"7e8a93d03dbe219f","name":"","property":"\"On\" in [$$.payload.*]","propertyType":"jsonata","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":240,"wires":[["0f45193de9e091df","5417a3e888eef624"],["ac2149a6cb7ac543","fbf6022f5618dee1"]]},{"id":"2686edc6b21175fd","type":"join","z":"7e8a93d03dbe219f","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":310,"y":240,"wires":[["59cd599cf73f3c81"]]},{"id":"fbf6022f5618dee1","type":"debug","z":"7e8a93d03dbe219f","name":"laden deaktiviert","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":600,"y":400,"wires":[]},{"id":"63bce175.9acd","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"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","enableGlobalContextStore":true}]

Looking at your debug output your values are on/off.
So the switch node needs to have a on not On
"on" in [$$.payload.*]

[edit] If all you require is a payload on or off, you could use a change node instead of a switch.
e.g.

[{"id":"e92d8c98aea278b2","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"wallbox","payload":"on","payloadType":"str","x":240,"y":7360,"wires":[["0d6dfbc566f3ef7c"]]},{"id":"0d6dfbc566f3ef7c","type":"join","z":"d1395164b4eec73e","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":410,"y":7440,"wires":[["6a261aea3e5ecb7a"]]},{"id":"c4a2359946173064","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"wallbox","payload":"off","payloadType":"str","x":240,"y":7400,"wires":[["0d6dfbc566f3ef7c"]]},{"id":"dae4e6b20e799f7f","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tiber","payload":"on","payloadType":"str","x":230,"y":7480,"wires":[["0d6dfbc566f3ef7c"]]},{"id":"e3f7f1c0726cb103","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"tiber","payload":"off","payloadType":"str","x":230,"y":7520,"wires":[["0d6dfbc566f3ef7c"]]},{"id":"6a261aea3e5ecb7a","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"on\" in [$$.payload.*] ? \"on\" : \"off\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":7440,"wires":[["ceb63280650f9c02"]]},{"id":"ceb63280650f9c02","type":"debug","z":"d1395164b4eec73e","name":"debug 2489","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":7380,"wires":[]}]
1 Like

Thanks man.
it´s working now :slight_smile:

Hi,

"on" in [$$.payload.*] ? "on" : "off"

I wonder if you could explain what this means, it looks interesting, but I have no idea what it does and how ?

Thanks

"on" - string

$$.payload -
$$ - means base context, i.e msg (can be omitted)
payload - the object we want to work with, coming from the join node.

.* - return all values of the object as an array, ie ["on","off"]

[ ] - this is placed around the returned array, so if a single value is returned in JSONata it is a singleton not an array, this basically forces an array to be return.

So "on" in [array] checks if there is a value "on" in the array, this will return true or false.

Finally the ? : is a conditional ternary operator, if true ( ? ) return "on", if false ( : ) return "off".

2 Likes

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