I got it up and running in my Openhab setup using Node-red to handle the rules and inject images from my zoneminder server to finally send out a pushover message with attachment. For those interested…
Proof of working:
A basic description of my rule flow:
-
Openhab item Doorbell receives an update when doorbell is pressed
-
Node Red monitors the Openhab Doorbell item for updates. if an update is registered the state of the update is checked for the ON state.
-
If doorbell state is ON, we rate limit the amount of doorbell presses to 1 every 10 seconds . this allows all Doorbell automation to run correctly and also prevents people from molesting my doorbell.
-
as a result of pressing the doorbell…
-
Node Red plays doorbell.mp3 using Openhabs default audio sink (whole house SONOS)
-
Node Red flashes the alert channel of the Hue lighting through Openhab
-
Node Red writes a log entry in Openhab.log (Doorbell rang @ timestamp)
-
Node Red updates the Missed_doorbell_notification item is use for visual presentation in Habpanel
-
Node Red sets the doorbell notification text (openhab string item vPushover) to" there is someone at the door"
-
Node Red sets the doorbell notification sound (openhab string item vPushoverSound) to" gamelan"
-
Node Red sets the doorbell notification image (openhab string item vPushoverImage) to"/home/openhab/camera.jpg" after grabbing a fresh image from Zoneminder using http request.
-
the nodered.rules files is triggered based upon an update of vPushover and a message is sent through pushover.
The actual Node-red flow:
[{"id":"87f3ff46.cc45","type":"comment","z":"5445dc5f.c79e24","name":"Doorbell pressed - play doorbell sound through SONOS","info":"Test","x":220,"y":40,"wires":[]},{"id":"ed6d3ad0.8fd4e8","type":"openhab2-in","z":"5445dc5f.c79e24","name":"Doorbell","controller":"be8b0821.df18b8","itemname":"Doorbell","x":80,"y":100,"wires":[[],["e8bdfc9f.7fbd9"]]},{"id":"e8bdfc9f.7fbd9","type":"switch","z":"5445dc5f.c79e24","name":"Item Updated","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"ItemStateEvent","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":260,"y":100,"wires":[["1dd131ad.bb0e9e"]]},{"id":"1dd131ad.bb0e9e","type":"switch","z":"5445dc5f.c79e24","name":"Evaluate Doorbell","property":"payload.payload.value","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":100,"wires":[["1e99fe3.f0ae402"]]},{"id":"80308549.790458","type":"change","z":"5445dc5f.c79e24","name":"Send Doorbell.mp3","rules":[{"t":"set","p":"payload","pt":"msg","to":"doorbell.mp3","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":100,"wires":[["11fb9b37.f053f5"]]},{"id":"11fb9b37.f053f5","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vSound","controller":"be8b0821.df18b8","itemname":"vSound","topic":"ItemUpdate","payload":"","x":1120,"y":100,"wires":[]},{"id":"1e99fe3.f0ae402","type":"delay","z":"5445dc5f.c79e24","name":"Rate Limite 1msg per 10s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":710,"y":100,"wires":[["80308549.790458","8eeb319f.bd7d8","7f0acf61.b468d","2ea210a4.6f1ef","3ff78d87.074e02"]]},{"id":"68ea1491.60c20c","type":"openhab2-out","z":"5445dc5f.c79e24","name":"gHueAlert","controller":"be8b0821.df18b8","itemname":"gHueAllAlert","topic":"ItemCommand","payload":"","x":1120,"y":140,"wires":[]},{"id":"8eeb319f.bd7d8","type":"change","z":"5445dc5f.c79e24","name":"Send Alert","rules":[{"t":"set","p":"payload","pt":"msg","to":"SELECT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":140,"wires":[["68ea1491.60c20c"]]},{"id":"7f0acf61.b468d","type":"change","z":"5445dc5f.c79e24","name":"Send ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":200,"wires":[["48a7a77f.53b658"]]},{"id":"48a7a77f.53b658","type":"openhab2-out","z":"5445dc5f.c79e24","name":"HabPanelNotification_Missed_Doorbell","controller":"be8b0821.df18b8","itemname":"HabPanelNotification_Missed_Doorbell","topic":"ItemCommand","payload":"","x":1220,"y":200,"wires":[]},{"id":"2ea210a4.6f1ef","type":"change","z":"5445dc5f.c79e24","name":"Create Log Entry","rules":[{"t":"set","p":"payload","pt":"msg","to":"Doorbell rang","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":260,"wires":[["8b14e806.dc0038"]]},{"id":"8b14e806.dc0038","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vLog","controller":"be8b0821.df18b8","itemname":"vLog","topic":"ItemUpdate","payload":"","x":1110,"y":260,"wires":[]},{"id":"3ff78d87.074e02","type":"http request","z":"5445dc5f.c79e24","name":"Front Door Camera","method":"GET","ret":"bin","url":"http://172.16.11.8/zm/cgi-bin/nph-zms?mode=single&monitor=1&scale=100&rand=1526327141","tls":"","x":950,"y":320,"wires":[["c5ec73ee.10da5","d7693e60.83604","abce55af.de82e8","be86d34d.6d8a3"]]},{"id":"c5ec73ee.10da5","type":"file","z":"5445dc5f.c79e24","name":"Save Camera Snapshot","filename":"/home/openhab/camera.jpg","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1230,"y":320,"wires":[]},{"id":"48b55371.89f1bc","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover Image","controller":"be8b0821.df18b8","itemname":"vPushoverImage","topic":"ItemUpdate","payload":"","x":1210,"y":380,"wires":[]},{"id":"d7693e60.83604","type":"change","z":"5445dc5f.c79e24","name":"Set Pushover Image","rules":[{"t":"set","p":"payload","pt":"msg","to":"/home/openhab/camera.jpg","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":380,"wires":[["48b55371.89f1bc"]]},{"id":"abce55af.de82e8","type":"delay","z":"5445dc5f.c79e24","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":460,"wires":[["9eb30e6a.5e43"]]},{"id":"9eb30e6a.5e43","type":"change","z":"5445dc5f.c79e24","name":"Set Pushover Image","rules":[{"t":"set","p":"payload","pt":"msg","to":"Er staat iemand aan de deur!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":460,"wires":[["f3459409.054f98","d86b137d.a3827"]]},{"id":"f3459409.054f98","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover","controller":"be8b0821.df18b8","itemname":"vPushover","topic":"ItemUpdate","payload":"","x":1290,"y":460,"wires":[]},{"id":"be86d34d.6d8a3","type":"change","z":"5445dc5f.c79e24","name":"Set Pushover Sound","rules":[{"t":"set","p":"payload","pt":"msg","to":"gamelan","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":420,"wires":[["10637063.a04d7"]]},{"id":"10637063.a04d7","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover Sound","controller":"be8b0821.df18b8","itemname":"vPushoverSound","topic":"ItemUpdate","payload":"","x":1210,"y":420,"wires":[]},{"id":"9825142.280f6e8","type":"openhab2-out","z":"5445dc5f.c79e24","name":"vPushover Image","controller":"be8b0821.df18b8","itemname":"vPushoverImage","topic":"ItemUpdate","payload":"","x":1310,"y":520,"wires":[]},{"id":"bdb00579.d7b048","type":"change","z":"5445dc5f.c79e24","name":"Reset Pushover Image","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":520,"wires":[["9825142.280f6e8"]]},{"id":"d86b137d.a3827","type":"delay","z":"5445dc5f.c79e24","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":920,"y":520,"wires":[["bdb00579.d7b048"]]},{"id":"be8b0821.df18b8","type":"openhab2-controller","z":"","name":"Openhab2 - Prod","protocol":"http","host":"localhost","port":"8080","path":"","username":"","password":""}]
My nodered.rules and item file:
rule "Nodered vPushover"
when
Item vPushover received update
then
sendPushoverMessage(pushoverBuilder("" + vPushover.state.toString + "").withApiKey("YOURAPIKEYGOESHERE").withUser("YOURUSERKEYGOESHERE").withPriority(0).withSound(""+ vPushoverSound.state.toString +"").withAttachment(""+ vPushoverImage.state.toString +""))
end
String vNotification "Notification [%s]"
String vPushover "Pushover [%s]"
String vSound "Sound [%s]"
String vSpeech "Speech [%s]"
String vPushoverImage "Pushover Image [%s]"
String vPushoverSound "Pushover Sound [%s]"
Feel free to try it out!