I have a flow that processes my Acurite temperature/humidity sensors sent from rtl_433 via MQTT. One of the fields the sensor provides is a battery_ok value which is 1 when normal and returns 0 when it drops below a predefined threshold.
I have some code that I thought would work but today when this sensor transitioned from 1 to 0 I ended up getting dozens of emails. I am assuming that's because it wasn't a clean transition from 1 to 0. I'd appreciate any recommendations that could be provided.
This is the battery notification section less the email generation itself.
[{"id":"95956d64.1c802","type":"switch","z":"b76701c5.7313f","name":"","property":"payload.battery_ok","propertyType":"msg","rules":[{"t":"lt","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1110,"y":260,"wires":[["47cfdca2.e40a04","9eee43be.5f0678"]]},{"id":"47061126.bf4668","type":"comment","z":"b76701c5.7313f","name":"battery notification","info":"","x":850,"y":220,"wires":[]},{"id":"f6e008da.ac0fc","type":"change","z":"b76701c5.7313f","name":"","rules":[{"t":"delete","p":"payload.time","pt":"msg"},{"t":"delete","p":"payload.tempF","pt":"msg"},{"t":"delete","p":"payload.temperature_C","pt":"msg"},{"t":"delete","p":"payload.humidity","pt":"msg"},{"t":"delete","p":"payload.moisture","pt":"msg"},{"t":"delete","p":"payload.moisture_offset","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":260,"wires":[["88ceb81.c18a1c8"]]},{"id":"88ceb81.c18a1c8","type":"rbe","z":"b76701c5.7313f","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload.battery_ok","x":990,"y":260,"wires":[["95956d64.1c802"]]}]