4ward
(mick)
November 30, 2022, 10:19pm
1
I am using
http://USER:[email protected] /cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=2&arg3=0
to change the camera to day mode and it works if I put it in a browser, but not in HA.
This is what I have in my config.yaml file
shell_command:
frontcameraday: ‘curl GET http://USER:[email protected] /cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1 ’
I only just loaded HA for the first time 2 weeks ago and still learning. looked all over the place and found how to do it, but just not working. Maybe something has changed in the new version??
thanks
Instead of CURL you can give it a try with REST (maybe wget) command. Browser adds many headers to call but CURL is doing a basic/lean call to url without any headers.
4ward
(mick)
November 30, 2022, 10:28pm
3
I did try a rest command as well, but that did not seem to work as well. I can not find what used at this stage, but I will look around and post it.
This does work for me:
shell_command:
# Dahua configManager action
# (Note: digest not supported in rest_command)
dahua_config: curl -s -g --digest -u {{ usr }}:{{ pwd }} "http://{{ ip }}/cgi-bin/configManager.cgi?action=setConfig&{{ action }}"
Replace the parts between curly braces with your data.
1 Like
4ward
(mick)
November 30, 2022, 11:36pm
5
replace the curly braces as well? I ask as the action looks code looks funny.
“http://{{192.168.1.21}}/cgi-bin/configManager.cgi?action=setConfig&{{VideoInMode[0].Config[0]=1}}”
or
“http://{{192.168.1.21}}/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1”
Yes, everywhere. Alternatively you can pass these fields as parameters from a script.
4ward
(mick)
December 1, 2022, 12:11am
7
Nice work - works great. Thanks for your help
This just helped me with the day and night commands for my Dahua camera! Thank you!
jakeycrx
(Jake)
January 24, 2025, 9:53pm
9
I just got another Dahua camera which is running the newer WEB firmware and it’s clunky. The VideoInMode command doesn’t work anymore.
For day mode I’m using:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].ConfigEx=Day&VideoInMode[0].Mode=4
For night mode:
http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].ConfigEx=Night&VideoInMode[0].Mode=4
Nobody really knows what the mode 4 is about, but it works.
If you interact with the WebUI it reverts back to day mode, so don’t let that catch you out if you’re testing it.