The following flow utilizes a motion sensor to detect when the mailbox is opened. When opened a combination of switch and change nodes is used to determine the current status of the mailbox based on a variable and toggle the variable. If the toggle indicated the mail as delivered a mp3 file is played on a google mini and a 15 minute stop timer is activated which will re-trigger the alert and reset itself. If the toggle indicates the mail is being retrieved it sends a stop command to the timer.
I highly simplified this flow for the post and will post more complicated versions that include time of day trigger preventions (so you dont trigger mail alerts when putting mail out at night) along with text notifications to your phone in a bit…
Flow Copy Paste
[{"id":"460de637.7f30b","type":"tab","label":"Mail Call","disabled":false,"info":""},{"id":"fa134b7.00458b8","type":"device-status","z":"460de637.7f30b","name":"Mail Motion","deviceName":"Mailbox Motion Sensor","bridge":"ddaf8308.850e08","genericMqttDevice":false,"device":"","x":90,"y":220,"wires":[["15a3ca1c.4df44e"]]},{"id":"15a3ca1c.4df44e","type":"switch","z":"460de637.7f30b","name":"Activated","property":"payload.occupancy","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":280,"y":220,"wires":[["cff6383f.8273c"]]},{"id":"cff6383f.8273c","type":"change","z":"460de637.7f30b","name":"Check Status","rules":[{"t":"set","p":"payload","pt":"msg","to":"#:(file)::mail","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":220,"wires":[["71fc1b91.578664"]]},{"id":"71fc1b91.578664","type":"switch","z":"460de637.7f30b","name":"status","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"retrieved","vt":"str"},{"t":"eq","v":"delivered","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":220,"wires":[["d652d67a.8e5cb8"],["7e14518a.3854f8"]]},{"id":"2ae3a93.efde356","type":"change","z":"460de637.7f30b","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":260,"wires":[["4a3033af.9dc314"]]},{"id":"4a3033af.9dc314","type":"stoptimer2","z":"460de637.7f30b","duration":"15","durationType":"num","units":"Minute","payloadtype":"str","payloadval":"0","name":"","x":1420,"y":240,"wires":[["2b4a2e3f.087402","9b40712c.9fc52"],[]]},{"id":"d652d67a.8e5cb8","type":"change","z":"460de637.7f30b","name":"Set delivered","rules":[{"t":"delete","p":"#:(file)::mail","pt":"flow"},{"t":"set","p":"payload","pt":"msg","to":"delivered","tot":"str"},{"t":"set","p":"#:(file)::mail","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":200,"wires":[["4a3033af.9dc314","9b40712c.9fc52"]]},{"id":"7e14518a.3854f8","type":"change","z":"460de637.7f30b","name":"Set Retrieved","rules":[{"t":"delete","p":"#:(file)::mail","pt":"flow"},{"t":"set","p":"payload","pt":"msg","to":"retrieved","tot":"str"},{"t":"set","p":"#:(file)::mail","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":240,"wires":[["2ae3a93.efde356"]]},{"id":"2b4a2e3f.087402","type":"delay","z":"460de637.7f30b","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1340,"y":160,"wires":[["4a3033af.9dc314"]]},{"id":"4fcab398.fc391c","type":"cast-to-client","z":"460de637.7f30b","name":"Got Mail","url":"http://192.168.0.9:1880/files/gotmail.mp3","contentType":"","message":"","language":"en","ip":"192.168.24.28","port":"32000","volume":"50","x":1460,"y":40,"wires":[[]]},{"id":"9b40712c.9fc52","type":"change","z":"460de637.7f30b","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"devicename","pt":"msg"},{"t":"delete","p":"device","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":140,"wires":[["4fcab398.fc391c"]]},{"id":"ddaf8308.850e08","type":"zigbee2mqtt-bridge-config","name":"Pi","broker":"bccbde70.b7c568","baseTopic":"zigbee2mqtt","enabledLogging":false,"allowDeviceStatusRefresh":true},{"id":"bccbde70.b7c568","type":"mqtt-broker","name":"Pi","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]