NR complex if-else flows without functions

I’m playing with NR and while trying to replicate my heating control automation from HE as a NR flow I stumbled on an issue I can’t seem to find a simple solution for. Right now I have it implemented as a function with a bunch of if-else structures but for visibility I’d like to implement it with other types of nodes (eg. switch, state machine). That way it’s visible at a glance what is going on, instead of mentally going through the function code.

In pseudocode this function would look something like this:

bedroom_needs_heating = false
if (bedroom_heating_enabled === true && bedroom_current_temperature < bedroom_desired_temperature) {
  bedroom_needs_heating = true
}

living_room_needs_heating = false
if (living_room_heating_enabled === true && living_room_current_temperature < living_room_desired_temperature) {
  living_room_needs_heating = true
}

turn_central_heating_on = false
if (bedroom_needs_heating === true || living_room_needs_heating === true) { 
  turn_central_heating_on = true 
}

if (turn_central_heating_on === true && central_heating_is_on === false) {
  "Action: Turn central heating on"
} elseif (turn_central_heating_on === false && central_heating_is_on === true) {
  "Action: Turn central heating off" 
} else {
  "Action: Keep central heating as it is" 
}

I’ve made the following flow

[{"id":"a2b851f2a3b89eed","type":"switch","z":"b343ea235896572e","name":"Bedroom needs heating","property":"bedroom_temperature","propertyType":"flow","rules":[{"t":"lt","v":"bedroom_target_temperature","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1090,"y":80,"wires":[["bc18108cfed5307e"]]},{"id":"8534fbb13321eb23","type":"switch","z":"b343ea235896572e","name":"Living room needs heating","property":"living_room_temperature","propertyType":"flow","rules":[{"t":"lt","v":"living_room_target_temperature","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1080,"y":120,"wires":[["bc18108cfed5307e"]]},{"id":"de99a938321b1da3","type":"switch","z":"b343ea235896572e","name":"Bedroom heating is on","property":"bedroom_heating","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":820,"y":80,"wires":[["a2b851f2a3b89eed"]]},{"id":"b0b1285047826639","type":"switch","z":"b343ea235896572e","name":"Living room heating is on","property":"living_room_heating","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":830,"y":120,"wires":[["8534fbb13321eb23"]]},{"id":"bc18108cfed5307e","type":"switch","z":"b343ea235896572e","name":"Boiler is heating","property":"boiler_is_heating","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1520,"y":100,"wires":[["599d1ef0f906af26"],["4a7b3ac4e6823946"]]},{"id":"3234c5e3b7f508e5","type":"inject","z":"b343ea235896572e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":560,"y":140,"wires":[["de99a938321b1da3","b0b1285047826639","6cc71b3b3faa9a69","6ae4cfc9f942979a"]]},{"id":"4a7b3ac4e6823946","type":"template","z":"b343ea235896572e","name":"Turn on","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Turn on the boiler","output":"str","x":1720,"y":120,"wires":[["ab12564aadef7eff"]]},{"id":"599d1ef0f906af26","type":"template","z":"b343ea235896572e","name":"Keep on","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Keep boiler on","output":"str","x":1720,"y":80,"wires":[["ab12564aadef7eff"]]},{"id":"6cc71b3b3faa9a69","type":"switch","z":"b343ea235896572e","name":"Bedroom does not need heating","property":"bedroom_temperature","propertyType":"flow","rules":[{"t":"gte","v":"bedroom_target_temperature","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":220,"wires":[["8ecb544880f3487b"]]},{"id":"8b93ff8395637abd","type":"switch","z":"b343ea235896572e","name":"Living room does not need heating","property":"living_room_temperature","propertyType":"flow","rules":[{"t":"gte","v":"living_room_target_temperature","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1280,"y":220,"wires":[["4cabf7eda2166015"]]},{"id":"6ae4cfc9f942979a","type":"switch","z":"b343ea235896572e","name":"Bedroom heating is off","property":"bedroom_heating","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":820,"y":180,"wires":[["8ecb544880f3487b"]]},{"id":"e330b1bebec07cfd","type":"switch","z":"b343ea235896572e","name":"Living room heating is off","property":"living_room_heating","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1250,"y":180,"wires":[["4cabf7eda2166015"]]},{"id":"4cabf7eda2166015","type":"switch","z":"b343ea235896572e","name":"Boiler is heating","property":"boiler_is_heating","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1520,"y":180,"wires":[["4a695a896ab207d8"],["192091e371207666"]]},{"id":"8ecb544880f3487b","type":"function","z":"b343ea235896572e","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1060,"y":180,"wires":[["e330b1bebec07cfd","8b93ff8395637abd"]]},{"id":"4a695a896ab207d8","type":"template","z":"b343ea235896572e","name":"Turn off","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Keep boiler off","output":"str","x":1720,"y":160,"wires":[["ab12564aadef7eff"]]},{"id":"ab12564aadef7eff","type":"debug","z":"b343ea235896572e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1910,"y":140,"wires":[]},{"id":"192091e371207666","type":"template","z":"b343ea235896572e","name":"Keep off","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Keep boiler on","output":"str","x":1720,"y":200,"wires":[["ab12564aadef7eff"]]}]

The issue is that the trigger will generate multiple messages for what should be only one. As an example, if both rooms need heating and the central heating boiler is off, it will trigger the “on” command twice.

Is there a better way to do this? I saw the state machine node but I can’t figure out how to use it and I couldn’t find any tutorial.

Not able to help but looking at this I’m thinking, “yikes, no way I’m going to get my head round NR if this is what is needed to be coded”. :exploding_head:

Can I have webCoRE please?

No this is not at all what is needed. Here let me ease you mind with somthing more, beginner level.

FYI - I suck at coding, NR is visual, it’s super easy, but also very powerful. I can only use function nodes people make for me, so sometime my ‘sequences’ are “over complicated” by some messaures, but having everything layed out where my eye can follow the blue dot from beginning to end make it “easy” for me to understand what’s happening.

Also know NR allows us to share ‘sequenses’ (rules). I was able to c/p his code into my NR and instanly see what he crated (for good or bad). I’ll be making a post for NR terms/newb FAQ shortly. If you can do webCORE you can easily handle Node-Red which is much easier IMO.

2 Likes

OK thanks.
Sorry to highjack the thread @avataru

3 Likes

Yes, lol. Sorry, first thing I see is you have no trigger except the timestamp, that means your just checking every so often? I guess that is ok, but I like to use temp sensors as triggers. If temp changes the sequence will run, evaluate vriables and adjust accordingly. I try to avoid using timestamps as a trigger since the device will be forced to do it even if there is no pretinant changes (think summer)

Another issue is the divergance/convergance in your path, here

That is likely creating the ‘double trigger’ event. You’ll need to find a way to make that one continuous check or make it so only 1 is ever true.

Also your function node is empty - again I suck at code, so i avoid these without asstance.

Not being good at coding I do not fully understand your objective. If you can write out what you are trying to do and then work from there I find it helps.

Here is a sample I use for turning fans on/off when the fire is going/out. We heat mainly via wood stove/fans, so it’s the cloest I can think of. There is also a basic comparision function someone helped me create long ago.

Function compares values and returns true/false

sequence code

[{"id":"8f361896.b10618","type":"group","z":"1d668173.a62c4f","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["9cc68dd1.2beb8","321fa73f.91e068","269d8355.d6734c","53455e90.3b9bf","c30c77c6.826bd8","92dacaf.93c2f38","5fd81f70.52518","35119cc8.92f734","a7d0659a.8bd648","c3fbeea2.b0c17","5aa94e7d.ab457","c26dec0e.8ef9c","253745a2.135bca","b8c5279b.c0a528","5e8311a4.06aa5","423cf87a.906248","ee4c5d90.136b6","e7af1697.d81bd8","6c5ed572.029b2c","cde942a2.cfec3"],"x":24,"y":39,"w":2002,"h":322},{"id":"9cc68dd1.2beb8","type":"hubitat command","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"Upstairs Hallway Fan Off","server":"b1088aaa.95e9e8","deviceId":"462","command":"off","commandArgs":"","x":1570,"y":320,"wires":[[]]},{"id":"321fa73f.91e068","type":"hubitat device","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"Family Room Temp","server":"c0da6dea.8576a","deviceId":"756","attribute":"temperature","sendEvent":true,"x":196.00006866455078,"y":164.0000114440918,"wires":[["92dacaf.93c2f38"]]},{"id":"269d8355.d6734c","type":"switch","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"true/false","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":900,"y":180,"wires":[["b8c5279b.c0a528"],["5e8311a4.06aa5"]]},{"id":"53455e90.3b9bf","type":"comment","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"🌡️ - Winter Fan On/Off when Family Room > Desk +5","info":"","x":250,"y":100,"wires":[]},{"id":"c30c77c6.826bd8","type":"function","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"Family Room  > Desk +5?","func":"var msg = {};\n\nvar familyroomTemp = flow.get(\"familyroomTemp\")\nvar deskmotionTemp = flow.get(\"deskmotionTemp\");\n\nif (!familyroomTemp || !deskmotionTemp) {\n    return;\n}\n\nif (familyroomTemp > (deskmotionTemp +5)) {\n    msg.payload = true;\n    return msg;\n}\n\nif (familyroomTemp < (deskmotionTemp +3)) {\n    msg.payload = false;\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":650,"y":180,"wires":[["cde942a2.cfec3"]]},{"id":"92dacaf.93c2f38","type":"change","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"set familyroomTemp","rules":[{"t":"set","p":"familyroomTemp","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":406.0000686645508,"y":164.0000114440918,"wires":[["c30c77c6.826bd8"]]},{"id":"5fd81f70.52518","type":"hubitat device","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"Office Motion Temp","server":"c0da6dea.8576a","deviceId":"2251","attribute":"temperature","sendEvent":true,"x":196.00006866455078,"y":219.0000147819519,"wires":[["35119cc8.92f734"]]},{"id":"35119cc8.92f734","type":"change","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"set deskmotionTemp","rules":[{"t":"set","p":"deskmotionTemp","pt":"flow","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":407.0000686645508,"y":219.0000114440918,"wires":[["c30c77c6.826bd8"]]},{"id":"a7d0659a.8bd648","type":"hubitat command","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"Family Room Fan On","server":"e03140c5.bed32","deviceId":"1435","command":"on","commandArgs":"","x":1580,"y":120,"wires":[[]]},{"id":"c3fbeea2.b0c17","type":"hubitat command","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"Family Room Fan Off","server":"e03140c5.bed32","deviceId":"1435","command":"off","commandArgs":"","x":1580,"y":280,"wires":[[]]},{"id":"5aa94e7d.ab457","type":"switch","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"Below 70?","property":"payload.value","propertyType":"msg","rules":[{"t":"lt","v":"70","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1358.0000076293945,"y":157.00000762939453,"wires":[["a7d0659a.8bd648","423cf87a.906248"]]},{"id":"c26dec0e.8ef9c","type":"switch","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"Below 70?","property":"payload.value","propertyType":"msg","rules":[{"t":"lt","v":"70","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1359.0000114440918,"y":210.00001335144043,"wires":[["9cc68dd1.2beb8","c3fbeea2.b0c17","ee4c5d90.136b6"]]},{"id":"253745a2.135bca","type":"hubitat command","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"Upstairs Hallway Fan On","server":"b1088aaa.95e9e8","deviceId":"462","command":"on","commandArgs":"","x":1490,"y":80,"wires":[[]]},{"id":"b8c5279b.c0a528","type":"hubitat device","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"VD - NR - Average Outside Temp","server":"e03140c5.bed32","deviceId":"1480","attribute":"temperature","sendEvent":false,"x":1120,"y":140,"wires":[["5aa94e7d.ab457","253745a2.135bca"]]},{"id":"5e8311a4.06aa5","type":"hubitat device","z":"1d668173.a62c4f","g":"8f361896.b10618","deviceLabel":"","name":"VD - NR - Average Outside Temp","server":"e03140c5.bed32","deviceId":"1480","attribute":"temperature","sendEvent":false,"x":1120,"y":220,"wires":[["c26dec0e.8ef9c"]]},{"id":"423cf87a.906248","type":"change","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"Fire Going","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1570,"y":180,"wires":[["e7af1697.d81bd8"]]},{"id":"ee4c5d90.136b6","type":"change","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"Fire Out","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1560,"y":220,"wires":[["e7af1697.d81bd8"]]},{"id":"e7af1697.d81bd8","type":"change","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"set fire.On","rules":[{"t":"set","p":"fireOn","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1730,"y":200,"wires":[["6c5ed572.029b2c"]]},{"id":"6c5ed572.029b2c","type":"debug","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1910,"y":200,"wires":[]},{"id":"cde942a2.cfec3","type":"rbe","z":"1d668173.a62c4f","g":"8f361896.b10618","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":795,"y":180,"wires":[["269d8355.d6734c"]],"l":false},{"id":"b1088aaa.95e9e8","type":"hubitat config","name":"Z-WaveHub","usetls":false,"host":"10.20.1.23","port":"80","appId":"5","nodeRedServer":"http://10.13.9.28:1880","webhookPath":"/hubitat/webhook_","autoRefresh":true,"useWebsocket":false},{"id":"c0da6dea.8576a","type":"hubitat config","name":"ZigBee Hub","usetls":false,"host":"10.20.1.21","port":"80","appId":"2532","nodeRedServer":"http://10.13.9.28:1880","webhookPath":"/hubitat/webhook__","autoRefresh":true,"useWebsocket":false},{"id":"e03140c5.bed32","type":"hubitat config","name":"Apps Hub","usetls":false,"host":"10.20.1.22","port":"80","appId":"899","nodeRedServer":"http://10.13.9.28:1880","webhookPath":"/hubitat/webhook___","autoRefresh":true,"useWebsocket":false}]

Any good NR coders feel free to chime in. I love to steal good funtion nodes for future use :wink:

We’re all here to help so there are no wrong answers just diferent ways to slove similar issues.

3 Likes

What I have is a bit more complex. The idea behind NR is to use the nodes instead of coding stuff and you will usually have a trigger then an action. After that you add conditions and so on so don’t be scared :slight_smile:

2 Likes

The above is just an example and what I’m using to test and debug the actual flow. The actual trigger would be a 15 minute timer and the values themselves will come from HA as events and then stored in the flow context. Since it wasn’t relevant I didn’t include the trigger in the above JSON.

The first two rows are supposed to emulate an if clause that has two “and” logic groups and an “or” between them. In the function this would result in a single output but I’m not sure how to do that in any simple way. I guess I could use a join or a trigger node but there has to be a “nicer” way.

As for the empty function, it’s only there so I don’t have to make a spiderweb of connection between the 4 nodes. It looks a bit better like that. That part of the flow is supposed to represent an if with two “and” statements and each statement is a group or “or” statements. Kinda like the reverse of the previous one.

In words the logic should be something like:

If any room has heating enabled and needs heating and the central heating boiler is off, turn it on, otherwise do nothing.

However if no room has heating enabled or doesn’t need heating, do nothing unless the boiler is on in which case turn it off.

I hope that makes more sense. Using a function feels like cheating and I want to do it without one. :slight_smile:

How does the system know if heating is enabled?

How would the system know if it needsheating or not?

Reminds me of something like… each motion ‘route’ checks the other motion device so both must be “inactive” for the sequence to continue or it fails.

I use a similar set of checks to open and close the house when the cars come and go

1 Like

Each thermostat can be turned on or off like a switch. Heating is needed if the thermostat is on and the room temperature is less than the desired room temperature. All these values are stored in the flow context so the flow can access them any time.

I might end-up using a trigger on each end branch so only one message passes through.

I wish we could use switch to check for multiple conditions at the same time for a single output. For example something like this:

image

I don’t have access to a computer where I’m at so can’t give a specific example,but to avoid double triggering, make sure the payload that triggers the change to turn on/off the heating is a boolean and send that through a filter (RBE) node to make sure it only forwards the message when change. Apply it for all topics (there’s a checkbox). Sorry for the advice without an easy to follow example.

In short treat each temperature check as a separate thing, send them through the filter node described above and then trigger on/off based on that knowing you only get ONE change through.

Maybe @april.brandt can provide one?

Edit: Thought about it and I was wrong, a filter node isn’t enough. There’s a boolean logic node but that one I wouldn’t recommend for something as important as heating. I’ll be back with a better answer, ignore the filter one by itself for this.

EDIT2: Talked with April and asked her to make a good example with the filter combined in.

1 Like

The first answer. There are CORE nodes. BUT, they won’t be included in beta… yet. Right now, they are much too powerful to put them out there. You can really break things with them. But we will introduce a “tamed” version in the coming weeks. I do have the perfect example flow for you… I think.
:eyes:

You can write all the functions you want, but you’re not supposed to do heavy coding in NR. I know! It’s crazy!

Ok … so set a global for the trigger. I’m going to use my bed sensor flow.
I feel like you need to understand the logic flows first, so you should do it with the nodes and not functions. DON’T get me wrong, functions make things look pretty, but you don’t have to use them. I made a specific effort to do this flow without function nodes just to prove that the logic will still work and function just as well. (pun intended) :grin:

Bed sensor:
First, I save my triggers as globals saved to FILE
When changes happen these sensors trigger out from my globals page to various automations. Sometimes they trigger out through a link out node. Saves time and space and allows you to have only one trigger or setting to change to update your flows if you make changes. it’s a nice feature. I’ll try to write something up for them at some point.

After the global is created link it out to your flow. Here is an example of global area for master bedroom. I have a dedicated page to house all globals

So our bed presence is triggered by motion sensors placed on the under side of the bed. When they go active and the presence global is true or false, the following logic checks for change in intervals of 5-10 seconds. If the state changes from the original state, then it goes straight to the trigger and starts the next flow. if the state does not change from the original beginning state, then it times out with no change. The whole flow is super complex, but it was easy to set up as I did it in pieces and built on as I got one aspect to work, I added another thing. You can actually have flows that only do one thing, but you’ll naturally become accustomed to combining things. Doesn’t make it easier, but sure makes for really cool flows.

Global flow. This saves this global to file and not to ram. If it’s saved to file, it survives a reboot. If it’s saved to ram, it resets at reboot.

[{"id":"00863d2c2178ba0a","type":"change","z":"6eb861eeb62e543d","name":"AprilBedPresence","rules":[{"t":"change","p":"payload","pt":"msg","from":"ON","fromt":"str","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"OFF","fromt":"str","to":"false","tot":"bool"},{"t":"set","p":"aprilbedpresence","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1430,"y":2400,"wires":[["5fbdb7579f184c51"]]}]

And here is the flow that checks for presence. once it shows opposite status, it shoots right to the trigger. I left out the motion sensor trigger at the beginning. This is different from the bed sensor global. Like @TechMedX stated, “there’s more than one way to solve a problem”. I will add that “not everyone has a Markus.” So, you’re not expected to write all of these in function codes. You can definitely do it without.

[{"id":"aa5ffe8a008423d5","type":"change","z":"10577ea396123488","name":"April Motion","rules":[{"t":"set","p":"aprilmotion","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":840,"wires":[["621c50735dd357cd","551a060f7513a2b9"]]},{"id":"0375f20a2fed752c","type":"change","z":"10577ea396123488","name":"Jeff Motion","rules":[{"t":"set","p":"jeffmotion","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":740,"wires":[["ddcd8ffd178dd257","cf90e79dc11123f3"]]},{"id":"621c50735dd357cd","type":"link out","z":"10577ea396123488","name":"AprilMotion->","mode":"link","links":["76837dd1d3ed093c"],"x":655,"y":880,"wires":[]},{"id":"ddcd8ffd178dd257","type":"link out","z":"10577ea396123488","name":"JeffMotion->","mode":"link","links":["76837dd1d3ed093c"],"x":655,"y":700,"wires":[]},{"id":"cf90e79dc11123f3","type":"switch","z":"10577ea396123488","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":740,"wires":[["fb44e2d0904acfa9"]]},{"id":"fb44e2d0904acfa9","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":830,"y":740,"wires":[["0aee2f309f750217"],["58ec75f737780c40"]]},{"id":"58ec75f737780c40","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1000,"y":760,"wires":[["f4d35f218b65ce96"]]},{"id":"f4d35f218b65ce96","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1150,"y":760,"wires":[["7143b9ccb3cee25a"],["c3f328831317fd68"]]},{"id":"c3f328831317fd68","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1300,"y":760,"wires":[["00f8761f0838cd3c"]]},{"id":"00f8761f0838cd3c","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1450,"y":760,"wires":[["7143b9ccb3cee25a"],["3914a02e91f79aa9"]]},{"id":"3914a02e91f79aa9","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1600,"y":760,"wires":[["8cfa2f3e43a57c7f"]]},{"id":"8cfa2f3e43a57c7f","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1750,"y":760,"wires":[["7143b9ccb3cee25a"],["e926ab9d8e17eca5"]]},{"id":"e926ab9d8e17eca5","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1900,"y":760,"wires":[["89cfe43b676b5c9a"]]},{"id":"89cfe43b676b5c9a","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2050,"y":760,"wires":[["7143b9ccb3cee25a"],["84f0c86d9b6f6325"]]},{"id":"84f0c86d9b6f6325","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2200,"y":760,"wires":[["f06de646b719d595"]]},{"id":"f06de646b719d595","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2350,"y":760,"wires":[["7143b9ccb3cee25a"],["5546f8929a26bc63"]]},{"id":"5546f8929a26bc63","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2500,"y":760,"wires":[["16647930d065216b"]]},{"id":"16647930d065216b","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2650,"y":760,"wires":[["7143b9ccb3cee25a"],[]]},{"id":"7143b9ccb3cee25a","type":"change","z":"10577ea396123488","name":"Jeff In Bed","rules":[{"t":"set","p":"jeffinbed","pt":"global","to":"true","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2810,"y":760,"wires":[["1cfbeb46805e7dfa"]]},{"id":"0aee2f309f750217","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1000,"y":720,"wires":[["1b9d3e5020efa2b9"]]},{"id":"1b9d3e5020efa2b9","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1150,"y":720,"wires":[["e1d1339945dc75dc"],["1707fe7fa4f2c21a"]]},{"id":"e1d1339945dc75dc","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1300,"y":720,"wires":[["96a8c768be533df3"]]},{"id":"96a8c768be533df3","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1450,"y":720,"wires":[["669669b6ce932e94"],["1707fe7fa4f2c21a"]]},{"id":"669669b6ce932e94","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1600,"y":720,"wires":[["d35dd7065eb31727"]]},{"id":"d35dd7065eb31727","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1750,"y":720,"wires":[["3fc8747c12db80b1"],["1707fe7fa4f2c21a"]]},{"id":"3fc8747c12db80b1","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1900,"y":720,"wires":[["8a9b79bb95d9fe4a"]]},{"id":"8a9b79bb95d9fe4a","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2050,"y":720,"wires":[["6348466a7f1ec98c"],["1707fe7fa4f2c21a"]]},{"id":"6348466a7f1ec98c","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2200,"y":720,"wires":[["9aa58fe4e0523c76"]]},{"id":"9aa58fe4e0523c76","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2350,"y":720,"wires":[["e1ec8822dc69baf9"],["1707fe7fa4f2c21a"]]},{"id":"e1ec8822dc69baf9","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2500,"y":720,"wires":[["e07eaaca17cd5528"]]},{"id":"e07eaaca17cd5528","type":"switch","z":"10577ea396123488","name":"jeffpresence","property":"jeffbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2650,"y":720,"wires":[[],["1707fe7fa4f2c21a"]]},{"id":"1707fe7fa4f2c21a","type":"change","z":"10577ea396123488","name":"Jeff Not In Bed","rules":[{"t":"set","p":"jeffinbed","pt":"global","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2820,"y":720,"wires":[["1cfbeb46805e7dfa"]]},{"id":"1cfbeb46805e7dfa","type":"link out","z":"10577ea396123488","name":"->JeffInBed","mode":"link","links":["3f985ebf74f9f92d"],"x":2975,"y":740,"wires":[]},{"id":"6a9a29eaca98bc6d","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1000,"y":860,"wires":[["da8f6b6f6abe6410"]]},{"id":"da8f6b6f6abe6410","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1160,"y":860,"wires":[["cccdb9930f661751"],["741c5512f7edf890"]]},{"id":"741c5512f7edf890","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1320,"y":860,"wires":[["c44961028c245c7a"]]},{"id":"c44961028c245c7a","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1480,"y":860,"wires":[["cccdb9930f661751"],["dd25c40b8a471973"]]},{"id":"dd25c40b8a471973","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1640,"y":860,"wires":[["ec70366ab4515fd8"]]},{"id":"ec70366ab4515fd8","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1800,"y":860,"wires":[["cccdb9930f661751"],["def254a193ccacee"]]},{"id":"def254a193ccacee","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1960,"y":860,"wires":[["25b05a26adeceffa"]]},{"id":"25b05a26adeceffa","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2120,"y":860,"wires":[["cccdb9930f661751"],["1689a1918a46fd79"]]},{"id":"1689a1918a46fd79","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2280,"y":860,"wires":[["bcf5ae6f4eaf824e"]]},{"id":"bcf5ae6f4eaf824e","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2440,"y":860,"wires":[["cccdb9930f661751"],["256f8a9677e68a48"]]},{"id":"256f8a9677e68a48","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2600,"y":860,"wires":[["9e1a98292c1e58de"]]},{"id":"9e1a98292c1e58de","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2760,"y":860,"wires":[["cccdb9930f661751"],[]]},{"id":"cccdb9930f661751","type":"change","z":"10577ea396123488","name":"April In Bed","rules":[{"t":"set","p":"aprilinbed","pt":"global","to":"true","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2950,"y":860,"wires":[["bad1fbbdfd0b4767"]]},{"id":"041728ba822ac910","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1000,"y":820,"wires":[["504834f2aafcee08"]]},{"id":"504834f2aafcee08","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1160,"y":820,"wires":[["29406dc5983904fd"],["dc0586ccd1723db2"]]},{"id":"29406dc5983904fd","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1320,"y":820,"wires":[["622b463663ddc85a"]]},{"id":"622b463663ddc85a","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1480,"y":820,"wires":[["377f6b650f93629c"],["dc0586ccd1723db2"]]},{"id":"377f6b650f93629c","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1640,"y":820,"wires":[["c5c978fe4bb59542"]]},{"id":"c5c978fe4bb59542","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1800,"y":820,"wires":[["62dc58e6a4aed2b1"],["dc0586ccd1723db2"]]},{"id":"62dc58e6a4aed2b1","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1960,"y":820,"wires":[["c777ed2e1049df10"]]},{"id":"c777ed2e1049df10","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2120,"y":820,"wires":[["cac8449ac5d92d45"],["dc0586ccd1723db2"]]},{"id":"cac8449ac5d92d45","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2280,"y":820,"wires":[["fd497047d6806a6c"]]},{"id":"fd497047d6806a6c","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2440,"y":820,"wires":[["415b767f6fb4f6fb"],["dc0586ccd1723db2"]]},{"id":"415b767f6fb4f6fb","type":"delay","z":"10577ea396123488","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":2600,"y":820,"wires":[["d39d2d38ac643cc9"]]},{"id":"d39d2d38ac643cc9","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":2760,"y":820,"wires":[[],["dc0586ccd1723db2"]]},{"id":"dc0586ccd1723db2","type":"change","z":"10577ea396123488","name":"April Not In Bed","rules":[{"t":"set","p":"aprilinbed","pt":"global","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2940,"y":820,"wires":[["bad1fbbdfd0b4767"]]},{"id":"bad1fbbdfd0b4767","type":"link out","z":"10577ea396123488","name":"->AprilInBed","mode":"link","links":["c1c095e390459e77"],"x":3085,"y":840,"wires":[]},{"id":"551a060f7513a2b9","type":"switch","z":"10577ea396123488","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":840,"wires":[["f6e8ac2953fade20"]]},{"id":"f6e8ac2953fade20","type":"switch","z":"10577ea396123488","name":"aprilpresence","property":"aprilbedpresence","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":840,"y":840,"wires":[["041728ba822ac910"],["6a9a29eaca98bc6d"]]}]

If you copy the code snip to your clipboard, you can import it to your page and see the guts of the flows.

Here’s a snip of how I have my globals page. This is what I like to refer to as the heartbeat.

You can also check on the state of your globals here:

Once you get the hang of things in NR, you’ll find it super easy. We can do a teams Q&A if you’d like at some point if you want. I’d be available as early as this weekend to fire something up. I’m sure that @RRodman will be all about that. He’s my go to guy when I need to be set straight on my logic.

[EDIT]
Not all globals are treated equally. Take some time to understand how globals and locals work. You’ll find that harmonious balance if you do.

2 Likes

Here you go!
Inject nodes are what you will replace with your triggers.

[{"id":"3633dde0c2397e0b","type":"inject","z":"d78cbb58af202543","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":190,"y":240,"wires":[["bd58daa7e65de2fa"]]},{"id":"ac91e2469dcaa0af","type":"inject","z":"d78cbb58af202543","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":190,"y":280,"wires":[["bd58daa7e65de2fa"]]},{"id":"bd58daa7e65de2fa","type":"function","z":"d78cbb58af202543","name":"temp sensor","func":"node.status({fill:\"green\", shape:\"dot\", text:msg.payload});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":260,"wires":[["7747fb5667d34483"]]},{"id":"7747fb5667d34483","type":"change","z":"d78cbb58af202543","name":"tempsensor1 global","rules":[{"t":"set","p":"tempsensor1","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":260,"wires":[["81ce941f1dcd502b"]]},{"id":"81ce941f1dcd502b","type":"switch","z":"d78cbb58af202543","name":"true/false","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":760,"y":260,"wires":[["9869230ab3605417"],["9b1c35fda45c3d15"]]},{"id":"9b1c35fda45c3d15","type":"switch","z":"d78cbb58af202543","name":"tempsensor1 false","property":"tempsensor1","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1030,"y":360,"wires":[["8e1b4f5e2b298d88"]]},{"id":"9869230ab3605417","type":"rbe","z":"d78cbb58af202543","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":1590,"y":280,"wires":[["5933732646b07063"]]},{"id":"5933732646b07063","type":"function","z":"d78cbb58af202543","name":"furnace","func":"node.status({fill:\"green\", shape:\"dot\", text:msg.payload});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1740,"y":280,"wires":[["a50a9ac0bc0f7927"]]},{"id":"a50a9ac0bc0f7927","type":"debug","z":"d78cbb58af202543","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1890,"y":280,"wires":[]},{"id":"97de34c4239ca492","type":"inject","z":"d78cbb58af202543","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":170,"y":340,"wires":[["16417d40d8021333"]]},{"id":"9347a8008e39321e","type":"inject","z":"d78cbb58af202543","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":170,"y":380,"wires":[["16417d40d8021333"]]},{"id":"16417d40d8021333","type":"function","z":"d78cbb58af202543","name":"temp sensor","func":"node.status({fill:\"green\", shape:\"dot\", text:msg.payload});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":360,"wires":[["0117154ddfdb195d"]]},{"id":"0117154ddfdb195d","type":"change","z":"d78cbb58af202543","name":"tempsensor2 global","rules":[{"t":"set","p":"tempsensor2","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":360,"wires":[["f48a4976877db87f"]]},{"id":"f48a4976877db87f","type":"switch","z":"d78cbb58af202543","name":"true/false","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":740,"y":360,"wires":[["9869230ab3605417"],["9b1c35fda45c3d15"]]},{"id":"87e9f6251f8338cf","type":"inject","z":"d78cbb58af202543","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":190,"y":440,"wires":[["02931c50b66f7699"]]},{"id":"7dd8080f0b552ecc","type":"inject","z":"d78cbb58af202543","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":190,"y":480,"wires":[["02931c50b66f7699"]]},{"id":"02931c50b66f7699","type":"function","z":"d78cbb58af202543","name":"temp sensor","func":"node.status({fill:\"green\", shape:\"dot\", text:msg.payload});\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":460,"wires":[["afd0311d12543a41"]]},{"id":"afd0311d12543a41","type":"change","z":"d78cbb58af202543","name":"tempsensor3 global","rules":[{"t":"set","p":"tempsensor3","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":460,"wires":[["347604506d5681cd"]]},{"id":"347604506d5681cd","type":"switch","z":"d78cbb58af202543","name":"true/false","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":760,"y":460,"wires":[["9869230ab3605417"],["9b1c35fda45c3d15"]]},{"id":"8e1b4f5e2b298d88","type":"switch","z":"d78cbb58af202543","name":"tempsensor2 false","property":"tempsensor2","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1230,"y":360,"wires":[["f8506e629166c777"]]},{"id":"f8506e629166c777","type":"switch","z":"d78cbb58af202543","name":"tempsensor3 false","property":"tempsensor3","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1430,"y":360,"wires":[["9869230ab3605417"]]}]

3 Likes

I also use globals (set on the flow context since each flow is for a type of automations instead of a room) but I have a much simpler setup. I use the HE undocumented websockets (risky, I know) to filter and set the globals when something changes there.

On your bed flow, why do you have so many delays? I guess it’s because you wanted to increase the time progressively but I think it could be done with a looptimer node and a few change nodes to modify the delay.

I use something similar for my cat litter box automation to check the bathroom is empty by checking if the light is on.

That’s what I was missing, the filter node. Thank you.