Sending picture notifications, with Node-RED and Telegram

I have a SkyBell HD doorbell, and it sends notifications to my wife and I with the SkyBell app when it detects motion or the doorbell button is pressed. It works well enough, but it’s another separate app sending separate notifications. The entire point of automation is to make life easier, so let’s see about getting those notification in Telegram, with the rest of our smart home notifications. Here’s how the native app looks:

Here’s how the notification looks within Telegram:

There’s a few different parts to this flow. We’re going to send a notification for both motion, and button press. Once motion or button press is detected, a call service node takes a snapshot of the camera, stores it locally on your Home Assistant hub, waits one second to allow it to save properly, and then another call service node sends it as a notification.

Let’s do eet.

First part is easy, it’s two state nodes monitoring the Skybell, one for the button press, one for the motion.

Here’s how the configurations looks for the doorbell motion:

Here’s how the doorbell button looks:

Next is the call service node taking a snapshot:

Here’s how it looks on the inside:

A few things we need to go over with this. The “snapshot” service does what it’s called, it takes a snapshot of the camera you specify in entity ID. In this case, “camera.front_door_last_activity” is the camera we’ll be taking a snapshot from. In the Data field, you’ll notice “filename” and the location of where the snapshot will be stored. So a snapshot is taken of the camera, and stored where you specify in the data field. We then use a delay node set to 1 second to give the snapshot time to copy to the file location. We then use a call service node to send the snapshot from the save location to whatever notify service you are using. I’m using Telegram, so I send it with the send_photo service. Below is the configuration.

With this flow configuration, you will receive a photo of your doorbell when motion is detected, or the button is pressed. Here’s the code.

