Help with a flow - Node Red - understanding boolean and ultimate boolean node

OMGOSH! I got it to work! And it's pushy! I love pushy!

This flow just 'replaces' the normal message content with a True or a False. Four Times :slight_smile:

Then the Node that interprets boolean ( true / false ) AKA Ultimate Boolean, has the individual ways to interpret the states. AND, OR, or XOR. Let's ignore XOR for this discussion, it's an amazing tool, but that's for the next Lesson :smiley:

You tell Ultimate how many topics to 'remember' and then with each new message, it interprets them as ALL TRUE = AND is True. Any ONE (or more) is false = AND is False.

For the OR output, it's probably as you'd imagine.. ANY one (or more) True, that output is True. only when ALL are False does the OR output send a False.

Does that help?

1 Like

The devices you're choosing all send different payload values... Locks send Locked and Unlocked, but Contact Sensors send Open or Closed, and Switches send On or Off. But they have to be compared, that is what you need.. so translating them into a common 'language' (in this case, two words: true and false, makes comparison quite easy.

Some would argue that a Function is "better" but the point is this is what Boolean does. Not a Lesson on "better" :smiley:

Ok yes. I get it. Let me wrap my head around this for a bit.

XOR

Lesson two. LOL

XOR is Exclusive OR. Look carefully at OR and then again at AND.. they care about ALL.

AND is for ALL True.

OR could be seen as ALL False.

XOR is used for 'different'

ALL True or ALL False = false.. but if they are anything else.. aka 'different' the you get a TRUE.

If you have the chance, yes, look at 'old school state tables' because it makes it clear, black and white, what will occur. You don't even need to understand why... just label the columns and find the row that gives you what you want. :smiley:

2 Likes

So If I add a timer and stop timer into this flow?

Just to be clear, it's an observation, NOT a critique. :slight_smile:

No that's a good idea so it gets initialized. I should probably do that with a lot of my flows.

1 Like

That makes sense, looking for different, never thought about it that way for more than 2 inputs.

1 Like

Add them after the 'is true' after the Boolean before the lock.

1 Like

Ok so I was upstairs making dinner and opened the door. The lock locked even though the door was open. Now the value is evaluating as false, stopping the timer. I'm doing something wrong. I want all conditions to evaluate true (closed/locked/off) before the lock will lock. So that should be and correct?

[EDIT]
should the is true be payload or payload.value?

All those "Is Locked - Is Closed - Is On" nodes needed payload.value to work with the Virtual devices. YMMV. :slight_smile:

Hmm .. I'm not getting this to work. Going to take a break from it and re-read this thread.

@csteele @napalmcsr @aaiyar
So I've been able to get this to act the way I want now, but I can't get the timer to stop if condition evaluates false.

