I'm trying to make my xiaomi temperature sensor detect if I'm taking a shower or not. It's this one: https://gloimg.gbtcdn.com/soa/gb/pdm-product-pic/Electronic/2018/10/24/goods_img_big-v5/20181024111421_98590.jpg
I'm using this with zigbee2mqtt. I also use this with a xiaomi motion detector, but that part already works.
Now when I take a shower, it will report that the humidity increased. After taking taking the shower, it will detect that the humidity has dropped.
So my plan would be, to detect when the humidity makes a steep increase. And this will make the bathroom occupied. And when it drops a certain amount it will make the the bathroom unoccupied.
I tried the RBE node, but this will detect increased and decreased values at the same time. Also tried the edge trigger node, but that only works with fixed values.
Here's my flow so far. It detects when someone has occupied the bathroom, but when the humidity drops, it says occupied and unoccupied at the same time.
[{"id":"89e3d052.09eec","type":"mqtt in","z":"d11dfeaa.8b609","name":"","topic":"zigbee2mqtt/Temperatuur_badkamer","qos":"2","datatype":"json","broker":"7a291092.162ac","x":1860,"y":480,"wires":[["47b9e919.17f118","5a111ba0.403ec4","19cbe94e.c0bf17"]]},{"id":"47b9e919.17f118","type":"switch","z":"d11dfeaa.8b609","name":"Badkamer NIET bezet","property":"badkamer","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":2240,"y":460,"wires":[["c7f62777.eee2c8","13a5a2af.2095fd"]]},{"id":"5a111ba0.403ec4","type":"switch","z":"d11dfeaa.8b609","name":"Badkamer WEL bezet","property":"badkamer","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":2240,"y":500,"wires":[["f8edeff9.3865b","d7b28c61.dea8c"]]},{"id":"c7f62777.eee2c8","type":"rbe","z":"d11dfeaa.8b609","name":"Humidity is omhoog gegaan?","func":"deadband","gap":"4","start":"","inout":"out","property":"payload.humidity","x":2480,"y":460,"wires":[["6d83af79.a6d9c","897f0b9c.f47608","2ecb53be.996d7c"]]},{"id":"f8edeff9.3865b","type":"switch","z":"d11dfeaa.8b609","name":"Humidity is omlaag gegaan?","property":"payload.humidity","propertyType":"msg","rules":[{"t":"lt","v":"humidity","vt":"global"}],"checkall":"true","repair":false,"outputs":1,"x":2480,"y":500,"wires":[["3bd82e6.8dfabd2","a3a28ecd.85ba5"]]},{"id":"3bd82e6.8dfabd2","type":"change","z":"d11dfeaa.8b609","name":"Set global.badkamer FALSE","rules":[{"t":"set","p":"badkamer","pt":"global","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2740,"y":500,"wires":[["902e076a.2282d8"]]},{"id":"ad4d8e45.e3381","type":"inject","z":"d11dfeaa.8b609","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":2530,"y":540,"wires":[["3bd82e6.8dfabd2"]]},{"id":"897f0b9c.f47608","type":"change","z":"d11dfeaa.8b609","name":"Set global.badkamer TRUE","rules":[{"t":"set","p":"badkamer","pt":"global","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2740,"y":460,"wires":[["fd019e56.66633"]]},{"id":"2ecb53be.996d7c","type":"change","z":"d11dfeaa.8b609","name":"","rules":[{"t":"move","p":"payload.humidity","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3060,"y":360,"wires":[["eb7a0d27.f408d","16e2cb00.86cdf5"]]},{"id":"eb7a0d27.f408d","type":"change","z":"d11dfeaa.8b609","name":"","rules":[{"t":"set","p":"humidity","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3290,"y":380,"wires":[["c13d658c.45f8a8"]]},{"id":"7a291092.162ac","type":"mqtt-broker","z":"","name":"MQTT","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]