When doorbell press then image from camera to android

can anyone guide me how to make an automation in which when i press the doorbell button then my door camera captures picture and gives a notification in my android mobile with that image and a sound .?

is that possible how ?

like in this example a notification in media player but i want in android.

# This automation triggers when the doorbell button is pushed
# and out the front door camera stream to the tv.
#
automation:
  - alias: "Doorbell Camera"
    trigger:
      platform: state
      entity_id: binary_sensor.doorbell_button
      to: 'on'
    action:
      - service: camera.play_stream
        data:
          entity_id: camera.front_door
          media_player: media_player.living_room_tv

Hello look here: Scroll down to “Photo support”. Maybe this will help you…
An output of the sound is not possible…


An alternative would perhaps be the “tinyCam” app in conjunction with the “Tasker” app on the smartphone …

I actually just implemented something like this (although mine is triggered by a motion sensor), but in kind of a “brute force” way. But it works. :slightly_smiling_face:

It’s actually a bit more involved, but the basic steps are:

  • Use the camera.snapshot service to write a snapshot to a file.
  • Use an SMTP notify service to send an e-maill containing the image to my phone number’s e-mail address. Most cell services have such an e-mail address (e.g., AT&T in the US uses <cell_number>@mms.att.net) that turns the e-mail into an MMS message.

So something like this:

notify:
  - name: mms_phil
    platform: smtp
    sender: !secret notify_snd_email_username
    recipient: !secret notify_phil_mms_address
    server: !secret notify_snd_email_server
    username: !secret notify_snd_email_username
    password: !secret notify_snd_email_password
- service: camera.snapshot
  data:
    entity_id: camera.XXX
    filename: /home/homeassistant/.homeassistant/snapshots/XXX.jpg
- delay: 2
- service: notify.mms_phil
  data:
    title: Doorbell
    message: Someone rang the doorbell.
    data:
      images:
        - /home/homeassistant/.homeassistant/snapshots/XXX.jpg
1 Like

Hi! I use XMPP platform and it works like this:

  - alias: entrance - doorbell
    trigger:
      - platform: state
        entity_id: binary_sensor.door_bell
        to: 'on'
    action:
      - service: xiaomi_aqara.play_ringtone
        data:
          gw_mac: 7C:49:EB:1C:2E:69
          ringtone_id: 10
          ringtone_vol: 10
      - service: camera.snapshot
        data:
          entity_id: camera.front_door
          filename: /config/www/images/front-cam.jpg
      - delay:
          seconds: 2
      - service: homeassistant.turn_on
        entity_id: script.send_pic_door_bell

and the script called is:

send_pic_door_bell:
  alias: Send Pic Front Door
  sequence:
    - service: camera.snapshot
      data:
        entity_id: camera.front_door
        filename: "/config/www/images/front-cam.jpg"
    - delay:
        seconds: 5
    - service: notify.thorsten
      data:
        title: ""
        message: ""
        data:
          url_template: "http://192.168.1.41:8123/local/images/front-cam.jpg"
          verify: false 

Curious, why do you take the snapshot twice?

Now I am wondering too :thinking::joy: I’ll change it …thanks for the hint

1 Like

this is my conf details

camera:
  - platform: mjpeg
    name: cam1
    still_image_url: http://192.168.9.120/cgi-bin/snapshot.cgi?chn=0&u=admin&p=admin
    mjpeg_url: http://192.168.9.120/cgi-bin/sp.cgi?chn=0&u=admin&p=admin&rate=1
  - platform: mjpeg
    name: cam2
    still_image_url: http://192.168.9.120/cgi-bin/snapshot.cgi?chn=1&u=admin&p=admin
    mjpeg_url: http://192.168.9.120/cgi-bin/sp.cgi?chn=1&u=admin&p=admin&rate=1    

now how can i use it to get the image or video from my camera when a doorbell is pressed ?

this is not a generic camera integration , it is this mjpeg setup .

when i try to use
service: camera.play_stream
then it is giving error , is it because of MJPEG camera ? or any solution ?

Have you just tried using the camera.snapshot service, as shown above?

Do you have the stream integration configured?

Camera .snapshot is working but camera.play_stream is not working

Yes streaming link is working and configured with mjpeg.

No, I mean do you have this in your config:

stream:

I’m not asking about how your mjpeg camera is configured.

yes
stream:
is there in config .

this is my camera related config in configuration.yaml


camera:
  - platform: mjpeg
    name: cam1
    still_image_url: http://192.168.9.120/cgi-bin/snapshot.cgi?chn=0&u=admin&p=admin
    mjpeg_url: http://192.168.9.120/cgi-bin/sp.cgi?chn=0&u=admin&p=admin&rate=1
  - platform: mjpeg
    name: cam2
    still_image_url: http://192.168.9.120/cgi-bin/snapshot.cgi?chn=1&u=admin&p=admin
    mjpeg_url: http://192.168.9.120/cgi-bin/sp.cgi?chn=1&u=admin&p=admin&rate=1    
    
#    http://192.168.9.120/cgi-bin/sp.cgi?chn=0&u=admin&p=admin&rate=1  -our nvr camera video link

stream:
   
ffmpeg:

Ok. Well, I just took a deeper look at the mjpeg camera platform code, and sure enough, it doesn’t support playing a stream. Hence the error you saw.

Is there any way to get your cameras to work with a different camera platform? There are several other somewhat generic types you might try that do support playing a stream.

i was also think this could be the isue ,
now i am trying to configure zoneminder

I just took a quick look at the zoneminder camera platform code. It doesn’t appear to support playing streams either.

Any way you can get it to work with ffmpeg, generic or onvif? Those all support it.