I’m trying to pull a screenshot from my Dahua (IPC-HDW4431C-A-V2) but it seems not to work. I have another Hikvision cam and have no problem with screenshot
My automation.yaml with Dahua url looks like:
- alias: This is a test
initial_state: 'on'
hide_entity: True
trigger:
platform: state
entity_id: binary_sensor.door_window_sensor_158d00014df82f
to: 'on'
action:
- service: notify.Telegram
data:
title: 'Home Assistant'
message: 'Test!'
data:
photo:
- url: http://user:[email protected]:8033/cgi-bin/snapshot.cgi
caption: 'This is a test'
This does not look like a public ip but the ip from your local network. This will. To be able to see the image remotely, you need to be able to access that through an ip address or a dns name ( look at duckdns ).
You need to forward port X from the router to port 80 on the camera. Then set the url as
For example, I can externally access my camera port 80 through my public ip, port 64113 (random port chosen by me).
Depinding on the router / internet connection you might have to use port 80 or you can use any other port (one external port for every camera).
Hope this points you in the right direction.
I haven’t used this feature yet, so I’m not 100% sure if a public address is needed, the configuration says “url or file (Required): For local or remote path to an image.” so both might work.
I do use external port for Dahua and the camera can be reached outside my network. But I can’t pull a jpg. What notification platform do you guys use? And could you share a working script?
I used your script but get an 404 error. Is there any other way to get a screenshot of Dahua?
Or is it becauseI use duckdns that cause the problem to get a local snapshot?
Ok, I managed to save the local snapshot but can’t attached it to (facebook) notification. Any help appreciated! This is how my automation script look like:
- alias: Test Automation
initial_state: 'on'
hide_entity: True
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158d00014db7b2
from: 'off'
to: 'on'
action:
- service: camera.snapshot
data_template:
entity_id: camera.dahua_ipc
filename: "/config/www/snapshots/camera.dahua_ipc{{ trigger.to_state.last_changed }}.jpg"
- service: notify.facebook
data:
message: 'This is a test'
data:
attachment:
type: 'image'
payload: "https://ip:8123/config/www/snapshots/camera.dahua_ipc{{ trigger.to_state.last_changed|urlencode }}.jpg"
target:
- '+31xxxxxxxxxx'
I don’t know if I understand your question but the screenshots are saved in /config/www/snapshots/ (you need to create a folder named snapshots or something).
But I still cannot get the screenshot with push notification. Maybe someone here has the solution?