Ok, trying to build a PMR (Poor Man Ring) starting from an already working Doorbell button (433Mhz sending signal to a tamotized Sonof Bridge).
It works, alexa announces visitor and I get a notification on the phone, also a snapshot of the nearest camera gets saved in /config/tmp
All smooth except I can’t figure out how to include that snapshot with the IOS notification.
Please read the blue banner at the top of the page and edit your post accordingly.
Here’s my PMR to assist you by example. Note the directories. They are important. The image must be accessible from the internet or you must the on the same network as the folder.
/www = internet accessible folder and is mapped to /local in the URL.
- id: doorbell_alert
alias: 'Doorbell Alert'
trigger:
entity_id: binary_sensor.doorbell
platform: state
to: 'on'
condition:
condition: template
value_template: "{{ (as_timestamp(now()) - as_timestamp(state_attr('automation.doorbell_alert', 'last_triggered') | default(0)) | int > 5)}}" # only annoy me again after 5 seconds
action:
- service: switch.turn_on
entity_id: switch.downstairs_doorbell
- service: switch.turn_on
entity_id: switch.upstairs_doorbell
- service: camera.snapshot
data:
entity_id: camera.front
filename: '/config/www/doorbell.jpg'
- service: switch.turn_off
entity_id: switch.downstairs_doorbell
- service: switch.turn_off
entity_id: switch.upstairs_doorbell
- service: notify.ios_iphonex
data:
message: Someone has pressed the doorbell.
data:
push:
sound: "Doorbell.wav"
attachment:
url: https://mydomain.duckdns.org/local/doorbell.jpg
content-type: jpg
hide-thumbnail: false
I then get the error
Invalid config for [automation]: template value is None for dictionary value @ data[‘action’][2][‘data_template’][‘data’]. Got None. (See /config/configuration.yaml, line 491). Please check the docs at https://home-assistant.io/components/automation/
Note that the snapshot service works, the jpg is created in the folder
Here we go I made some little change, tried png instead of jpeg but config is now valid, still no picture attached.
I am using the IOS Beta 2 if that makes any difference.
I see the notification on the phone with date and time and file is created in the folder and it is accessible from outside.
Update: the code works, I have reverted back to version 55 of the beta 2.0 App.
Hope this helps others, I will write a separate post and a tutorial.
Next step is to add cast to Google Nest Hub (already possible just I have to figure out the proper way) and possibly Alexa show in the future.
Another advantage is that timestamped pictures are stored everytime a doorbell is pushed or the door opens or the gate opens.
It is also possible a custom sound.