Multiple Sensors

Hi Team.

Hope someone can help. In my Kitchen i have two Hue Motion Sensors. Basically what i am trying to achieve is that as long as there is motion on at least one or both that they wont turn the lights off. What i am finding with my current flow is that if sensor 1 stops sensing motion that at the 5 minute mark its switching all the lights off, even though there is still motion happening on sensor 2.

Any suggestions on how to over come this with rooms with more than one sensor?

Use a trigger node for the off signal set it like so and it will only fire when both entities are off. The existing motion on triggers need to clear whatever timer the off command starts.

1 Like

Thanks mate. So i added Trigger node and put it before the Good-Bye-Good-Night.

Where is it now set so that i want the lights to go off after 5 mins of no activity?

[{"id":"edac023089b090a4","type":"trigger","z":"f80b6c338afd5483","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1050,"y":1020,"wires":[[]]},{"id":"e372af24c3ad8e70","type":"change","z":"f80b6c338afd5483","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":940,"wires":[["edac023089b090a4"]]},{"id":"930bbbf3ec25e86e","type":"inject","z":"f80b6c338afd5483","name":"remove and attach to on trigger","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":510,"y":940,"wires":[["e372af24c3ad8e70"]]},{"id":"fc0a58f5018dc156","type":"inject","z":"f80b6c338afd5483","name":"Remove and attach to off trigger","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":730,"y":1020,"wires":[["edac023089b090a4"]]}]

Probably the easiest way to handle this… make a “group” with HA helpers… Example - I have 2 motion sensors in my garage… I made a group - MasterGarageMotion — then use that ‘helper’ entity in your nodered flow.

And to be honest… I originally had nodered watch both sensors… if one changed, it stored the state as a flow variable… soo if 1 motion sensor saw me, that variable would be 1… but if both saw me… it would be 2… the rest of the flow would wait until that variable was 0 for X amount of time… however groups makes it really simple

Here’s the difference

I little quick solution can also be to route the sensors output into a merge node and then set the timeout on the merge node to what you want as turn off timeout.

The merge node keeps adding messages to it output whenever something arrives at its input, but it will not send it before the timeout has been reached without any new input.

Thanks mate. Would it be possible to share your json so i can see how you have this all hanging together?

Here is a little flow where I use the merge node.
Its just a ping function, so correct the set ping list node with your names and IPs and it should work.
The flow sometimes fail if HA is not ready and due to the way it is constructed it will not restart again unless a variable is cleared, but if it is cleared too soon, then the flow will not finish correctly and some IPs might then not get pinged.
The merge node handles this because as long as the script runs the merge node will get new messages in and therefore not anything to the reset flow node.
If the flow fails, then there no new messages to the merge node and after 300 seconds it will send a message to the reset flow node and thereby make a restart of the flow possible.

[{"id":"5e79dbe6f1ff6193","type":"ping","z":"742cc87db4d12986","protocol":"IPv4","mode":"triggered","name":"ping","host":"","timer":"20","inputs":1,"x":290,"y":105,"wires":[["60ee1802b4936e33"]]},{"id":"de8cb585e64cbdcd","type":"function","z":"742cc87db4d12986","name":"init payload","func":"msg.payload = [\n    {\n        \"host\":msg.ping_hosts[flow.get('host_count')].host,\n        \"name\":msg.ping_hosts[flow.get('host_count')].name,\n        \"timeout\":1000\n    }\n]\ndelete msg.ping_hosts\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":140,"y":105,"wires":[["5e79dbe6f1ff6193"]]},{"id":"8d89777709693798","type":"ha-api","z":"742cc87db4d12986","name":"sensor","server":"541ade28.b4a62","version":1,"debugenabled":false,"protocol":"http","method":"post","path":"/api/states/{{entity_id}}","data":"","dataType":"json","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":635,"y":240,"wires":[["2b7fbc9f4d5a512c"]]},{"id":"60ee1802b4936e33","type":"function","z":"742cc87db4d12986","name":"rearrange payload","func":"ping = msg.payload\nmsg.payload = [\n    {\n        \"host\":msg.ping.host,\n        \"name\":msg.ping.name,\n        \"timeout\":msg.ping.timeout,\n        \"ping1\":ping\n    }\n]\ndelete msg.ping\ndelete msg.topic\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":465,"y":105,"wires":[["5556ec8bac29e714"]]},{"id":"5556ec8bac29e714","type":"ping","z":"742cc87db4d12986","protocol":"IPv4","mode":"triggered","name":"ping","host":"","timer":"20","inputs":1,"x":290,"y":150,"wires":[["4216857a7920c093"]]},{"id":"4216857a7920c093","type":"function","z":"742cc87db4d12986","name":"rearrange payload","func":"ping = msg.payload\nmsg.payload = [\n    {\n        \"host\":msg.ping.host,\n        \"name\":msg.ping.name,\n        \"timeout\":msg.ping.timeout,\n        \"ping1\":msg.ping.ping1,\n        \"ping2\":ping\n    }\n]\ndelete msg.ping\ndelete msg.topic\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":465,"y":150,"wires":[["5756468d017e28fc"]]},{"id":"3448a970a6c3c28b","type":"function","z":"742cc87db4d12986","name":"rearrange payload","func":"ping = msg.payload\nmsg.payload = [\n    {\n        \"host\":msg.ping.host,\n        \"name\":msg.ping.name,\n        \"timeout\":msg.ping.timeout,\n        \"ping1\":msg.ping.ping1,\n        \"ping2\":msg.ping.ping2,\n        \"ping3\":ping\n    }\n]\ndelete msg.ping\ndelete msg.topic\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":465,"y":195,"wires":[["9039ddb76aeaf573"]]},{"id":"5756468d017e28fc","type":"ping","z":"742cc87db4d12986","protocol":"IPv4","mode":"triggered","name":"ping","host":"","timer":"20","inputs":1,"x":290,"y":195,"wires":[["3448a970a6c3c28b"]]},{"id":"eab00987afff6bab","type":"function","z":"742cc87db4d12986","name":"make final payload","func":"ping = msg.payload\nmsg.entity_id = `sensor.ping_${msg.ping.name.toLowerCase().replace(/ /g, '_' )}`;\npacketloss=0;\naverage = 0;\nif (msg.ping.ping1==false)\n{\n    packetloss=1;\n}\nelse\n{\n    average=msg.ping.ping1;\n}\n\nif (msg.ping.ping2==false)\n{\n    packetloss++;\n}\nelse\n{\n    average=average+msg.ping.ping2;\n}\n\nif (msg.ping.ping3==false)\n{\n    packetloss++;\n}\nelse\n{\n    average=average+msg.ping.ping3;\n}\n\nif (ping==false)\n{\n    packetloss++;\n}\nelse\n{\n    average=average+ping;\n}\n\nif (packetloss!=4)\n{\n    average=average/(4-packetloss);\n}\npacketloss=packetloss*25\n\nmsg.payload = {\n    data: {\n        state: Date.now(),\n        attributes: {\n            'name':msg.ping.name,\n            'host':msg.ping.host,\n            'ping1': msg.ping.ping1,\n            'ping2': msg.ping.ping2,\n            'ping3': msg.ping.ping3,\n            'ping4': ping,\n            'average': Math.floor(average),\n            'packetloss': packetloss,\n            friendly_name: 'Ping '+msg.ping.name,\n            icon: 'mdi:pulse'\n        }\n    }\n};\ndelete msg.ping\ndelete msg.topic\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":465,"y":240,"wires":[["8d89777709693798"]]},{"id":"9039ddb76aeaf573","type":"ping","z":"742cc87db4d12986","protocol":"IPv4","mode":"triggered","name":"ping","host":"","timer":"20","inputs":1,"x":290,"y":240,"wires":[["eab00987afff6bab"]]},{"id":"06433f919f86b67b","type":"function","z":"742cc87db4d12986","name":"set ping list","func":"msg.ping_hosts = [\n        { \"name\":\"Router\",\"host\":\"10.10.12.1\"},\n        { \"name\":\"First Hop\", \"host\":\"100.70.8.1\"},\n        { \"name\":\"Public IP\",\"host\":\"185.107.15.19\"},\n        { \"name\":\"Google\", \"host\":\"8.8.8.8\"},\n        { \"name\":\"Switch 1\", \"host\":\"10.10.14.11\"},\n        { \"name\":\"Switch 2\", \"host\":\"10.10.14.12\"},\n        { \"name\":\"Switch 3\", \"host\":\"10.10.14.13\"},\n        { \"name\":\"Switch 4\", \"host\":\"10.10.14.14\"},\n        { \"name\":\"AP 1\", \"host\":\"10.10.14.21\"},\n        { \"name\":\"Hue Bridge\", \"host\":\"10.10.12.12\"},\n        { \"name\":\"RF Bridge 1\", \"host\":\"10.10.12.14\"},\n        { \"name\":\"RF Bridge 2\", \"host\":\"10.10.12.16\"},\n        { \"name\":\"NAS\", \"host\":\"10.10.12.20\"},\n        { \"name\":\"Radio Bedroom Left\", \"host\":\"10.10.12.50\"},\n        { \"name\":\"Radio Bedroom Right\", \"host\":\"10.10.12.52\"},\n        { \"name\":\"Smartplug Outdoor\", \"host\":\"10.10.12.150\"},\n        { \"name\":\"Smartplug Refrigerator\", \"host\":\"10.10.12.151\"},\n        { \"name\":\"Smartplug Freezer\", \"host\":\"10.10.12.152\"},\n        { \"name\":\"Smartplug Dishwasher\", \"host\":\"10.10.12.153\"},\n        { \"name\":\"Smartplug Washingmachine\", \"host\":\"10.10.12.154\"},\n        { \"name\":\"Sonoff Plug 1\", \"host\":\"10.10.12.155\"},\n        { \"name\":\"Sonoff Plug 2\", \"host\":\"10.10.12.156\"},\n        { \"name\":\"Sonoff Plug 3\", \"host\":\"10.10.12.157\"},\n        { \"name\":\"Sonoff Plug 4\", \"host\":\"10.10.12.158\"},\n        { \"name\":\"Sonoff Plug 5\", \"host\":\"10.10.12.159\"},\n        { \"name\":\"Sonoff Plug 6\", \"host\":\"10.10.12.160\"},\n        { \"name\":\"Sonoff Switch 1\", \"host\":\"10.10.12.161\"},\n        { \"name\":\"Kasa1\", \"host\":\"10.10.12.162\"},\n        { \"name\":\"Kasa2\", \"host\":\"10.10.12.163\"},\n        { \"name\":\"Kasa3\", \"host\":\"10.10.12.164\"},\n        { \"name\":\"Kasa4\", \"host\":\"10.10.12.165\"},\n        { \"name\":\"Kasa5\", \"host\":\"10.10.12.166\"},\n        { \"name\":\"Kasa6\", \"host\":\"10.10.12.167\"}\n    ]\nflow.set('ping_hosts_length',msg.ping_hosts.length)\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":775,"y":45,"wires":[["de8cb585e64cbdcd"]]},{"id":"cea4042da4a1a615","type":"inject","z":"742cc87db4d12986","name":"start ping cycle","props":[],"repeat":"120","crontab":"","once":true,"onceDelay":"30","topic":"","x":130,"y":45,"wires":[["c3848bb02d93a9da"]]},{"id":"1a060eab08e27cc9","type":"function","z":"742cc87db4d12986","name":"initiate counter","func":"flow.set('host_count',0)\nflow.set('running',1)\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":575,"y":45,"wires":[["06433f919f86b67b"]]},{"id":"2b7fbc9f4d5a512c","type":"function","z":"742cc87db4d12986","name":"increase counter","func":"counter=flow.get('host_count')+1\nif (counter==flow.get('ping_hosts_length'))\n{\n    flow.set('running',0)\n}\nflow.set('host_count',counter)\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":790,"y":240,"wires":[["04d9427be7f1da21","1ebf45b3f585cced"]]},{"id":"c3848bb02d93a9da","type":"switch","z":"742cc87db4d12986","name":"Check for active session","property":"running","propertyType":"flow","rules":[{"t":"neq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":45,"wires":[["1a060eab08e27cc9"]]},{"id":"04d9427be7f1da21","type":"switch","z":"742cc87db4d12986","name":"Check for active session","property":"running","propertyType":"flow","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":755,"y":150,"wires":[["06433f919f86b67b"]]},{"id":"e85fb753c38c3214","type":"function","z":"742cc87db4d12986","name":"reset flow ","func":"flow.set('host_count',0)\nflow.set('running',0)\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":975,"y":285,"wires":[[]]},{"id":"8a20032e6aa7d835","type":"inject","z":"742cc87db4d12986","name":"Reset at startup","props":[{"p":"reset","v":"1","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":"60","topic":"","x":130,"y":285,"wires":[["e85fb753c38c3214"]]},{"id":"1ebf45b3f585cced","type":"merge","z":"742cc87db4d12986","name":"","timeout":"300","x":965,"y":240,"wires":[["e85fb753c38c3214"]]},{"id":"541ade28.b4a62","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":""}]

I have similar setup in my bathroom. 3 motion sensors. I took out all the other crap, heres the core of it. If any of the 3 turn on, it turns lights on.

ONLY when all 3 turn off does it start the 120s timer.

As long as NONE turn on in that 120s, the lights turn off.

If ANY of them turn on while the timer is running, it stops the timer

[{"id":"e78564554a738c6c","type":"tab","label":"Flow 5","disabled":false,"info":"","env":[]},{"id":"63469208b7a06a0b","type":"server-state-changed","z":"e78564554a738c6c","name":"Motion sensed?","server":"ab3e2c53.e3491","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":["binary_sensor.motion_master_bathroom2","binary_sensor.motion_master_bathroom_4in1","binary_sensor.motion_master_bathroom_closet"],"entityidfiltertype":"list","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":"stop","valueType":"str"}],"x":200,"y":195,"wires":[["ff5aad87deede5a6","4b5a4059b45ac885"],[]]},{"id":"5f4b93f86897d0f9","type":"trigger-state","z":"e78564554a738c6c","name":"Motion cleared","server":"ab3e2c53.e3491","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":["binary_sensor.motion_master_bathroom_4in1","binary_sensor.motion_master_bathroom_closet","binary_sensor.motion_master_bathroom2"],"entityidfiltertype":"list","debugenabled":false,"constraints":[{"targetType":"entity_id","targetValue":"binary_sensor.motion_master_bathroom2","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"},{"targetType":"entity_id","targetValue":"binary_sensor.motion_master_bathroom_4in1","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"},{"targetType":"entity_id","targetValue":"binary_sensor.motion_master_bathroom_closet","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":false,"x":200,"y":275,"wires":[["ff5aad87deede5a6"],[]]},{"id":"ff5aad87deede5a6","type":"trigger","z":"e78564554a738c6c","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"120","extend":true,"overrideDelay":false,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":395,"y":270,"wires":[["3729d6d589a1a5f7"]]},{"id":"3729d6d589a1a5f7","type":"api-call-service","z":"e78564554a738c6c","name":"Turn off lights","server":"ab3e2c53.e3491","version":5,"debugenabled":true,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.master_bathroom","light.master_bathroom_shower"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":605,"y":270,"wires":[[]]},{"id":"4b5a4059b45ac885","type":"api-call-service","z":"e78564554a738c6c","name":"Turn on lights","server":"ab3e2c53.e3491","version":5,"debugenabled":true,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.master_bathroom","light.master_bathroom_shower"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":410,"y":195,"wires":[[]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

image



3 Likes

Looks like the trigger node does the same as the merge node.
The merge node might be a bit easier to set up as long as you just need a message and not really a specific content in it.

Here’s the json for the cleaner setup – I deleted the bigger flow last night after I posted, soo here’s hoping you want the easy one lol

[{"id":"185c4d3807634569","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"b0c5eeb462a1cc96","type":"group","z":"185c4d3807634569","name":"No motion in garage? Turn off lights","style":{"label":true},"nodes":["4a6ff6312d5bdc90","439fc6d0c7ee4959","1556bd57caba728e","c81277d5ea5e4f73"],"x":214,"y":119,"w":552,"h":142},{"id":"4a6ff6312d5bdc90","type":"server-state-changed","z":"185c4d3807634569","g":"b0c5eeb462a1cc96","name":"GarageMotionMaster","server":"da3b2d1e.ad751","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.garagemotionmaster","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":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":330,"y":160,"wires":[["1556bd57caba728e"],[]]},{"id":"439fc6d0c7ee4959","type":"api-call-service","z":"185c4d3807634569","g":"b0c5eeb462a1cc96","name":"Turn off Garage Lights","server":"da3b2d1e.ad751","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.garage_main_lights_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":220,"wires":[[]]},{"id":"1556bd57caba728e","type":"api-call-service","z":"185c4d3807634569","g":"b0c5eeb462a1cc96","name":"Turn on Garage Lights","server":"da3b2d1e.ad751","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.garage_main_lights_switch"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":560,"y":160,"wires":[[]]},{"id":"c81277d5ea5e4f73","type":"server-state-changed","z":"185c4d3807634569","g":"b0c5eeb462a1cc96","name":"GarageMotionMaster no motion 5 mins","server":"da3b2d1e.ad751","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.garagemotionmaster","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"5","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":380,"y":220,"wires":[["439fc6d0c7ee4959"],[]]},{"id":"da3b2d1e.ad751","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

That turns the lights on when it sees movement, and turns them off after 5 minutes of no activity.
You can always add more, like maybe check for brightness before turning the lights on (if your sensors support luminance)

and again, the MasterGarageMotion entity is made via HA helpers - Group

Thank you to everyone who has replied with solutions to my problem @Trickiegt thank you for the JSON, Imported tweaked slightly and now my Kitchen motion sensors are working in tandem. It gives me the base to now expand out from that.

Guys I really appreciated the help here and i have learnt something along the way so i cant thank you enough for that.

Silly Question? I love what you have done with creating the grey square box around the steps. Is there a trick to making that bigger?

You mean the code formatting?

Its the </> icon in the editor.
It works in two ways.
Either it marks a single line by having a single of the flying taps in the front and back of the line.
This will make the box big, so everything is visible.
Or it marks it with three of the flying taps in a line before and after the text, which makes it all in one line with scrolls.

Click the icon to get the correct form of the flying taps. :slight_smile:

Found it. Hightlight all the nodes you want and then select Group Selection. It draws the box around it.

Have to ungroup and then group again if my nodes grow. small pain point. Much prefer having this boxed off to make it easier to know whats what

That is not necessary, select the group and the additional nodes by holding ctrl. The drop down you show above, merge selection will be available.

Just to complete the config. I have taken what you gave me and expanded to what i wanted.

Now when my cats are roaming around the house or we get up in the night the Kitchen as an example will only come on dimmed for 10 seconds. Where as when we are home it will come on for 5 minutes. This is great as it will mean less electricity being used during the night with my Cats coming and going.

So appreciate all the help. Learning all the time.

2 Likes

Check out this 1min video about grouping. NodeRed Grouping

Have been using this flow for several items with multiple inputs and it has worked fine.

[{"id":"fde8b892.7c26d8","type":"server-state-changed","z":"de182df6.e92bc","name":"ms_office_desk_motion","server":"f0c57d9.41a8f8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.ms_office_desk_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":240,"wires":[["eaf50c21.f5534","e5e20d7b1925e048"]]},{"id":"eaf50c21.f5534","type":"switch","z":"de182df6.e92bc","name":"DESK on/off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":240,"wires":[["f483688cf7f35859"],[]]},{"id":"59e93c9e.8f1df4","type":"api-call-service","z":"de182df6.e92bc","name":"desk light","server":"f0c57d9.41a8f8","version":5,"debugenabled":false,"domain":"switch","service":"turn_{{payload}}","areaId":[],"deviceId":[],"entityId":["switch.office_light"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","x":660,"y":240,"wires":[[]]},{"id":"553324af.8b17ac","type":"debug","z":"de182df6.e92bc","name":"desk-ms-change","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":300,"wires":[]},{"id":"e5e20d7b1925e048","type":"debug","z":"de182df6.e92bc","name":"desk-ms","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":300,"y":300,"wires":[]},{"id":"f483688cf7f35859","type":"trigger","z":"de182df6.e92bc","name":"","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":490,"y":240,"wires":[["59e93c9e.8f1df4","553324af.8b17ac"]]},{"id":"87e04196aea05c13","type":"server-state-changed","z":"de182df6.e92bc","name":"Pr1-Office Occupancy","server":"f0c57d9.41a8f8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.occupancy","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":320,"wires":[["e5e20d7b1925e048","eaf50c21.f5534"]]},{"id":"f0c57d9.41a8f8","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"30"}]

Found this solution a few months back and wanted to thank you. It has solved a lot of my multiple sensor problems.

1 Like