When door bell rings, show front camera on TV

as of now, i have a snapshot from the front Amcrest camera sent to my Telegram whenever someone rings the doorbell. took many help from everyone here to get it working.
now, im curious if i can get it working whenever i am at home with the Nvidia connected to the TV. so when the doorbell rings, Nvidia Shield will turn on the TV showing a snapshot…or even better a live streaming from the front door camera. is this even possible???

I use Kodi with Plex integration as my home theater app. Kodi supports RTSP streaming and with HA integration to Kodi, Samsung TV and my Ring doorbell - I can open a live RTSP stream from my front door Hikvision IP camera when the door bell rings. Here’s my automation:

- alias: Play front door cam stream on family room tv when doorbell rings
  trigger:
    platform: state
    entity_id: binary_sensor.front_door_ding
    to: 'on'
  condition:
    condition: state
    entity_id: media_player.samsung_un55ks8000
    state: 'on'      
  action:
    service: script.turn_on
    entity_id: script.kodi_play_frontdoor_cam_stream_family_room
kodi_play_frontdoor_cam_stream_family_room:
  alias: Kodi Play FrontDoor Cam Stream Family Room
  sequence:
    - service: kodi.call_method
      data:
        entity_id: media_player.family_room_kodi
        method: Player.Open
        item:
          file: "smb://mediaserver3.my.domain/cams/FrontDoorOut.strm"
        options:
          resume: True        

Here’s the result when the doorbell rings:

I’m not familiar with the Nvidia Shield to advise on that - but if there’s an app that supports RTSP or a streaming protocol that your Amcrest supports - it might be a good place to start.
btw - Kodi is supported on the Nvidia Shield…if you want to go that way :smiley:

2 Likes

yes, i have Kodi installed on the Shield.
i just tried your method but it didnt work. i wonder if it’s my syntax somewhere.

entity_id: media_player.shield_2
method: Player.Open
item:
  file: "rtsp://admin:[email protected]:554"

i know rtsp://admin:[email protected]:554  works fine because my VLC was able to open the stream

I should have mentioned this in my post:

Create a text file with the .strm extension with your rtsp url as the file’s content. Then call the .strm file with full path using the Player Open File method as I did. My file is on a NAS and that’s why the SMB location url.

Do you have to be actively watching the kodi app on the TV or can you switch the tv source to kodi before you stream the file?

No you don’t have to be actively watching the kodi app. But, yes, you have to switch the TV source to Kodi before you invoke the stream to be able to see it. In my case, Kodi is always open and the TV source is always on the Kodi app - but I only invoke the stream if the TV is turned on.

1 Like

I’ve Kodi running on a Pi (LibreElec) and I use a HA switch to ssh into it and change source, maybe there’s a way of doing similar with a Shield.

You have to share ssh keys from your HA install to your Shield / Pi.

## Big TV HDMI switch to Pi
- platform: command_line
  switches:
    big_tv_hdmi_switch:
      command_on: ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] 'echo "as" | cec-client -s'
      command_off: ssh -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] 'echo "is" | cec-client -s'
      friendly_name: Big TV HDMI switch

“as” = active source, “is” = inactive source.

Then I call a script:

## Security Cams on TV

  security_cams_on_sitting_tv:
    alias: Display Security Cams on Big TV
    sequence:

      - service: kodi.call_method
        data:
          entity_id: media_player.sitting_pi
          method: Player.Open
          item:
            file: "/storage/streams/cam1.strm"

      - service: switch.turn_on
        entity_id: switch.big_tv_hdmi_switch

im thoroughly confused unfortunately.
in Dev tools/Services, i am able to turn on the Shield and it turns on the TV with Kodi ready (waiting for me to pick files on the USB drive for instance).
now i am stuck at how to have Kodi auto play the RTSP stream.

i have the RTSP url in www folder in front_cam.strm but calling the service does nothing. is there something wrong with my syntax?
image

Your syntax looks correct.
If your file path and the rtsp stream url are correct - kodi should play it. My rtsp url looks like this for my Hikvision cam:

rtsp://username:password@ip_address_of_camera:554/cam/realmonitor?channel=1&subtype=0?tcp

You can also check the kodi logs to see if there are any errors after you call the service.

i got this error:
Run API method media_player.kodi.Player.Open({‘item’: {‘file’: ‘www/front_cam.strm’}}) error: {‘code’: -32602, ‘message’: ‘Invalid params.’}
i wonder if i have to install some prerequisites for this to work.

What’s the exact path or location of the strm file?

inside the config/www folder:
image

The strm file needs to be in a location that Kodi can access locally or on a network storage. Remember that HA is not playing the stream…it is invoking Kodi to play the stream. If Kodi can play a video or audio file from a location it will be able to play the strm file as well.

yes!!! i understand now am happy to say i got it working now in Dev tools/Services.
now to write a script for it. this is the first time using a script since i have always used the GUI for automation.
thanks so much!

you’re welcome…glad you got it working …good luck :+1: :grinning:

Is there a thread where you posted how to do this.
If not can you post how it was done. It seems that I have a similar setup.
Thanks

What is it exactly you want to do? Be specific and give more details please - so we can help.

As tung256 stated in the first post…
I too would like to get a snapshot from the front Amcrest camera sent to my Telegram whenever someone rings the doorbell.
I have looked for the original post but do can’t seem to find it.
How do I send my Amcrest doorbell image to Telegram.
Thanks

I do something similar with my Hikvision driveway camera and a Pushover notification to my phone with a camera snapshot attached when mail arrives at my mailbox. The trigger is motion from a motion sensor placed inside the mailbox:

configuration.yaml code for Pushover integration:

# Pushover Notify
notify:
  - name: pushover
    platform: pushover
    api_key: !secret pushover_api_key
    user_key: !secret pushover_user_key

generic camera integration for still image:

- platform: generic
  name: Driveway Camera
  still_image_url: http://camera.ip.address/Streaming/channels/1/picture
  username: !secret hikvision_username
  password: !secret hikvision_password
  authentication: basic

Automation to take snapshot and store file as well as to send Pushover notification with attachment:

- alias: Notify on Pushover when mailbox is opened
  trigger:
    platform: state
    entity_id: binary_sensor.mailbox_motion_contact
    to: 'on'
  action:
    - service: camera.snapshot
      data:
        entity_id: camera.driveway_camera
        filename: '/config/www/pictures/latest_mailbox.jpg'
    - delay: '00:00:05'
    - service: notify.pushover
      data:
        message: "The mailbox was opened"
        title: "You have mail"
        data:
          attachment: '/config/www/pictures/latest_mailbox.jpg'
          priority: 1 

Resulting notification on phone:

Hope this helps. You will have to find out your Amcrest URL for a still image. The Telegram integration is documented here:

2 Likes

in my config.yaml, i have:

amcrest:
  - host: 192.168.1.147
    username: admin
    password: my password

in automation.yaml, i have:

- id: '1579721342697'
  alias: alert doorbell send telegram front amcrest camear photo
  description: ''
  trigger:
  - entity_id: sensor.doorbell
    platform: state
    to: Ding
  condition: []
  action:
  - data:
      authentication: digest
      password: password of my amcrest camera
      target: 54my telegram
      url: http://192.168.1.147/cgi-bin/snapshot.cgi
      username: admin
    service: telegram_bot.send_photo
1 Like