[{"id":"29ef5908.8ec026","type":"switch","z":"22732ab6.5ad6f6","name":"is Locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"locked","vt":"str"},{"t":"eq","v":"unlocked","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":500,"y":320,"wires":[["493e4be9.aa0b64"],["b562882d.859aa8"]]},{"id":"493e4be9.aa0b64","type":"change","z":"22732ab6.5ad6f6","name":"set True","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":320,"wires":[["4c3f455f.01c5bc"]]},{"id":"aa267d96.44978","type":"hubitat device","z":"22732ab6.5ad6f6","name":"Garage Lock","server":"791ed0f2.6643c","deviceId":"404","attribute":"lock","sendEvent":true,"x":330,"y":320,"wires":[["29ef5908.8ec026"]]},{"id":"4c3f455f.01c5bc","type":"BooleanLogicUltimate","z":"22732ab6.5ad6f6","name":"","filtertrue":"both","persist":true,"sInitializeWith":"false","triggertopic":"trigger","outputtriggeredby":"all","inputCount":"4","topic":"result","x":940,"y":380,"wires":[["e023f7c4.88c708"],[],[]]},{"id":"1a69cbf9.c69684","type":"hubitat device","z":"22732ab6.5ad6f6","name":"Overhead Door","server":"791ed0f2.6643c","deviceId":"217","attribute":"contact","sendEvent":true,"x":320,"y":380,"wires":[["c05d4268.27a2"]]},{"id":"14143c85.711dd3","type":"hubitat device","z":"22732ab6.5ad6f6","name":"Garage Door","server":"791ed0f2.6643c","deviceId":"216","attribute":"contact","sendEvent":true,"x":330,"y":440,"wires":[["a790b049.9ba32"]]},{"id":"875e7f12.bfc02","type":"hubitat device","z":"22732ab6.5ad6f6","name":"Foyer Lock","server":"791ed0f2.6643c","deviceId":"2677","attribute":"lock","sendEvent":false,"x":1470,"y":360,"wires":[["b7750b4b.56ffe8"]]},{"id":"46f172f.45cb58c","type":"hubitat command","z":"22732ab6.5ad6f6","name":"Lock Foyer Lock","server":"791ed0f2.6643c","deviceId":"2677","command":"lock","commandArgs":"","x":1800,"y":360,"wires":[[]]},{"id":"a790b049.9ba32","type":"switch","z":"22732ab6.5ad6f6","name":"is Closed","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"closed","vt":"str"},{"t":"eq","v":"open","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":500,"y":440,"wires":[["493e4be9.aa0b64"],["b562882d.859aa8"]]},{"id":"b562882d.859aa8","type":"change","z":"22732ab6.5ad6f6","name":"set False","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":440,"wires":[["4c3f455f.01c5bc"]]},{"id":"b7750b4b.56ffe8","type":"switch","z":"22732ab6.5ad6f6","name":"not locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"unlocked","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1630,"y":360,"wires":[["46f172f.45cb58c"]]},{"id":"e023f7c4.88c708","type":"switch","z":"22732ab6.5ad6f6","name":"is True","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1110,"y":360,"wires":[["22796db8.54c5b2"],[]]},{"id":"a2ece607.69d1b8","type":"hubitat device","z":"22732ab6.5ad6f6","name":"Foyer Lock","server":"791ed0f2.6643c","deviceId":"2677","attribute":"lock","sendEvent":true,"x":330,"y":260,"wires":[["27ca6ad2.933136"]]},{"id":"951d9a00.77f5b8","type":"inject","z":"22732ab6.5ad6f6","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":120,"y":360,"wires":[["aa267d96.44978","1a69cbf9.c69684","14143c85.711dd3","a2ece607.69d1b8"]]},{"id":"27ca6ad2.933136","type":"switch","z":"22732ab6.5ad6f6","name":"is Locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"unlocked","vt":"str"},{"t":"eq","v":"locked","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":500,"y":260,"wires":[["493e4be9.aa0b64"],["b562882d.859aa8"]]},{"id":"c05d4268.27a2","type":"switch","z":"22732ab6.5ad6f6","name":"is Closed","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"closed","vt":"str"},{"t":"eq","v":"open","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":500,"y":380,"wires":[["493e4be9.aa0b64"],["b562882d.859aa8"]]},{"id":"22796db8.54c5b2","type":"stoptimer","z":"22732ab6.5ad6f6","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1290,"y":360,"wires":[["875e7f12.bfc02"],[]]},{"id":"791ed0f2.6643c","type":"hubitat config","z":"","name":"Hubitat","usetls":false,"host":"192.168.86.32","port":"80","appId":"3451","nodeRedServer":"http://192.168.86.51:1880","webhookPath":"/hubitat/webhook_","autoRefresh":true}]

