State changed duration

Hi

i using Hass.io and Node red, and i want to create the following flow:

State Sensor X
Change to Y

I want to create split/flow that if time is < 20 min from state change go to 1 and if not go to 2

These examples in the cookbook will be of help

https://cookbook.nodered.org/basic/route-on-context

https://cookbook.nodered.org/basic/trigger-timeout

Tnx for the response but according to this
i can call/set node if i didnt get response more than X time

image

i want for example create the following flow.

Door sensor open -> the node should check if the Boolean (state) was change to home more than 30 min
do do action X if less open the light.

Flow 1 (home in last 30 mins)
What ever you want -[Trigger]-[Change Node to set global value]

Trigger node Send true then wait for 30 minutes then send false
So if triggered in the last 30 mins global value is true otherwise false

Flow 2
Door sensor open -[switch node to check global value]----
If global value is true do something otherwise don't

Which node did you use? Possible to paste an example here please I am new in the field.

Tnx
!

The trigger and change node and the switch node as per my last reply

Hi, I tried my own ways only using nodes as I'm useless with anything more fancy and I think it works

For me, my flow is to try to detect when the cleaning lady is done. She hates light sensors and all that so I turn the whole house lights "on" and deactivate sensors at 9h00am on fridays - when she arrives. But sometimes she stays 1h30min, sometimes 4 hours. I wanted to switch all back to normal once she turns off the light beside the entrance door - triggering restart of automated stuff.

[{"id":"fd8614f35e5086dd","type":"ha-wait-until","z":"696f8303.5ee06c","name":"Wait until lights off","server":"a0eea9da.0fe1d8","version":1,"outputs":1,"entityId":"switch.hallsonoff","entityIdFilterType":"exact","property":"","comparator":"is","value":"off","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":610,"y":100,"wires":[["fbda29edbe577364"]]},{"id":"364a918cfc1fddfa","type":"api-current-state","z":"696f8303.5ee06c","name":"Light on for at least 60min","server":"a0eea9da.0fe1d8","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.hallsonoff","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"60","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":370,"y":120,"wires":[["fd8614f35e5086dd"],[]]},{"id":"a97e68170b634c05","type":"server-state-changed","z":"696f8303.5ee06c","name":"Hall light on","server":"a0eea9da.0fe1d8","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.hallsonoff","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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":120,"wires":[["364a918cfc1fddfa"],[]]},{"id":"fbda29edbe577364","type":"api-call-service","z":"696f8303.5ee06c","name":"Cleaning Lady not Home","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"device_tracker","service":"see","areaId":[],"deviceId":[],"entityId":[],"data":"{\"dev_id\":\"asmert\",\"location_name\":\"not_home\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":100,"wires":[[]]},{"id":"a0eea9da.0fe1d8","type":"server","name":"GOOD Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]