14 thoughts on “Sending picture notifications, with Node-RED and Telegram

  • Hi Justin

    I am fairly new to this with no experience what so ever. And you are doing exactly what I have been looking for for the past 4 months! I would love to try this but can you maybe assist me with what I need to put ” code/write” in to the yaml file to make the camera an “entity”? this would be highly appreciated

    regards

    Eugene

    Like

    • I’d be happy to help!

      So you need to make a camera an entity that Home Assistant recognizes and can use.

      What kind of camera is it that you want to use? After we know that, we can look into how to get it added correctly..

      Liked by 1 person

  • so I was able to set this up and get the automation working based on your great instruction, however the send photo on button press service call is sending me a photo, but there is never a person in the picture!!! any idea why that may be?

    Like

  • [{“id”:”e5d68ac6.1c6ed”,”type”:”tab”,”label”:”Doorbell”,”disabled”:false,”info”:””},{“id”:”57a6ec9a.e8cb8c”,”type”:”server-state-changed”,”z”:”e5d68ac6.1c6ed”,”name”:”Doorbell Pressed”,”server”:”2dfba141.2a4c5e”,”version”:1,”exposeToHomeAssistant”:false,”haConfig”:[{“property”:”name”,”value”:””},{“property”:”icon”,”value”:””}],”entityidfilter”:”binary_sensor.doorbell_ding”,”entityidfiltertype”:”exact”,”outputinitially”:false,”state_type”:”str”,”haltifstate”:”on”,”halt_if_type”:”str”,”halt_if_compare”:”is”,”outputs”:2,”output_only_on_state_change”:true,”x”:100,”y”:60,”wires”:[[“caf4174.5ca3b68”],[]]},{“id”:”caf4174.5ca3b68″,”type”:”api-call-service”,”z”:”e5d68ac6.1c6ed”,”name”:”Take Snapshot”,”server”:”2dfba141.2a4c5e”,”version”:1,”debugenabled”:false,”service_domain”:”camera”,”service”:”snapshot”,”entityId”:”camera.doorbell”,”data”:”{\”filename\”:\”/config/www/last_doorbell_ring.jpg\”}”,”dataType”:”json”,”mergecontext”:””,”output_location”:””,”output_location_type”:”none”,”mustacheAltTags”:false,”x”:300,”y”:60,”wires”:[[“cf8037bc.9ff1c”]]},{“id”:”cf8037bc.9ff1c”,”type”:”delay”,”z”:”e5d68ac6.1c6ed”,”name”:””,”pauseType”:”delay”,”timeout”:”2″,”timeoutUnits”:”seconds”,”rate”:”1″,”nbRateUnits”:”1″,”rateUnits”:”second”,”randomFirst”:”1″,”randomLast”:”5″,”randomUnits”:”seconds”,”drop”:false,”x”:500,”y”:60,”wires”:[[“2683a152.915ae6”]]},{“id”:”2683a152.915ae6″,”type”:”api-call-service”,”z”:”e5d68ac6.1c6ed”,”name”:”Send to Telegram”,”server”:”2dfba141.2a4c5e”,”version”:1,”debugenabled”:false,”service_domain”:”telegram_bot”,”service”:”send_photo”,”entityId”:””,”data”:”{\”file\”:\”/config/www/last_doorbell_ring.jpg\”,\”caption\”:\”Someone’s at the front door\”}”,”dataType”:”json”,”mergecontext”:””,”output_location”:””,”output_location_type”:”none”,”mustacheAltTags”:false,”x”:690,”y”:60,”wires”:[[]]},{“id”:”f9dc121e.d246a8″,”type”:”comment”,”z”:”e5d68ac6.1c6ed”,”name”:”*************** Doorbell Automations ****************”,”info”:””,”x”:200,”y”:20,”wires”:[]},{“id”:”4519f3e7.19b26c”,”type”:”ring doorbell”,”z”:”e5d68ac6.1c6ed”,”testmode”:”N”,”verbose”:”N”,”topic”:””,”name”:””,”x”:100,”y”:200,”wires”:[[“5be4aa12.17cc64″,”4155dac0.0fc264”]]},{“id”:”5be4aa12.17cc64″,”type”:”debug”,”z”:”e5d68ac6.1c6ed”,”name”:””,”active”:true,”tosidebar”:true,”console”:false,”tostatus”:false,”complete”:”false”,”x”:300,”y”:240,”wires”:[]},{“id”:”4155dac0.0fc264″,”type”:”debug”,”z”:”e5d68ac6.1c6ed”,”name”:””,”active”:true,”tosidebar”:true,”console”:false,”tostatus”:false,”complete”:”true”,”targetType”:”full”,”x”:300,”y”:300,”wires”:[]},{“id”:”4135a1d7.d38ee”,”type”:”server-state-changed”,”z”:”e5d68ac6.1c6ed”,”name”:”Doorbell Motion”,”server”:”2dfba141.2a4c5e”,”version”:1,”exposeToHomeAssistant”:false,”haConfig”:[{“property”:”name”,”value”:””},{“property”:”icon”,”value”:””}],”entityidfilter”:”binary_sensor.doorbell_motion”,”entityidfiltertype”:”exact”,”outputinitially”:false,”state_type”:”str”,”haltifstate”:”on”,”halt_if_type”:”str”,”halt_if_compare”:”is”,”outputs”:2,”output_only_on_state_change”:true,”x”:100,”y”:140,”wires”:[[“1cc105cb.9ea80a”],[]]},{“id”:”1cc105cb.9ea80a”,”type”:”api-call-service”,”z”:”e5d68ac6.1c6ed”,”name”:”Take Video”,”server”:”2dfba141.2a4c5e”,”version”:1,”debugenabled”:false,”service_domain”:”camera”,”service”:”record”,”entityId”:”camera.doorbell”,”data”:”{\”filename\”:\”/config/www/last_doorbell_motion\”}”,”dataType”:”json”,”mergecontext”:””,”output_location”:””,”output_location_type”:”none”,”mustacheAltTags”:false,”x”:290,”y”:140,”wires”:[[“f7c84a6.009ffb8”]]},{“id”:”f7c84a6.009ffb8″,”type”:”delay”,”z”:”e5d68ac6.1c6ed”,”name”:””,”pauseType”:”delay”,”timeout”:”2″,”timeoutUnits”:”seconds”,”rate”:”1″,”nbRateUnits”:”1″,”rateUnits”:”second”,”randomFirst”:”1″,”randomLast”:”5″,”randomUnits”:”seconds”,”drop”:false,”x”:500,”y”:140,”wires”:[[“33000e42.480dd2”]]},{“id”:”33000e42.480dd2″,”type”:”api-call-service”,”z”:”e5d68ac6.1c6ed”,”name”:”Send to Telegram”,”server”:”2dfba141.2a4c5e”,”version”:1,”debugenabled”:false,”service_domain”:”telegram_bot”,”service”:”send_photo”,”entityId”:””,”data”:”{\”file\”:\”/config/www/last_doorbell_motion\”,\”caption\”:\”Someone’s at the front door\”}”,”dataType”:”json”,”mergecontext”:””,”output_location”:””,”output_location_type”:”none”,”mustacheAltTags”:false,”x”:690,”y”:140,”wires”:[[]]},{“id”:”2dfba141.2a4c5e”,”type”:”server”,”z”:””,”name”:”Home Assistant”,”legacy”:false,”addon”:true,”rejectUnauthorizedCerts”:true,”ha_boolean”:”y|yes|true|on|home|open”,”connectionDelay”:true,”cacheJson”:true}]

    Like

  • Hi Justin thanks for coming back to me! I am using wyze cams with the beta firmware that does the whole rtsp feed thingy and loaded motion eye in home assistant. So I figured the part that was wrong (like I said I am a newbie with zero experience just a mountain the twice the size of Everest experience in: google and youtube videos!) so after like 40 minutes of browsing the pc that I have ubuntu running and home assistant on it I could not find the /config/www/snapshot_camera etc file. so once again googled and figured out its int he configurator’s config file! and saw 401: Unauthorized so after another 30 min of my friend Google (seriously we are like on first name basis and drink coffee together!) I found out the whole port thingy was wrong so I fixed that and now just as I got excited thinking this is it…. another error (Murphy can seriously skip me every now and then would really appreciate it if he does!) but any how the “new” problem now is:”‘utf-8’ codec can’t decode byte 0xff in position 0: invalid start byte” I’m going for coffee now with my friend Google for another 15 min or so but then off to bed… but any idea’s will be appreciated!

    Like

  • Hi Justin

    No! I have not …yet. After finding the snapshot “config” file there is a new error:’utf-8′ codec can’t decode byte 0xff in position 0: invalid start byte. so from my friend google it seems that the encoding is wrong its ASCII and should be UTF-8. really lost here!

    Like

  • Hi Justin

    just an update its fixed! Weird don’t know why or how, I just edited the yaml file like adding another line and saved and restarted! I know I have tried to change the encoding with word pad and saved it, so not sure but hey it works now! thank you for assistance and your site really appreciate it. Next is the Alarm system!

    Once again Thanks! and where can I get you a coffee?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s