Light automation with door and motion sensor

I’m trying to learn Node-RED and decided to start with a light flow in my bathroom that works with a door and motion sensor. I think I’ve started with a challenge because I’m getting crazy. I want the following:

  • When the bathroom door is opened (from closed state) or there is motion: turn bathroom light on.
  • After a couple of minutes I want to dim the light a bit. Then after another minute I want to turn the light off.
  • Whenever the door is opened (from closed state) again or there is new motion: turn light on and reset the timers.
  • During the night (00:00 - 07:00) the light will start at and dim to a lower percentage.

So far I’ve got this:

This works pretty well, but whenever movement is detected it starts the timers. If there’s constant movement the timers don’t reset. This means that eventually the lights will turn off even though someone is still in the bathroom.

I don’t know what the easiest way is to prevent this. But I think when there’s movement the timers only need to start when the movement stops. Does this make sense and how would I build this?

I’m looking for the most efficient way to do this so I learn the “best logic”, so if there are suggestions to approach this flow completely differently then please enlighten me.

Use a delay node instead of timer. Delay gets reset after every new motion.

I think you mean after receiving a new msg from the motion node? Stoptimers also reset after every new msg received. I tested delays, and unfortunately they aren’t working either. Because the motion sensor is continuously on in my use-case there is no new impulse (msg). So the timers end at one point, the light turns off, all while I’m still in the bathroom moving around.

Yes.

I think it will be hard to solve your use case… if the status of a motion sensor keeps “on” and there is no way to retrigger a flow in nodered.

Hm, maybe there is a way on second thought.
If you filter on the msg payload “on” to trigger your existing flow. And then use a current state node to check the entity state. If “on” do nothing, if “off” trigger delay and do what you want

I’m using the Philips Hue Motion Sensor with a Conbee II stick. This is pretty commonly used hardware right? I’m wondering how other people work this out.

Perhaps use a “Wait Until” node starting the timer whenever the motion sensor turns from on to off? But how would I combine this with the door sensor, which can start the timers right away (and it needs to in case only the doors are opened, but nobody enters the bathroom). Is it possible to stop the timer when there’s motion detected?

see my previous post, I edited it.

I use e.g. motion sensors that trigger a short “on” (or other) and am able to reset the flow in node-red…

Can you:
select all nodes which make up your flow.
then go to “export” and copy the code in a post. (formatted with the button:
image )

That would also work yes, i never use that node however). But you can “input” multiple triggers into the start of your flow…

I think we’re on to something. Here’s the flow. I should’ve done that right away.

