Trigger and block node - not blocking anymore?

Hey all, I have a flow here that announces if the outdoor air quality goes above a certain threshold, it will warn us and then when it goes below the threshold, it tells us its safe (rather than announcing it every time the value is over the threshold). Its on a 10 minute timer, which checks the trigger and block node, and sends a reset message if the levels are back below the threshold.

It was working well, but over time, at some point (probably from an update), something happened, now it announces every time the sensor updates, and its over the threshold. Its like the “trigger and block” node is not blocking anymore.

If anyone has sometime to look at my flow, I would be greatly appreciated! thanks

image

and flow below

Flow

[{"id":"409a05f427fb05b3","type":"switch","z":"aaeb4e984950aca8","name":"32 and Over","property":"PM25EOut_reading","propertyType":"msg","rules":[{"t":"gte","v":"32","vt":"num"}],"checkall":"false","repair":false,"outputs":1,"x":670,"y":3100,"wires":[["b1f6816d12fa3c8b"]]},{"id":"fe1cd54f05747d9c","type":"api-current-state","z":"aaeb4e984950aca8","name":"PM25 < 32","server":"f11241dc.5364d","version":3,"outputs":2,"halt_if":"32","halt_if_type":"num","halt_if_compare":"lt","entity_id":"{{data.entity_id}}","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"PM25EOut_reading","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":1130,"y":3100,"wires":[["b95a86e160c10f40","8aef9d8ff899578f"],["0b7b4915d500b267"]]},{"id":"0b7b4915d500b267","type":"delay","z":"aaeb4e984950aca8","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"minutes","rate":"1","nbRateUnits":"30","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":1150,"y":3180,"wires":[["fe1cd54f05747d9c"]]},{"id":"b1f6816d12fa3c8b","type":"trigger","z":"aaeb4e984950aca8","name":"","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"0","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"topic","topic":"topic","outputs":1,"x":880,"y":3100,"wires":[["fe1cd54f05747d9c","788554ed6485ef09"]]},{"id":"b95a86e160c10f40","type":"change","z":"aaeb4e984950aca8","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"yes","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":3020,"wires":[["b1f6816d12fa3c8b"]]},{"id":"a1ae6501dfd9904e","type":"server-state-changed","z":"aaeb4e984950aca8","name":"Outdoor PM 2.5 Levels","server":"f11241dc.5364d","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.pm25_ch1","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"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":200,"y":3100,"wires":[["1cdf2ed7f9bee415"]]},{"id":"1cdf2ed7f9bee415","type":"change","z":"aaeb4e984950aca8","name":"Set PM2.5 and topic","rules":[{"t":"set","p":"PM25EOut_reading","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Outdoor PM25","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":3100,"wires":[["409a05f427fb05b3"]]},{"id":"788554ed6485ef09","type":"function","z":"aaeb4e984950aca8","name":"","func":"msg.payload = \"Warning! \" + msg.topic + \" Particulate Matter levels are at \" + msg.PM25EOut_reading + \" ug/m3!\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1140,"y":3240,"wires":[["ada67a356463ed4f","f749597b7cd9f94c","5c8bcf55b740f23d"]]},{"id":"8aef9d8ff899578f","type":"function","z":"aaeb4e984950aca8","name":"","func":"msg.payload = msg.topic + \" Particulate Matter levels are now safe.\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1400,"y":3100,"wires":[["30c7b1749d787c68","b6e3891b10bb6b45","28e71049cc02e8a7"]]},{"id":"f749597b7cd9f94c","type":"time-range-switch","z":"aaeb4e984950aca8","name":"Time Range","lat":"53.42167","lon":"-113.63615","startTime":"7:00","endTime":"20:00","startOffset":0,"endOffset":0,"x":1230,"y":3440,"wires":[["51eeabcbcb880fe0","2a350ec717e5868c","26dbb04dd2138c7c","e2110250aab5d7b2"],[]]},{"id":"b6e3891b10bb6b45","type":"time-range-switch","z":"aaeb4e984950aca8","name":"Time Range","lat":"53.42167","lon":"-113.63615","startTime":"7:00","endTime":"20:00","startOffset":0,"endOffset":0,"x":1430,"y":3220,"wires":[["2c8f2d4df8c0d177","67e6c93034dd2604","737df71186f06803"],[]]},{"id":"28e71049cc02e8a7","type":"api-call-service","z":"aaeb4e984950aca8","name":"Notify Me Sony Xperia Phone","server":"f11241dc.5364d","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_sony_xperia_zx1","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1660,"y":3040,"wires":[[]]},{"id":"30c7b1749d787c68","type":"debug","z":"aaeb4e984950aca8","name":"Safe Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1620,"y":3100,"wires":[]},{"id":"2c8f2d4df8c0d177","type":"google-notify","z":"aaeb4e984950aca8","server":"d17211f08fb61d4c","label":"Family Room Display Broadcast","playVolumeLevel":"60","language":"config","speakSlow":"false","mediaUrl":"","mediaType":"mp3","x":1710,"y":3140,"wires":[[]]},{"id":"5c8bcf55b740f23d","type":"api-call-service","z":"aaeb4e984950aca8","name":"Notify Me Sony Xperia Phone","server":"f11241dc.5364d","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_sony_xperia_zx1","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1670,"y":3320,"wires":[[]]},{"id":"ada67a356463ed4f","type":"debug","z":"aaeb4e984950aca8","name":"Danger Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1630,"y":3380,"wires":[]},{"id":"51eeabcbcb880fe0","type":"google-notify","z":"aaeb4e984950aca8","server":"d17211f08fb61d4c","label":"Family Room Display Broadcast","playVolumeLevel":"60","language":"config","speakSlow":"false","mediaUrl":"","mediaType":"mp3","x":1670,"y":3420,"wires":[[]]},{"id":"f11241dc.5364d","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":"d17211f08fb61d4c","type":"google-notify-config","ipaddress":"192.168.1.133","name":"Family Room Display","language":"en","playVolumeLevel":"20","speakSlow":true,"mediaServerUrl":"","mediaServerPort":"8098","cacheFolder":"/tmp"}]

I’ve made some progress on trying to understand my problem here.

Watching the flows as they work, I noticed that the starting node (sensor) node switches from

solid green dot with a numeric state

and sometimes it switches to:

a green ring with the word “running”

its like my flows are getting reset, without and intervention such as (re)deployment.

During this “reconnect to HA”, all my times and trigger blocks are reset and hence it constantly does not block the new trigger, because it does not know what it was…i think?

So, I’m wondering how this even happens and how to prevent this?

should I select a few options below to ignore certain state changes?

I don’t know if it will help in your situation, but I use gate nodes to do similar things.

Thanks! That’s a great suggestion.

As for why my original flow is not working, I’m actually going to submit a Github issue for this. Turns out the timers should survive upon disconnects of the sensor as long as NR does not get restarted.

It’s just strange that my flow works sometimes especially after restart of NR and then eventually stops working, I.e. the block node stops blocking.