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

A debug output. I felt that the Flow you had beyond that timer was "complete" . Your "sunset" and beyond was not where your question lay. My "yes/no" simulates all of your flow from "sunset" on.

1 Like

@april.brandt Now that I've had more time to explore your original (vs focusing on simplification) I kind of like it better. :slight_smile:

1 Like

OMGOSH ... I'm thrilled about that. Thanks @csteele
:grin:

I know this is probably irrelevant, but there is a better boolean logic node. I used to use the one you're using, but am changing to these, as you can define the topic and payloads to be whatever you wish, and remove all the function nodes that you have sitting before the Ultimate Boolean Node (to set true/false).

This is a good example showing flexibility, that compares three things:

  • message.payload
  • global node
  • flows node >

It really cuts down the number of nodes, because you can use msg.payload.value and the hubitat device name as message topic.

image

2 Likes

That looks cool - will check it out. thx!

2 Likes

It just keeps getting better, doesn't it? And again .. 8 hours before I can node red.

1 Like

So using bool-gate, i was able to cut out 8 change nodes!!
From this:
image
to this:

4 Likes

It certainly is more readable.

It's clearer that "Cans" is a 'blocking' state. "off" means the Motion Sensors prevail. "Cans = on" means 'ignore the Motion Sensors'. If the Motion Sensors prevail, then ANY motion results in True and the 30 second timer starts. If the timer concludes, before motion concludes, an output of "True" occurs:

Screen Shot 2020-06-18 at 8.56.13 AM

If motion ends before the timer, then the timer is stopped.

Going back to the original Flow, the output of True would go into the Sunset to Sunrise/Mode check and the Lights would do as shown, but that means that once they come on, after sunset + Nite mode they would stay on until Sunrise.

Sunrise false seems like the only way to get the lights off nodes to fire.

Actually, I added it in because the flow that turns the lights on and off seems a bit flaky and was missing the sunrise + 60 turn off command. So if the time is between sunrise + 60 and Sunset -60 and the light didn't turn off with the regular flow, it's a backup. I need to address that other flow as well, but this covers the misses for now. I don't really expect it to fire all that often. But I did confirm that it works. It's just a strange way of doing it.

Would you be willing to explain how you condensed all of that into your gate?

Sure thing!
Previously i had 4 change nodes to check if either 1 of us were present ("OR"), or if both were away ("AND") . like such
image
With the new gate -
I could specify the 2 "OR" into 1


And the other "AND" into 1

So the 4 change nodes, and 2 boolean nodes into this
image

Same applies for the quiet time switches.
The "XOR" checks if either is ON (but is false if both are ON)
"AND" checks if both are on (but is false if only 1 is on)
The other "AND" checks if both are off
Again, "true restriction' is ticked

Here is the flow, if you want to import and play

