What Node would I use.. timer to reset on state change from state allowed to start timer

I have my motion sensors turning lights, and turning the lights off. the issue is if the sensor reports No Motion, my turn off flow begins to time 10 minutes at the late night time, 25 minutes the rest of the day. Now if motion resumes during that timers timing, it continues timing. It doesn’t stop, so instead it could shut the light off 3 minutes after motion is detected. I need a node that will stop timing of the true/motion state of the detector is engaged. Currently using the Wait Until. Doesn’t seem to do what I need. Configuration issue maybe?

[
    {
        "id": "61e913b5.938cac",
        "type": "server-state-changed",
        "z": "65879bb8.db4a54",
        "name": "Kitchen Motion Clear",
        "server": "b56928d5.6e0628",
        "version": 1,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.kitchen_motion_sensor",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "habool",
        "haltifstate": "false",
        "halt_if_type": "bool",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "x": 110,
        "y": 1020,
        "wires": [
            [],
            [
                "ae36eacc.321268"
            ]
        ]
    },
    {
        "id": "ae36eacc.321268",
        "type": "time-range-switch",
        "z": "65879bb8.db4a54",
        "name": "L-Night - E-Morning 22-7",
        "lat": "",
        "lon": "",
        "startTime": "22:00:01",
        "endTime": "07:00",
        "startOffset": 0,
        "endOffset": 0,
        "x": 350,
        "y": 1020,
        "wires": [
            [
                "c366ec15.9eaf9"
            ],
            [
                "648e37b5.79ba48"
            ]
        ]
    },
    {
        "id": "c366ec15.9eaf9",
        "type": "ha-wait-until",
        "z": "65879bb8.db4a54",
        "name": "10M Off ",
        "server": "b56928d5.6e0628",
        "outputs": 2,
        "entityId": "binary_sensor.kitchen_motion_sensor",
        "property": "state",
        "comparator": "is",
        "value": "false",
        "valueType": "bool",
        "timeout": "1",
        "timeoutUnits": "minutes",
        "entityLocation": "",
        "entityLocationType": "none",
        "checkCurrentState": true,
        "blockInputOverrides": true,
        "x": 560,
        "y": 1000,
        "wires": [
            [],
            [
                "d0e7e9d3.264098"
            ]
        ]
    },
    {
        "id": "648e37b5.79ba48",
        "type": "ha-wait-until",
        "z": "65879bb8.db4a54",
        "name": "25M Off ",
        "server": "b56928d5.6e0628",
        "outputs": 2,
        "entityId": "binary_sensor.kitchen_motion_sensor",
        "property": "state",
        "comparator": "is",
        "value": "false",
        "valueType": "bool",
        "timeout": "1",
        "timeoutUnits": "minutes",
        "entityLocation": "",
        "entityLocationType": "none",
        "checkCurrentState": true,
        "blockInputOverrides": true,
        "x": 560,
        "y": 1060,
        "wires": [
            [],
            [
                "6f3b7a2a.5bb694"
            ]
        ]
    },
    {
        "id": "d0e7e9d3.264098",
        "type": "api-current-state",
        "z": "65879bb8.db4a54",
        "name": "Kitchen Motion Allowed",
        "server": "b56928d5.6e0628",
        "version": 1,
        "outputs": 2,
        "halt_if": "true",
        "halt_if_type": "bool",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "input_boolean.kitmotion",
        "state_type": "habool",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 810,
        "y": 1040,
        "wires": [
            [
                "51713f57.eb4da"
            ],
            []
        ]
    },
    {
        "id": "6f3b7a2a.5bb694",
        "type": "api-current-state",
        "z": "65879bb8.db4a54",
        "name": "Kitchen Motion Allowed",
        "server": "b56928d5.6e0628",
        "version": 1,
        "outputs": 2,
        "halt_if": "true",
        "halt_if_type": "bool",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "input_boolean.kitmotion",
        "state_type": "habool",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 810,
        "y": 1120,
        "wires": [
            [
                "51713f57.eb4da"
            ],
            []
        ]
    },
    {
        "id": "51713f57.eb4da",
        "type": "api-call-service",
        "z": "65879bb8.db4a54",
        "name": "Light Off",
        "server": "b56928d5.6e0628",
        "version": 1,
        "debugenabled": false,
        "service_domain": "light",
        "service": "turn_off",
        "entityId": "light.kitchen_light_level",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 1040,
        "y": 1000,
        "wires": [
            []
        ]
    },
    {
        "id": "b56928d5.6e0628",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "legacy": false,
        "hassio": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true
    }
]

Note the node timer settings were altered for testing purposes to debug some seeming issues. I’ve got them straight just didn’t reset the timers to actual use time.

you can do it with a trigger node

[{"id":"a6067557.2a87d8","type":"trigger-state","z":"5a4432b6.9db02c","name":"Motion?","server":"cc436e5e.bbf7e","entityid":"binary_sensor.studymotion","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":3,"customoutputs":[{"outputId":"sw9funfzjo","messageType":"default","messageValue":"","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"on"}],"outputinitially":false,"state_type":"str","x":140,"y":247,"wires":[["cee98c99.fec9f"],[],["24096104.293e9e"]]},{"id":"24096104.293e9e","type":"api-call-service","z":"5a4432b6.9db02c","name":"lamp switch on","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.desk_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":767,"y":260,"wires":[[]]},{"id":"cee98c99.fec9f","type":"trigger","z":"5a4432b6.9db02c","op1":"","op2":"true","op1type":"nul","op2type":"bool","duration":"10","extend":false,"units":"min","reset":"on","bytopic":"all","name":"","x":537,"y":140,"wires":[["82b0a2d1.1dc37","edf6e85.fdee118","bd5e310.68fced"]]},{"id":"82b0a2d1.1dc37","type":"api-call-service","z":"5a4432b6.9db02c","name":"lamp switch off","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.desk_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":767,"y":80,"wires":[[]]},{"id":"edf6e85.fdee118","type":"api-call-service","z":"5a4432b6.9db02c","name":"uplight off","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.up_light","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":747,"y":140,"wires":[[]]},{"id":"bd5e310.68fced","type":"api-call-service","z":"5a4432b6.9db02c","name":"music off","server":"cc436e5e.bbf7e","version":"1","debugenabled":false,"service_domain":"media_player","service":"turn_off","entityId":"media_player.study_mini","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":747,"y":200,"wires":[[]]},{"id":"dbc44ca6.d51ed","type":"server-state-changed","z":"5a4432b6.9db02c","name":"uplight on","server":"cc436e5e.bbf7e","version":1,"entityidfilter":"light.up_light","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":140,"y":140,"wires":[["decdfccd.54f6"],[]],"icon":"font-awesome/fa-lightbulb-o"},{"id":"decdfccd.54f6","type":"change","z":"5a4432b6.9db02c","name":"send off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":140,"wires":[["cee98c99.fec9f"]]},{"id":"cc436e5e.bbf7e","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]