I have created a flow in NR with the purpose of toggling a helper Boolean to indicate if my wife or I are home. The boolean uses an mqtt stream from my wireless network that sends updates every 10 seconds when each of our phones are seen by the network. This means we are home or the boolean is “on”.
In the flow I am trying to use a timer node that is set to 30 seconds so that if the mqtt message does not trigger the boolean to on, the timer will turn it to off. Seems simple enough but for some reason the timers are not working correctly, or more likely, I have something configured incorrectly. Seems to be that the timer node is not resetting when a new msg is received as I’d expect it to.
Please let me know what I’m missing here. Have tried a few ways of doing this with no luck.
[{"id":"54b0c9ab4384b63c","type":"tab","label":"Presence Detection","disabled":false,"info":"MQTT stream from Meraki to determine if Jerry or Kelli are home. \n\nMQTT stream every 10 seconds when iphone is seen by the network. Updates input boolean helper to toggle \"on\" state. \n\n30 second timer starts whenever the MQTT messages stop which will then toggle the helper to off. ","env":[]},{"id":"616182ca6cc08c14","type":"mqtt in","z":"54b0c9ab4384b63c","name":"MQTT Subscriber","topic":"mqtt/meraki","qos":"0","datatype":"json","broker":"10f0a1b342022761","nl":false,"rap":true,"rh":0,"inputs":0,"x":100,"y":100,"wires":[["ae87a50a0dc4e7d0"]]},{"id":"d3ae8edabb77286e","type":"debug","z":"54b0c9ab4384b63c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":910,"y":180,"wires":[]},{"id":"ae87a50a0dc4e7d0","type":"switch","z":"54b0c9ab4384b63c","name":"","property":"payload.clientMac","propertyType":"msg","rules":[{"t":"eq","v":"72:8C:CB:EC:27:E7","vt":"str"},{"t":"eq","v":"C2:D3:06:4A:44:25","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":330,"y":100,"wires":[["069a911fbbf06dfc"],["24e0deadcade1f21"]]},{"id":"069a911fbbf06dfc","type":"api-call-service","z":"54b0c9ab4384b63c","name":"","server":"fca0097c.d25db8","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.jerry_home","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"30","valueType":"str"}],"queue":"none","x":640,"y":40,"wires":[["d3ae8edabb77286e","bb82e7914a1f9208"]]},{"id":"51ab2c59843872ae","type":"api-call-service","z":"54b0c9ab4384b63c","name":"","server":"fca0097c.d25db8","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.jerry_home","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":320,"wires":[["d3ae8edabb77286e"]]},{"id":"24e0deadcade1f21","type":"api-call-service","z":"54b0c9ab4384b63c","name":"","server":"fca0097c.d25db8","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_on","entityId":"input_boolean.kelli_home","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"30","valueType":"str"}],"queue":"none","x":620,"y":100,"wires":[["d3ae8edabb77286e","72b3363c11d1b6f4"]]},{"id":"bfd3be0b9ce4d850","type":"api-call-service","z":"54b0c9ab4384b63c","name":"","server":"fca0097c.d25db8","version":3,"debugenabled":false,"service_domain":"input_boolean","service":"turn_off","entityId":"input_boolean.kelli_home","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":640,"y":260,"wires":[["d3ae8edabb77286e"]]},{"id":"bb82e7914a1f9208","type":"stoptimer","z":"54b0c9ab4384b63c","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":330,"y":260,"wires":[["bfd3be0b9ce4d850"],[]]},{"id":"72b3363c11d1b6f4","type":"stoptimer","z":"54b0c9ab4384b63c","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":350,"y":320,"wires":[["51ab2c59843872ae"],[]]},{"id":"10f0a1b342022761","type":"mqtt-broker","name":"","broker":"https://192.168.128.244","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"fca0097c.d25db8","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]