[{"id":"7a75a4f2.88bc2c","type":"hubitat mode-setter","z":"dad19d67.dbd38","name":"Quiet","server":"26c9a23e.36f4ce","modeId":"161","x":1130,"y":340,"wires":[[]]},{"id":"4d870d1e.b688e4","type":"hubitat mode-setter","z":"dad19d67.dbd38","name":"Asleep","server":"26c9a23e.36f4ce","modeId":"132","x":1130,"y":400,"wires":[[]]},{"id":"f97d2038.f2a84","type":"hubitat mode-setter","z":"dad19d67.dbd38","name":"Home","server":"26c9a23e.36f4ce","modeId":"130","x":1130,"y":460,"wires":[[]]},{"id":"75059a8b.12cce4","type":"hubitat mode-setter","z":"dad19d67.dbd38","name":"Away","server":"26c9a23e.36f4ce","modeId":"131","x":1130,"y":520,"wires":[[]]},{"id":"68b9e6be.778578","type":"mqtt in","z":"dad19d67.dbd38","name":"mqtt: presence/Adam","topic":"presence/Adam","qos":"0","datatype":"auto","broker":"db0e212c.8ecc","x":140,"y":400,"wires":[["2341033c.44d74c","9e62f728.753ed8"]]},{"id":"5ad5ab85.4ccd44","type":"mqtt in","z":"dad19d67.dbd38","name":"mqtt: presence/Trina","topic":"presence/Trina","qos":"0","datatype":"auto","broker":"db0e212c.8ecc","x":150,"y":460,"wires":[["2341033c.44d74c","9e62f728.753ed8"]]},{"id":"8ec91cd.72f2ee","type":"hubitat device","z":"dad19d67.dbd38","name":"Adam Quiet Mode","server":"26c9a23e.36f4ce","deviceId":"417","attribute":"switch","sendEvent":true,"x":670,"y":360,"wires":[["e0e61be3.eb0a38","c9e2bfeb.a1d23","b141eb13.98e718"]]},{"id":"48fd9519.601d0c","type":"hubitat device","z":"dad19d67.dbd38","name":"Trina Quiet Mode","server":"26c9a23e.36f4ce","deviceId":"802","attribute":"switch","sendEvent":true,"x":670,"y":420,"wires":[["e0e61be3.eb0a38","c9e2bfeb.a1d23","b141eb13.98e718"]]},{"id":"2341033c.44d74c","type":"or-gate","z":"dad19d67.dbd38","name":"Either True","rules":[{"t":"eq","v":"true","vt":"str","propertyType":"msg","property":"payload","topic":"presence/Adam"},{"t":"eq","v":"true","vt":"str","propertyType":"msg","property":"payload","topic":"presence/Trina"}],"outputTopic":"","gateType":"or","emitOnlyIfTrue":true,"x":410,"y":400,"wires":[["8ec91cd.72f2ee","48fd9519.601d0c"]]},{"id":"9e62f728.753ed8","type":"and-gate","z":"dad19d67.dbd38","name":"Both False","rules":[{"t":"eq","v":"false","vt":"str","propertyType":"msg","property":"payload","topic":"presence/Adam"},{"t":"eq","v":"false","vt":"str","propertyType":"msg","property":"payload","topic":"presence/Trina"}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":true,"x":410,"y":460,"wires":[["75059a8b.12cce4"]]},{"id":"c9e2bfeb.a1d23","type":"and-gate","z":"dad19d67.dbd38","name":"both on","rules":[{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload.value","topic":"Adam Quiet Mode"},{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload.value","topic":"Trina Quiet Mode"}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":true,"x":940,"y":400,"wires":[["4d870d1e.b688e4"]]},{"id":"e0e61be3.eb0a38","type":"or-gate","z":"dad19d67.dbd38","name":"either on","rules":[{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload.value","topic":"Adam Quiet Mode"},{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload.value","topic":"Trina Quiet Mode"}],"outputTopic":"","gateType":"xor","emitOnlyIfTrue":true,"x":940,"y":340,"wires":[["7a75a4f2.88bc2c"]]},{"id":"b141eb13.98e718","type":"and-gate","z":"dad19d67.dbd38","name":"both off","rules":[{"t":"eq","v":"off","vt":"str","propertyType":"msg","property":"payload.value","topic":"Adam Quiet Mode"},{"t":"eq","v":"off","vt":"str","propertyType":"msg","property":"payload.value","topic":"Trina Quiet Mode"}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":true,"x":940,"y":460,"wires":[["f97d2038.f2a84"]]},{"id":"26c9a23e.36f4ce","type":"hubitat config","z":"","name":"Hubitat","usetls":false,"host":"192.168.1.202","port":"80","appId":"545","nodeRedServer":"http://192.168.1.18:1880","webhookPath":"/hubitat/webhook","autoRefresh":true},{"id":"db0e212c.8ecc","type":"mqtt-broker","z":"","name":"Mosquitto","broker":"192.168.1.13","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Hope this makes sense!!

4 Likes

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