[{"id":"382248c2.2f2578","type":"time-range-switch","z":"73df11ff.bca52","name":"Day","lat":"","lon":"","startTime":"07:00","endTime":"00:00","startOffset":0,"endOffset":0,"x":381.9999694824219,"y":213.00000476837158,"wires":[["3003051d.fd15ea","c6613ccb.8a5f7","93ca084b.69c788"],["c21642a4.9be68","7e680dd4.d132b4","f271000f.bc7c4"]]},{"id":"86b79ec9.4b524","type":"api-call-service","z":"73df11ff.bca52","name":"Bathroom light OFF","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.bathroom","data":"{\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":933.1110572814941,"y":214.99994277954102,"wires":[[]]},{"id":"3003051d.fd15ea","type":"api-call-service","z":"73df11ff.bca52","name":"Set bathroom light 100%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":100,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":630.8887977600098,"y":70.55553531646729,"wires":[[]]},{"id":"5659c808.8f52f8","type":"api-call-service","z":"73df11ff.bca52","name":"Bathroom light 50%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":50,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":844.2220687866211,"y":141.88892555236816,"wires":[[]]},{"id":"c21642a4.9be68","type":"api-call-service","z":"73df11ff.bca52","name":"Set bathroom light 40%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":40,\"transition\":2}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":635.3331642150879,"y":366.33330249786377,"wires":[[]]},{"id":"7e680dd4.d132b4","type":"stoptimer","z":"73df11ff.bca52","duration":"2","units":"Minute","payloadtype":"num","payloadval":"","name":"2 min","x":625.3332405090332,"y":296.3332710266113,"wires":[["59ba77cc.2f12b8"],[]]},{"id":"59ba77cc.2f12b8","type":"api-call-service","z":"73df11ff.bca52","name":"Bathroom light 20%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":20,\"transition\":2}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":848.5552406311035,"y":279.22225189208984,"wires":[[]]},{"id":"a484fb43.8c0668","type":"trigger-state","z":"73df11ff.bca52","name":"Bathroom door open","server":"1ad5b30.fa6664d","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bathroom_door","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off","propertyValue":"old_state.state"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":156.99996948242188,"y":189,"wires":[["382248c2.2f2578"],[]]},{"id":"8b5b9baf.c5b348","type":"trigger-state","z":"73df11ff.bca52","name":"Bathroom motion","server":"1ad5b30.fa6664d","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bathroom_motion","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":155.5,"y":244,"wires":[["382248c2.2f2578"],[]]},{"id":"f271000f.bc7c4","type":"stoptimer","z":"73df11ff.bca52","duration":"3","units":"Minute","payloadtype":"num","payloadval":"","name":"3 mins","x":663,"y":240,"wires":[["86b79ec9.4b524"],[]]},{"id":"c6613ccb.8a5f7","type":"stoptimer","z":"73df11ff.bca52","duration":"5","units":"Minute","payloadtype":"num","payloadval":"","name":"5 mins","x":665.4442138671875,"y":194.11111450195312,"wires":[["86b79ec9.4b524"],[]]},{"id":"93ca084b.69c788","type":"stoptimer","z":"73df11ff.bca52","duration":"4","units":"Minute","payloadtype":"num","payloadval":"","name":"4 mins","x":623.2222328186035,"y":143.4443998336792,"wires":[["5659c808.8f52f8"],[]]},{"id":"1ad5b30.fa6664d","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

AFAIK you can reset any timer-like node in NR by sending specific message to its input. See particular node build-in docs.

try something like this:


[{"id":"382248c2.2f2578","type":"time-range-switch","z":"90a3656d.aa9d4","name":"Day","lat":"","lon":"","startTime":"07:00","endTime":"00:00","startOffset":0,"endOffset":0,"x":950,"y":2780,"wires":[["3003051d.fd15ea","c6613ccb.8a5f7","93ca084b.69c788"],["c21642a4.9be68","7e680dd4.d132b4","f271000f.bc7c4"]]},{"id":"86b79ec9.4b524","type":"api-call-service","z":"90a3656d.aa9d4","name":"Bathroom light OFF","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.bathroom","data":"{\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1501.1110877990723,"y":2781.9999380111694,"wires":[[]]},{"id":"3003051d.fd15ea","type":"api-call-service","z":"90a3656d.aa9d4","name":"Set bathroom light 100%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":100,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1198.888828277588,"y":2637.5555305480957,"wires":[[]]},{"id":"5659c808.8f52f8","type":"api-call-service","z":"90a3656d.aa9d4","name":"Bathroom light 50%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":50,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1412.2220993041992,"y":2708.8889207839966,"wires":[[]]},{"id":"c21642a4.9be68","type":"api-call-service","z":"90a3656d.aa9d4","name":"Set bathroom light 40%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":40,\"transition\":2}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1203.333194732666,"y":2933.333297729492,"wires":[[]]},{"id":"7e680dd4.d132b4","type":"stoptimer","z":"90a3656d.aa9d4","duration":"2","units":"Minute","payloadtype":"num","payloadval":"","name":"2 min","x":1193.3332710266113,"y":2863.3332662582397,"wires":[["59ba77cc.2f12b8"],[]]},{"id":"59ba77cc.2f12b8","type":"api-call-service","z":"90a3656d.aa9d4","name":"Bathroom light 20%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":20,\"transition\":2}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1416.5552711486816,"y":2846.2222471237183,"wires":[[]]},{"id":"a484fb43.8c0668","type":"trigger-state","z":"90a3656d.aa9d4","name":"Bathroom door open","server":"1ad5b30.fa6664d","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bathroom_door","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"off","propertyValue":"old_state.state"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":720,"y":2760,"wires":[[],[]]},{"id":"8b5b9baf.c5b348","type":"trigger-state","z":"90a3656d.aa9d4","name":"Bathroom motion","server":"1ad5b30.fa6664d","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bathroom_motion","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":724.5000305175781,"y":2810.9999952316284,"wires":[[],[]]},{"id":"f271000f.bc7c4","type":"stoptimer","z":"90a3656d.aa9d4","duration":"3","units":"Minute","payloadtype":"num","payloadval":"","name":"3 mins","x":1231.0000305175781,"y":2806.9999952316284,"wires":[["86b79ec9.4b524"],[]]},{"id":"c6613ccb.8a5f7","type":"stoptimer","z":"90a3656d.aa9d4","duration":"5","units":"Minute","payloadtype":"num","payloadval":"","name":"5 mins","x":1233.4442443847656,"y":2761.1111097335815,"wires":[["86b79ec9.4b524"],[]]},{"id":"93ca084b.69c788","type":"stoptimer","z":"90a3656d.aa9d4","duration":"4","units":"Minute","payloadtype":"num","payloadval":"","name":"4 mins","x":1191.2222633361816,"y":2710.4443950653076,"wires":[["5659c808.8f52f8"],[]]},{"id":"85ca8b6f.731618","type":"server-state-changed","z":"90a3656d.aa9d4","name":"","server":"c6b350c5.b8b3c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.bathroom_door","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":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":680,"y":2700,"wires":[["382248c2.2f2578"],["c6613ccb.8a5f7","93ca084b.69c788"]]},{"id":"9d8d2355.84ab08","type":"server-state-changed","z":"90a3656d.aa9d4","name":"","server":"c6b350c5.b8b3c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.bathroom_motion","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":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":740,"y":2860,"wires":[["382248c2.2f2578"],[]]},{"id":"1ad5b30.fa6664d","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"c6b350c5.b8b3c","type":"server","name":"Home Assistant"}]

I think you meant to connect the motion sensor’s false output to the stoptimers? It’s not working. Motion state is on for the whole time I’m in the bathroom. So the false output only sends out after I left the bathroom (in the dark).

Indeed if the msg has a payload containing stop or STOP.

You guys got me thinking and I mostly separated the starting state of the light and the timers for dimming:

This now does exactly what I want in every use case:

  • When opening the door, but not entering the bathroom
    Start lights in start state and start dim timers.
  • When opening the door, trigger motion
    Start lights in start state. Because the door sensor turned the light and so started the dim timers, but motion is on > cancel dim timers. Only when motion is off > start dim timers.
  • When door is already opened, trigger motion
    Start lights in state state. When motion is off > start dim timers.
  • Lights dim indicating no motion was detected, but I’m still in the bathroom
    Because the dim timers only start when no motion was detected, I’m able to wave in front of the motion sensor again, starting the previous use case.

In case anyone wants to fiddle around or copy it:

[{"id":"a484fb43.8c0668","type":"trigger-state","z":"73df11ff.bca52","name":"Bathroom door open","server":"1ad5b30.fa6664d","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bathroom_door","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"previous_state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"old_state.state"},{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":180.99996948242188,"y":203,"wires":[["382248c2.2f2578","abe85adb.966848"],[]]},{"id":"8b5b9baf.c5b348","type":"trigger-state","z":"73df11ff.bca52","name":"Bathroom motion","server":"1ad5b30.fa6664d","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bathroom_motion","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":190.5,"y":377,"wires":[["ab946faa.96ec9","382248c2.2f2578"],["abe85adb.966848"]]},{"id":"86a81034.e5167","type":"comment","z":"73df11ff.bca52","name":"Bathroom light (double click for details)","info":"# Use cases\n\n - **When opening the door, but not entering the bathroom**\n Start lights in start state and start dim timers.\n - **When opening the door, trigger motion**\n Start lights in start state. Because the door sensor turned the light and so started the dim timers, but motion is `on` > cancel dim timers. Only when motion is `off` > start dim timers.\n - **When door is already opened, trigger motion**\n Start lights in state state. When motion is `off` > start dim timers.\n - **Lights dim indicating no motion was detected, but I'm still in the bathroom**\n Because the dim timers only start when no motion was detected, I'm able to wave in front of the motion sensor again, starting the previous use-case.","x":181.5,"y":116,"wires":[]},{"id":"204ec30a.bea6dc","type":"group","z":"73df11ff.bca52","name":"Dim light gradually | Perc. depending on day/night","style":{"label":true,"label-position":"ne"},"nodes":["86b79ec9.4b524","5659c808.8f52f8","7e680dd4.d132b4","59ba77cc.2f12b8","f271000f.bc7c4","e45b074a.05c208","1a5dc0c4.eeb52f","abe85adb.966848"],"x":371,"y":395.8889465332031,"w":730.5552978515625,"h":245.44436645507812},{"id":"86b79ec9.4b524","type":"api-call-service","z":"73df11ff.bca52","g":"204ec30a.bea6dc","name":"Bathroom light OFF","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.bathroom","data":"{\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":985.111083984375,"y":512.9999694824219,"wires":[[]]},{"id":"5659c808.8f52f8","type":"api-call-service","z":"73df11ff.bca52","g":"204ec30a.bea6dc","name":"Bathroom light 50%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":50,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":977.2221069335938,"y":436.8889465332031,"wires":[[]]},{"id":"7e680dd4.d132b4","type":"stoptimer","z":"73df11ff.bca52","g":"204ec30a.bea6dc","duration":"2","units":"Minute","payloadtype":"num","payloadval":"","name":"2 min","x":746.3333129882812,"y":600.3333129882812,"wires":[["59ba77cc.2f12b8"],[]]},{"id":"59ba77cc.2f12b8","type":"api-call-service","z":"73df11ff.bca52","g":"204ec30a.bea6dc","name":"Bathroom light 15%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":15,\"transition\":2,\"color_temp\":407}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":985.5552978515625,"y":594.2222595214844,"wires":[[]]},{"id":"f271000f.bc7c4","type":"stoptimer","z":"73df11ff.bca52","g":"204ec30a.bea6dc","duration":"3","units":"Minute","payloadtype":"num","payloadval":"","name":"3 min","x":765.0000610351562,"y":546.0000305175781,"wires":[["86b79ec9.4b524"],[]]},{"id":"e45b074a.05c208","type":"stoptimer","z":"73df11ff.bca52","g":"204ec30a.bea6dc","duration":"3","units":"Minute","payloadtype":"num","payloadval":"0","name":"3 min","x":747.5000610351562,"y":441.0000305175781,"wires":[["5659c808.8f52f8"],[]]},{"id":"1a5dc0c4.eeb52f","type":"stoptimer","z":"73df11ff.bca52","g":"204ec30a.bea6dc","duration":"4","units":"Minute","payloadtype":"num","payloadval":"0","name":"4 min","x":764.5000610351562,"y":495.0000305175781,"wires":[["86b79ec9.4b524"],[]]},{"id":"abe85adb.966848","type":"time-range-switch","z":"73df11ff.bca52","g":"204ec30a.bea6dc","name":"Day","lat":"","lon":"","startTime":"07:00","endTime":"00:00","startOffset":0,"endOffset":0,"x":447,"y":509,"wires":[["e45b074a.05c208","1a5dc0c4.eeb52f"],["f271000f.bc7c4","7e680dd4.d132b4"]]},{"id":"921a0ba.5641cf8","type":"group","z":"73df11ff.bca52","name":"Stop running timers on motion","style":{"label":true,"label-position":"ne"},"nodes":["ab946faa.96ec9","75df9ada.be8934"],"x":371.5,"y":223,"w":232,"h":161},{"id":"ab946faa.96ec9","type":"api-current-state","z":"73df11ff.bca52","g":"921a0ba.5641cf8","name":"Bathroom light on","server":"1ad5b30.fa6664d","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.bathroom","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","blockInputOverrides":false,"x":487.5,"y":264,"wires":[["75df9ada.be8934"],[]]},{"id":"75df9ada.be8934","type":"change","z":"73df11ff.bca52","g":"921a0ba.5641cf8","name":"Stop timers","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":483.5,"y":343,"wires":[["e45b074a.05c208","1a5dc0c4.eeb52f","f271000f.bc7c4","7e680dd4.d132b4"]]},{"id":"b89e7368.751f","type":"group","z":"73df11ff.bca52","name":"Bathroom light starting state depending on night/day","style":{"label":true,"label-position":"ne"},"nodes":["382248c2.2f2578","3003051d.fd15ea","c21642a4.9be68"],"x":370.9999694824219,"y":61.55553436279297,"w":440.3331604003906,"h":148.77777862548828},{"id":"382248c2.2f2578","type":"time-range-switch","z":"73df11ff.bca52","g":"b89e7368.751f","name":"Day","lat":"","lon":"","startTime":"07:00","endTime":"00:00","startOffset":0,"endOffset":0,"x":446.9999694824219,"y":128,"wires":[["3003051d.fd15ea"],["c21642a4.9be68"]]},{"id":"3003051d.fd15ea","type":"api-call-service","z":"73df11ff.bca52","g":"b89e7368.751f","name":"Set bathroom light 100%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":100,\"transition\":1}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":668.8887939453125,"y":102.55553436279297,"wires":[[]]},{"id":"c21642a4.9be68","type":"api-call-service","z":"73df11ff.bca52","g":"b89e7368.751f","name":"Set bathroom light 30%","server":"1ad5b30.fa6664d","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bathroom","data":"{\"brightness_pct\":30,\"transition\":2,\"color_temp\":407}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":675.3331298828125,"y":169.33331298828125,"wires":[[]]},{"id":"1ad5b30.fa6664d","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Thanks for your help! This is a lot of fun. :partying_face:

2 Likes

great! how did you get the 3 darker grey block behind the nodes?

Those are groups you can make through the main menu.

How to do?

image

You first have to select your nodes and then go here. It might be a new version of Node-RED if you’re missing the option?