Hi, I notice the DB1 last_alarm_pic sensor url contains a jpg of the actual motion which is most relevant (triggered the alarm). This image seems more relevant compared to the snapshots taken with my HA automations which get triggered as soon as a motion is detected.
In order to allow local storage of this last_alarm_pic, I have found a way to setup a generic camera based on the Ezviz last_alarm_pic sensor, including overcoming the http 302 AWS S3 redirection:
configuration.yaml
:
camera:
- platform: generic
name: Voordeur DB1 last alarm pic
still_image_url: "{{ state_attr('sensor.voordeur_last_alarm_pic_curl', 'location') }}"
limit_refetch_to_url_change: true
#verify_ssl: false
sensor:
- platform: command_line
name: Voordeur last alarm pic curl
command: 'curl -I -s "{{states("sensor.db1_cXXXXXX_last_alarm_pic")}}" | grep Location: | awk {''print "{\"location\": \""$2"\"}"''}'
scan_interval: 30
json_attributes:
- "location"
value_template: 'ok'
Based on this new generic camera, every new last_alarm_pic can be stored with an automation similar to:
alias: Voordeur DB1 save last alarm pic snapshot
description: ''
trigger:
- platform: state
entity_id: sensor.db1_cXXXXXX_last_alarm_pic
to:
condition: []
action:
- service: camera.snapshot
entity_id: camera.voordeur_db1_last_alarm_pic
data:
filename: >-
/config/recordings/{{ now().strftime("%Y%m%d-%H%M%S")
}}_1voordeur_last_alarm_pic.jpg
mode: single