Trigger Not Resetting

I have the following code to turn a light on when motion is detected and the light level is low and turn off after 10 minutes. I was using the using the Stop Timer but with the new Node-Red upgrade I had to switch to the Trigger. The Trigger dosent always reset itself, so when the light turns off and then it gets triggered again it will turn the light off within a minute. Any ideas as to why its not working correctly?

[{"id":"38bba1ec.290e0e","type":"api-call-service","z":"40023292.3ec94c","name":"Turn On Jeff Light","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"switch","service":"turn_on","areaId":,"deviceId":,"entityId":["switch.jeff_light_socket_1"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":910,"y":240,"wires":[]},{"id":"62d37c09.668a14","type":"api-call-service","z":"40023292.3ec94c","name":"Turn On Turtle Light","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"light","service":"turn_on","areaId":,"deviceId":,"entityId":["light.turtle_light"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":920,"y":300,"wires":[]},{"id":"dc99f138.5e14f","type":"api-call-service","z":"40023292.3ec94c","name":"Turn Off Turtle Light","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"light","service":"turn_off","areaId":,"deviceId":,"entityId":["light.turtle_light"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":920,"y":420,"wires":[]},{"id":"44b4db6.a677324","type":"api-call-service","z":"40023292.3ec94c","name":"Turn Off Jeff Light","server":"456659de.370498","version":5,"debugenabled":true,"domain":"switch","service":"turn_off","areaId":,"deviceId":,"entityId":["switch.jeff_light_socket_1"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":910,"y":360,"wires":[]},{"id":"e540e0dc.62ae9","type":"server-state-changed","z":"40023292.3ec94c","name":"Livingroom Motion Detection","server":"4a63ddf5.8fd424","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.livingroom_4_in_1_sensor_7","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":140,"y":40,"wires":[["b9171d40.e80e8"],["2544066e.4aee1a"]]},{"id":"2544066e.4aee1a","type":"time-range-switch","z":"40023292.3ec94c","name":"","lat":"39.325159","lon":"-88.127590","startTime":"sunset","endTime":"01:30","startOffset":"-62","endOffset":0,"x":140,"y":200,"wires":[,["e75d053cbca923bc"]]},{"id":"b9171d40.e80e8","type":"api-current-state","z":"40023292.3ec94c","name":"","server":"4a63ddf5.8fd424","version":3,"outputs":2,"halt_if":"40","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.livingroom_light_sen_9","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":510,"y":40,"wires":[["feec1db9c280fe67"],]},{"id":"8afc214d0a4de52e","type":"switch","z":"40023292.3ec94c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":380,"wires":[["38bba1ec.290e0e","62d37c09.668a14"],["44b4db6.a677324","dc99f138.5e14f"]]},{"id":"e75d053cbca923bc","type":"trigger","z":"40023292.3ec94c","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"min","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":390,"y":200,"wires":[["29ee63fc48bd449e"]]},{"id":"29ee63fc48bd449e","type":"api-current-state","z":"40023292.3ec94c","name":"Jeff Light On","server":"4a63ddf5.8fd424","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.jeff_light_socket_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":200,"wires":[["44b4db6.a677324"],]},{"id":"feec1db9c280fe67","type":"api-current-state","z":"40023292.3ec94c","name":"Jeff Light Off","server":"4a63ddf5.8fd424","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.jeff_light_socket_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":120,"wires":[["38bba1ec.290e0e"],]},{"id":"4a63ddf5.8fd424","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"},{"id":"456659de.370498","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]

Your formatting was incorrect when you tried to post a flow, here are instructions on how to do that: Importing and Exporting Flows : Node-RED

Also wrap the flow in triple ``` backticks ``` when you post it, so it will be formatted correctly.

[{"id":"38bba1ec.290e0e","type":"api-call-service","z":"40023292.3ec94c","name":"Turn On Jeff Light","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.jeff_light_socket_1"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":240,"wires":[[]]},{"id":"d1aad3c8.4f472","type":"bigtimer","z":"40023292.3ec94c","outtopic":"","outpayload1":"ON","outpayload2":"OFF","name":"Trigger Jeff & Turtle Light and Christmas Trees","comment":"","lat":"039.325159","lon":"-88.127590","starttime":"5004","endtime":"90","starttime2":0,"endtime2":0,"startoff":"-50","endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":"","xmonth7":"","xday8":"","xmonth8":"","xday9":"","xmonth9":"","xday10":"","xmonth10":"","xday11":"","xmonth11":"","xday12":"","xmonth12":"","xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":false,"atstart":false,"odd":false,"even":false,"x":200,"y":500,"wires":[["8afc214d0a4de52e","2f0c666cf0b9039b"],[],[]]},{"id":"62d37c09.668a14","type":"api-call-service","z":"40023292.3ec94c","name":"Turn On Turtle Light","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.turtle_light"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":300,"wires":[[]]},{"id":"dc99f138.5e14f","type":"api-call-service","z":"40023292.3ec94c","name":"Turn Off Turtle Light","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.turtle_light"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":420,"wires":[[]]},{"id":"44b4db6.a677324","type":"api-call-service","z":"40023292.3ec94c","name":"Turn Off Jeff Light","server":"456659de.370498","version":5,"debugenabled":true,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.jeff_light_socket_1"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":910,"y":360,"wires":[[]]},{"id":"e540e0dc.62ae9","type":"server-state-changed","z":"40023292.3ec94c","name":"Livingroom Motion Detection","server":"4a63ddf5.8fd424","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.livingroom_4_in_1_sensor_7","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":140,"y":40,"wires":[["b9171d40.e80e8"],["2544066e.4aee1a"]]},{"id":"2544066e.4aee1a","type":"time-range-switch","z":"40023292.3ec94c","name":"","lat":"39.325159","lon":"-88.127590","startTime":"sunset","endTime":"01:30","startOffset":"-62","endOffset":0,"x":140,"y":200,"wires":[[],["2c33e34f42c1b7a3"]]},{"id":"b9171d40.e80e8","type":"api-current-state","z":"40023292.3ec94c","name":"","server":"4a63ddf5.8fd424","version":3,"outputs":2,"halt_if":"40","halt_if_type":"num","halt_if_compare":"lte","entity_id":"sensor.livingroom_light_sen_9","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":510,"y":40,"wires":[["feec1db9c280fe67"],[]]},{"id":"8afc214d0a4de52e","type":"switch","z":"40023292.3ec94c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":380,"wires":[["38bba1ec.290e0e","62d37c09.668a14"],["44b4db6.a677324","dc99f138.5e14f"]]},{"id":"787ea99ce1789c12","type":"api-call-service","z":"40023292.3ec94c","name":"Turn On Livingroom Tree","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.livingroom_tree_socket_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":540,"wires":[[]]},{"id":"2a9aadc36a9977a4","type":"api-call-service","z":"40023292.3ec94c","name":"Turn Off Livingroom Tree","server":"4a63ddf5.8fd424","version":5,"debugenabled":true,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.livingroom_tree_socket_1"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":680,"wires":[[]]},{"id":"f0abb65263cb96bf","type":"api-call-service","z":"40023292.3ec94c","name":"Turn On Sunroom Tree","server":"4a63ddf5.8fd424","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.angie_light"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":600,"wires":[[]]},{"id":"659248f6b1a9c35f","type":"api-call-service","z":"40023292.3ec94c","name":"Turn Off Sunroom Tree","server":"4a63ddf5.8fd424","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.angie_light"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":740,"wires":[[]]},{"id":"2f0c666cf0b9039b","type":"switch","z":"40023292.3ec94c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":640,"wires":[["787ea99ce1789c12","f0abb65263cb96bf"],["2a9aadc36a9977a4","659248f6b1a9c35f"]]},{"id":"29ee63fc48bd449e","type":"api-current-state","z":"40023292.3ec94c","name":"Jeff Light On","server":"4a63ddf5.8fd424","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.jeff_light_socket_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entity"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":200,"wires":[["44b4db6.a677324"],[]]},{"id":"feec1db9c280fe67","type":"api-current-state","z":"40023292.3ec94c","name":"Jeff Light Off","server":"4a63ddf5.8fd424","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"switch.jeff_light_socket_1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":120,"wires":[["38bba1ec.290e0e"],[]]},{"id":"2c33e34f42c1b7a3","type":"trigger","z":"40023292.3ec94c","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"min","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":370,"y":200,"wires":[["29ee63fc48bd449e"]]},{"id":"4a63ddf5.8fd424","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"},{"id":"456659de.370498","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]

I did import your flow but it's nearly all nodes that I don't have (Home Assistant?).

Anyway, I think you may just need to tick "Extend delay if new message arrives" in your Trigger node.

You might want to watch these videos on HA and Node Red

Also your flows are a little convoluted - can you explain what you are trying to achieve ?

For instance you are using the Current State node - but testing for a percentage level (presumably for a dimmer) - pretty sure that the entity will nto be correct to return the current dimming level (in the videos he covers dimming levels as well)

I would also suggest you put in some debug nodes and name them - then post up screen shots so we can see what info is being returned in your flows when they are triggered

Craig

I did away with the trigger and put the time delay in the Events: State and its working like it did before the Stop Timer was removed in the upgrades.

The video helped a lot. Thanks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.