Transferring the camera image to mobile phone

Hello together,

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.

Does anybody have an idea, how that works?

Thanks in advance!

Use a notification service like pushbullet or telegram or even email
These are available to install as actions not bindings

Make a rule:

rule "image to mobile"
when
    Item image changed
then
    //whatever you want to do
end

Thanks for this information.

But how can I select the Pi Camera as transmitter and my mobil phone as receiver?

You seem to have the information about that. Put the image in an Image item

As mentioned before:

unfortunately the item type “image” doesn’t work. Is there another possibility to use the Camera as transmitter? E.g. the URL of the stream?

You are not giving much information regarding integration into openHAB, so I can only guess and give you my solution:

I integrated my PiCam via motion, via http you can get a snapshot from the camera stream:

Switch CamFrontDoorbellSnapshot { http=">[ON:GET:http://192.168.2.230:8080/0/action/snapshot]",expire="1s,command=OFF" }

The jpg is easily transfered via pushover action to my phone when the doorbell is pressed.

sendPushoverMessage(pushoverBuilder("Doorbell").withAttachment("/mnt/rpi0wpicam/lastsnap.jpg"))

Upon PM request:

Switch CamFrontDoorbellSnapshot { http=">[ON:GET:http://192.168.2.230:8080/0/action/snapshot]",expire="1s,command=OFF" }

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"

Do I have to consider something specific when creating the item CamFrontDoorbellSnapshot, except changing the IP-Adress and Localhost?

When i try to create the rules, the error “The method or field CamFrontDoorbellSnapshot is undefined” occurs.

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.

Hello,
I’m just joining this discussion. Could you please explain me how to integrate the Raspberry Pi + Camera in openHab?

Thank’s a lot.

It’s already in your quote: install motion software and use the http binding. Item example is also in your quote.

So I use the http Binding on the Raspberry running openHab, and I install motion on the other Raspberry with the camera?

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.

1 Like

Correct. I did this while using PiCam’s, now I switched to Dahua cameras and am using @matt1’s ip camera binding. :+1:
If you are going the motion software way just shout and I can give you some more items examples.