I’ve created a doorbell automation the sends a message to a Telegram account and have my Google Nest speaker inform us that there is someone at the door. The ha_uptime check is there because otherwise it’ll go off if my HA reboots. I’m going to implement a check so it’ll won’t use the speaker if nobody is home.
Most important question: Is there a way to use the username and password stored in secrets.yaml?
Also I would like to send an image at first and a small video second, how can I accomplish this?
alias: Notification - Doorbell
description: ''
trigger:
- platform: device
type: turned_on
device_id: xxx
entity_id: switch.doorbell
domain: switch
condition:
- condition: numeric_state
entity_id: sensor.ha_uptime
above: '0.5'
action:
- service: notify.telegram
data:
message: Notification
data:
photo:
- url: http://10.xxx.xxx.xxx/Streaming/channels/1/picture
authentication: digest
username: **username**
password: **Password123!**
caption: There is someone at the door (1/2)
- service: tts.google_cloud_say
data:
entity_id: media_player.livingroom
message: 'Notification. There is someone at the door!'
- delay: '3'
- service: notify.telegram
data:
message: Text
data:
photo:
- url: http://10.xxx.xxx.xxx/Streaming/channels/1/picture
authentication: digest
username: **username**
password: **Password123!**
caption: There is someone at the door (2/2)
mode: single
I added the URL (camera_url) to my secrets.yaml and replaced the url, username and password with the !secret arguments. Unfortunately it didn’t work.
service: notify.telegram
data:
data:
photo:
- url: !secret camera_url
authentication: digest
username: !secret camera_username
password: !secret camera_password
caption: There is someone at the door (1/2)
message: There is someone at the door (1/2)
Yes, I’m using it to store/access my Telegram apikey/chatid and other usernames/passwords.
I had to double check, but I also use it for my my HikVision camera. It’s feed is being shown on one of my overview-pages.
Maybe you have characters in the YAML values that’s interpreted by the YAML parser, e.g. an & that’s an anchor. Try to place all the string values in quotes. I’m guessing here, since you can’t show the contents of your secrets.yaml.
I’ve rebooted my Home Assistant.
My secrets.yaml has the following entry and it’s not much different in characters as my functioning Telegram settings:
service: notify.telegram
data:
data:
photo:
- url: !secret camera_url
authentication: digest
username: !secret camera_username
password: !secret camera_password
caption: Er staat iemand aan de deur (3/2)
message: Er staat iemand aan de deur (3/2)
If I save it “!secret camera_url” is being changed to “null”.