[{"id":"3ffea259.d9c9be","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"33ffb967.a0b466","type":"switch","z":"3ffea259.d9c9be","name":"is Locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"locked","vt":"str"},{"t":"eq","v":"unlocked","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":240,"wires":[["674218d7.1ec9a8"],["e6b309df.b48338"]]},{"id":"674218d7.1ec9a8","type":"change","z":"3ffea259.d9c9be","name":"set True","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":240,"wires":[["ead0d97e.8d3258"]]},{"id":"32aeeacc.f41386","type":"hubitat device","z":"3ffea259.d9c9be","name":"Garage Lock","server":"bf6b016f.f902","deviceId":"404","attribute":"lock","sendEvent":true,"x":290,"y":240,"wires":[["33ffb967.a0b466"]]},{"id":"ead0d97e.8d3258","type":"BooleanLogicUltimate","z":"3ffea259.d9c9be","name":"","filtertrue":"both","persist":true,"sInitializeWith":"false","triggertopic":"trigger","outputtriggeredby":"all","inputCount":"4","topic":"result","x":900,"y":300,"wires":[["a56ab8a3.1c0158"],[],[]]},{"id":"3e61c9cd.00cb26","type":"hubitat device","z":"3ffea259.d9c9be","name":"Overhead Door","server":"bf6b016f.f902","deviceId":"217","attribute":"contact","sendEvent":true,"x":280,"y":300,"wires":[["91fc258a.13d8b8"]]},{"id":"6474ed62.26ba14","type":"hubitat device","z":"3ffea259.d9c9be","name":"Garage Door","server":"bf6b016f.f902","deviceId":"216","attribute":"contact","sendEvent":true,"x":290,"y":360,"wires":[["4fb688c1.51c118"]]},{"id":"692e3a67.0d3974","type":"hubitat device","z":"3ffea259.d9c9be","name":"Foyer Lock","server":"bf6b016f.f902","deviceId":"2677","attribute":"lock","sendEvent":false,"x":1430,"y":280,"wires":[["12b97d78.669823"]]},{"id":"46c81e97.ded62","type":"hubitat command","z":"3ffea259.d9c9be","name":"Lock Foyer Lock","server":"bf6b016f.f902","deviceId":"2677","command":"lock","commandArgs":"","x":1760,"y":280,"wires":[[]]},{"id":"4fb688c1.51c118","type":"switch","z":"3ffea259.d9c9be","name":"is Closed","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"closed","vt":"str"},{"t":"eq","v":"open","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":360,"wires":[["674218d7.1ec9a8"],["e6b309df.b48338"]]},{"id":"e6b309df.b48338","type":"change","z":"3ffea259.d9c9be","name":"set False","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":360,"wires":[["ead0d97e.8d3258"]]},{"id":"12b97d78.669823","type":"switch","z":"3ffea259.d9c9be","name":"not locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"unlocked","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1590,"y":280,"wires":[["46c81e97.ded62"]]},{"id":"a56ab8a3.1c0158","type":"switch","z":"3ffea259.d9c9be","name":"is True","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1070,"y":280,"wires":[["8bb96215.ca776"],["236e0a83.0a66d6"]]},{"id":"fe9dd292.9dfb3","type":"hubitat device","z":"3ffea259.d9c9be","name":"Foyer Lock","server":"bf6b016f.f902","deviceId":"2677","attribute":"lock","sendEvent":true,"x":290,"y":180,"wires":[["10ee1f58.55e661"]]},{"id":"45c0fa3d.29ba94","type":"inject","z":"3ffea259.d9c9be","name":"","topic":"","payload":"Started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":80,"y":280,"wires":[["32aeeacc.f41386","3e61c9cd.00cb26","6474ed62.26ba14","fe9dd292.9dfb3"]]},{"id":"10ee1f58.55e661","type":"switch","z":"3ffea259.d9c9be","name":"is Locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"unlocked","vt":"str"},{"t":"eq","v":"locked","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":180,"wires":[["674218d7.1ec9a8"],["e6b309df.b48338"]]},{"id":"91fc258a.13d8b8","type":"switch","z":"3ffea259.d9c9be","name":"is Closed","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"closed","vt":"str"},{"t":"eq","v":"open","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":300,"wires":[["674218d7.1ec9a8"],["e6b309df.b48338"]]},{"id":"236e0a83.0a66d6","type":"change","z":"3ffea259.d9c9be","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":340,"wires":[[]]},{"id":"8bb96215.ca776","type":"stoptimer","z":"3ffea259.d9c9be","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1250,"y":280,"wires":[["692e3a67.0d3974"],[]]},{"id":"bf6b016f.f902","type":"hubitat config","z":"","name":"Hubitat","usetls":false,"host":"192.168.86.32","port":"80","appId":"3451","nodeRedServer":"http://192.168.86.51:1880","webhookPath":"/hubitat/webhook_","autoRefresh":true}]

1 Like

attach the output of the stop to the input of stoptimer
I don't have stoptimer, I have stoptimer 2 so I couldn't attach it.

1 Like

Op yep that did it. I tried that before, but something else must've been wrong. it's working as intended. You guys are my rocks. thank you!

2 Likes

I hate it when I can't check more than one person for a solution.
but you guys have my
:heart:
for sure.

2 Likes

@april.brandt @napalmcsr @csteele

Between the three of you, you’ve also proved the one thing I’d really like Rule Machine to have - export/edit/import automations.

4 Likes

Well ... we can dream right?
:rofl:

2 Likes