Hi,
I have the following flow:
[{"id":"8fa5f04a.f6ab3","type":"mqtt in","z":"d11dfeaa.8b609","name":"Motion bijkamer","topic":"zigbee2mqtt/Bewegingsmelder_bijkamer","qos":"2","broker":"7a291092.162ac","x":1240,"y":1820,"wires":[["1dc32f82.4faf7"]]},{"id":"16f771ab.f7b76e","type":"mqtt out","z":"d11dfeaa.8b609","name":"Bijkamer lamp","topic":"zigbee2mqtt/Lamp_bijkamer/set","qos":"","retain":"","broker":"7a291092.162ac","x":1980,"y":2000,"wires":[]},{"id":"7e36cfcf.49ce3","type":"change","z":"d11dfeaa.8b609","name":"Zet aan (255)","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"ON\",\"brightness\":255}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":1840,"wires":[["16f771ab.f7b76e"]]},{"id":"3326c0b8.9b6e9","type":"change","z":"d11dfeaa.8b609","name":"Zet uit","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"ON\",\"brightness\":0,\"transition\":20}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1730,"y":2000,"wires":[["16f771ab.f7b76e"]]},{"id":"149746b3.fa4749","type":"switch","z":"d11dfeaa.8b609","name":"","property":"payload.occupancy","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":1570,"y":1860,"wires":[["7e36cfcf.49ce3"],["3326c0b8.9b6e9"]]},{"id":"62f2f1cf.96447","type":"switch","z":"d11dfeaa.8b609","name":"Lux","property":"payload.illuminance","propertyType":"msg","rules":[{"t":"gt","v":"20","vt":"str"},{"t":"btwn","v":"11","vt":"str","v2":"20","v2t":"str"},{"t":"btwn","v":"5","vt":"str","v2":"10","v2t":"str"},{"t":"lt","v":"5","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":1370,"y":2020,"wires":[["3326c0b8.9b6e9"],["e50de4f.eb16218"],["fd05f68f.2e4998"],["149746b3.fa4749"]]},{"id":"d862fdf2.b403a","type":"change","z":"d11dfeaa.8b609","name":"Zet aan (150)","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"ON\",\"brightness\":150}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":1900,"wires":[["16f771ab.f7b76e"]]},{"id":"fd05f68f.2e4998","type":"switch","z":"d11dfeaa.8b609","name":"","property":"payload.occupancy","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":1570,"y":1920,"wires":[["d862fdf2.b403a"],["3326c0b8.9b6e9"]]},{"id":"d4298fe2.c9029","type":"change","z":"d11dfeaa.8b609","name":"Zet aan (100)","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"state\":\"ON\",\"brightness\":100}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1750,"y":1960,"wires":[["16f771ab.f7b76e"]]},{"id":"e50de4f.eb16218","type":"switch","z":"d11dfeaa.8b609","name":"","property":"payload.occupancy","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":1570,"y":1980,"wires":[["d4298fe2.c9029"],["3326c0b8.9b6e9"]]},{"id":"d3252612.e50fd8","type":"time-range-switch","z":"d11dfeaa.8b609","name":"","lat":"","lon":"","startTime":"sunrise","endTime":"sunset","startOffset":0,"endOffset":"-60","x":1240,"y":1940,"wires":[["5e1a1122.9ae57"],["149746b3.fa4749"]]},{"id":"1dc32f82.4faf7","type":"json","z":"d11dfeaa.8b609","name":"","property":"payload","action":"","pretty":false,"x":1270,"y":1880,"wires":[["d3252612.e50fd8"]]},{"id":"5e1a1122.9ae57","type":"rbe","z":"d11dfeaa.8b609","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.occupancy","x":1230,"y":2020,"wires":[["62f2f1cf.96447"]]},{"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":""}]
It switches on/off the light in a room by motion. I use the xiaomi human body sensor and an ikea light with zigbee2mqtt to achieve this.
What I want to achieve now is, that when I turn the power off and than back on, within a few seconds, that this will override the motion flow described above. The goal is to keep the light on. And when I do this again, it will return back to the original motion flow.
When I use the original hardwired switch on the wall, it will create a message to: zigbee2mqtt/Lamp_bijkamer/availability. It can be "offline" or "online", depending if the power is switched off or on. So I need to use these messages. But I can't figure out how to do this.
Does anyone now how to do this?