Hi all,
This flow is working, but it feels like there's a simpler way of doing it with nodes (i.e. not a function).
I've singled out the payload as the rbe node does not work otherwise, as the payload is constantly changing due to other values such as link value, battery. etc.
Any suggestions?
[{"id":"d91206ee.43a908","type":"comment","z":"bd52b987.d668e8","name":"true = leak, false = ok","info":"","x":790,"y":4140,"wires":[]},{"id":"93e5dfee.18da9","type":"switch","z":"bd52b987.d668e8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":770,"y":4190,"wires":[["d4262d3d.cf7c9"],["88e53516.9ca5d8"]]},{"id":"d4262d3d.cf7c9","type":"moment","z":"bd52b987.d668e8","name":"Timestamp & true","topic":"","input":"payload.fake","inputType":"msg","inTz":"Europe/London","adjAmount":0,"adjType":"days","adjDir":"add","format":"dddd DD/MM/YY HH:mm - [Water leak detected in garage]","locale":"en_GB","output":"","outputType":"msg","outTz":"Europe/London","x":1010,"y":4180,"wires":[["1f585a9a.c7d095"]]},{"id":"27a264c1.9bc91c","type":"comment","z":"bd52b987.d668e8","name":"rate limiter","info":"","x":620,"y":4140,"wires":[]},{"id":"245595b0.7ef59a","type":"rbe","z":"bd52b987.d668e8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":620,"y":4190,"wires":[["93e5dfee.18da9"]]},{"id":"88e53516.9ca5d8","type":"moment","z":"bd52b987.d668e8","name":"Timestamp & false","topic":"","input":"payload.fake","inputType":"msg","inTz":"Europe/London","adjAmount":0,"adjType":"days","adjDir":"add","format":"dddd DD/MM/YY HH:mm - [Garage is dry - no water detected]","locale":"en_GB","output":"","outputType":"msg","outTz":"Europe/London","x":1010,"y":4220,"wires":[["1f585a9a.c7d095"]]},{"id":"ede08082.b30c","type":"comment","z":"bd52b987.d668e8","name":"Add timestamp and message","info":"","x":1020,"y":4140,"wires":[]},{"id":"b90cafb8.59447","type":"change","z":"bd52b987.d668e8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.water_leak","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":4190,"wires":[["245595b0.7ef59a"]]},{"id":"79fff1d5.d4027","type":"inject","z":"bd52b987.d668e8","name":"Test water sensor - FALSE","topic":"zigbee2mqtt/test","payload":"{\"battery\":100,\"battery_low\":false,\"linkquality\":94,\"tamper\":false,\"voltage\":3025,\"water_leak\":false}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":4170,"wires":[["b90cafb8.59447"]]},{"id":"1f585a9a.c7d095","type":"debug","z":"bd52b987.d668e8","name":"Debug - notification","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1250,"y":4190,"wires":[]},{"id":"166f441f.6ac55c","type":"inject","z":"bd52b987.d668e8","name":"Test water sensor - TRUE","topic":"zigbee2mqtt/test","payload":"{\"battery\":100,\"battery_low\":false,\"linkquality\":94,\"tamper\":false,\"voltage\":3025,\"water_leak\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":4210,"wires":[["b90cafb8.59447"]]},{"id":"76d4dde5.0e69c4","type":"comment","z":"bd52b987.d668e8","name":"Single out payload","info":"","x":440,"y":4140,"wires":[]},{"id":"b83ea8b4.c7ea58","type":"comment","z":"bd52b987.d668e8","name":"Xiaomi water leak sensor","info":"","x":180,"y":4130,"wires":[]}]