i am using the raspberry pi camera, which is already integrated in openhab. Now I would like the camera image to be transferred to my mobile phone or tablet as soon as a button (e.g. bell) is pressed.
var Timer CamFrontDoorbellSnapshotDelay = null
rule "sound doorbell and initiate image"
when
Item Doorbell changed to ON
then
//code for activating doorbell, removed
CamFrontDoorbellSnapshot.sendCommand(ON)
end
rule "send door image"
when
Item CamFrontDoorbellSnapshot changed to ON
then
CamFrontDoorbellSnapshotDelay = createTimer(now.plusSeconds(1)) [ |
sendPushoverMessage(pushoverBuilder("Doorbell").withAttachment("/mnt/rpi0wpicam/lastsnap.jpg"))
]
end
I gave the action a little delay so the image gets saved to disk, don’t know it it is necessary. Did not try it without the delay.
Note you will need the full path here to the image: "/mnt/rpi0wpicam/lastsnap.jpg"
Sorry, forgot to mention: you need to install the http binding.
Also you need something to switch it to OFF again: either through a rule or via expire binding in my case.
Correct that is the way I would do it only using the ipcamera binding instead of http, this would then allow you to send not only a jpg but also a moving GIF using pushover or MP4 using telegram. If the motion software gives you a RTSP or http based URL for h264 video, you can then also cast the camera to your Chromecast and home hub devices. More flexible and the readme for the binding will give examples on how to do all the above.
Correct. I did this while using PiCam’s, now I switched to Dahua cameras and am using @matt1’s ip camera binding.
If you are going the motion software way just shout and I can give you some more items examples.