Stop timer not triggering

Could someone with experience with Node-Red please take a look at the below flow?

The stop timer (with the red box around it) for some reason is not triggering.

I have attached the flow.

To test it, you can follow the following steps.

  1. Press OFF (to set the state machine to off)
  2. Press the timestamp to simulate motion
  3. Motion Detected will trigger
  4. After 10 seconds it will change the payload to motion-on
  5. The switch (where the red arrow is) should then trigger the stop timer, but for some reason this stop timer does not trigger, where all the others do.

Any suggestions are very welcome.

[{"id":"e2e95b6.b3de1a8","type":"tab","label":"Motion with  override","disabled":false,"info":""},{"id":"94a6a81c.b45fa8","type":"trigger-state","z":"e2e95b6.b3de1a8","name":"","server":"ea5ed475.5c5908","entityid":"binary_sensor.study_motion","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"s82afip7o7","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":240,"y":140,"wires":[["b6b4c63f.325838"],[]]},{"id":"ac918cc5.3074c","type":"switch","z":"e2e95b6.b3de1a8","name":"dark outside?","property":"dark_outside","propertyType":"global","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":540,"y":80,"wires":[[]]},{"id":"8f6b6c1a.db331","type":"inject","z":"e2e95b6.b3de1a8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":260,"wires":[["ac918cc5.3074c"]]},{"id":"244836d5.eded7a","type":"debug","z":"e2e95b6.b3de1a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":60,"wires":[]},{"id":"b6b4c63f.325838","type":"change","z":"e2e95b6.b3de1a8","name":"motion","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":140,"wires":[["244836d5.eded7a","edc7d4d.e33d328"]]},{"id":"b58de5c2.209bc8","type":"trigger-state","z":"e2e95b6.b3de1a8","name":"","server":"ea5ed475.5c5908","entityid":"light.office_main_lights","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":360,"y":280,"wires":[["79a0e92e.349c38"],[]]},{"id":"79a0e92e.349c38","type":"change","z":"e2e95b6.b3de1a8","name":"switch","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":200,"wires":[["edc7d4d.e33d328","6cc2187.025e9e8"]]},{"id":"edc7d4d.e33d328","type":"state-machine","z":"e2e95b6.b3de1a8","name":"","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","outputStateChangeOnly":true,"throwException":false,"states":["switch","motion-detected","motion-on","motion-off","off","on"],"transitions":[{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"motion-on","to":"motion-on"},{"name":"off","from":"*","to":"off"},{"name":"on","from":"*","to":"on"},{"name":"switch","from":"off","to":"switch"},{"name":"switch","from":"on","to":"switch"},{"name":"switch","from":"switch","to":"switch"},{"name":"switch","from":"motion-on","to":"switch"},{"name":"motion-on","from":"motion-detected","to":"motion-on"},{"name":"motion-off","from":"motion-on","to":"motion-off"}],"x":940,"y":160,"wires":[["cece4801.a03178","4041862c.19c8b8","b9f74aea.50f5e8","10b55e4c.d2eef2"]]},{"id":"6cc2187.025e9e8","type":"debug","z":"e2e95b6.b3de1a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":340,"wires":[]},{"id":"cece4801.a03178","type":"switch","z":"e2e95b6.b3de1a8","name":"motion-detected","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-detected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1180,"y":100,"wires":[["9fbc7c4d.984e7","445d1e59.a07e8"]]},{"id":"4041862c.19c8b8","type":"switch","z":"e2e95b6.b3de1a8","name":"motion-off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1140,"y":220,"wires":[["dd5e9b9c.3ef058","b8507df1.b94b9"]]},{"id":"b9f74aea.50f5e8","type":"switch","z":"e2e95b6.b3de1a8","name":"motion-on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1140,"y":340,"wires":[["51a95227.45800c","dad4f4d6.fe3998"]]},{"id":"10b55e4c.d2eef2","type":"switch","z":"e2e95b6.b3de1a8","name":"switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1110,"y":460,"wires":[["42ca312.b22cdd","8e48a56a.b36cd8"]]},{"id":"9fbc7c4d.984e7","type":"debug","z":"e2e95b6.b3de1a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":1150,"y":140,"wires":[]},{"id":"dd5e9b9c.3ef058","type":"debug","z":"e2e95b6.b3de1a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":1130,"y":260,"wires":[]},{"id":"51a95227.45800c","type":"debug","z":"e2e95b6.b3de1a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":1130,"y":380,"wires":[]},{"id":"42ca312.b22cdd","type":"debug","z":"e2e95b6.b3de1a8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","x":1110,"y":500,"wires":[]},{"id":"445d1e59.a07e8","type":"api-call-service","z":"e2e95b6.b3de1a8","name":"Turn on lights","server":"ea5ed475.5c5908","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.office_main_lights\"}","render_data":false,"mergecontext":"","output_location":"","output_location_type":"none","x":1400,"y":100,"wires":[["47e827c7.8bba48"]]},{"id":"2d1c0f0f.cda21","type":"change","z":"e2e95b6.b3de1a8","name":"motion-on","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion-on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1720,"y":100,"wires":[["223e868a.b4bdea"]]},{"id":"47e827c7.8bba48","type":"stoptimer","z":"e2e95b6.b3de1a8","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"pause","x":1570,"y":100,"wires":[["2d1c0f0f.cda21"],[]]},{"id":"223e868a.b4bdea","type":"link out","z":"e2e95b6.b3de1a8","name":"","links":["46f07238.a4a16c"],"x":1975,"y":240,"wires":[]},{"id":"46f07238.a4a16c","type":"link in","z":"e2e95b6.b3de1a8","name":"link","links":["223e868a.b4bdea"],"x":720,"y":60,"wires":[["edc7d4d.e33d328"]]},{"id":"b8507df1.b94b9","type":"api-call-service","z":"e2e95b6.b3de1a8","name":"Turn off lights","server":"ea5ed475.5c5908","service_domain":"light","service":"turn_off","data":"{\"entity_id\":\"light.office_main_lights\"}","render_data":false,"mergecontext":"","output_location":"","output_location_type":"none","x":1400,"y":220,"wires":[["fffc6242.dc0e7"]]},{"id":"fffc6242.dc0e7","type":"stoptimer","z":"e2e95b6.b3de1a8","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"pause","x":1570,"y":220,"wires":[["b58cce6b.85dee"],[]]},{"id":"b58cce6b.85dee","type":"api-current-state","z":"e2e95b6.b3de1a8","name":"Light State","server":"ea5ed475.5c5908","halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"override_payload":true,"override_data":true,"entity_id":"light.office_main_lights","state_type":"str","outputs":1,"x":1730,"y":220,"wires":[["223e868a.b4bdea"]]},{"id":"fa5f1fb0.46bfe","type":"inject","z":"e2e95b6.b3de1a8","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":550,"y":460,"wires":[["edc7d4d.e33d328"]]},{"id":"dad4f4d6.fe3998","type":"stoptimer","z":"e2e95b6.b3de1a8","duration":"5","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1380,"y":340,"wires":[["79150098.d7f38"],[]]},{"id":"79150098.d7f38","type":"change","z":"e2e95b6.b3de1a8","name":"motion-off","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion-off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1580,"y":340,"wires":[["223e868a.b4bdea"]]},{"id":"8e48a56a.b36cd8","type":"change","z":"e2e95b6.b3de1a8","name":"stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1250,"y":460,"wires":[["dad4f4d6.fe3998","281dc279.aa894e"]]},{"id":"281dc279.aa894e","type":"stoptimer","z":"e2e95b6.b3de1a8","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"pause detection","x":1440,"y":460,"wires":[["b58cce6b.85dee"],[]]},{"id":"7032712f.e8294","type":"inject","z":"e2e95b6.b3de1a8","name":"steady-state","topic":"","payload":"stop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1290,"y":580,"wires":[["281dc279.aa894e","b58cce6b.85dee"]]},{"id":"ea5ed475.5c5908","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"}]