I am trying to get my camera to go from night mode to day mode using HA

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.

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

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.

Nice work - works great. Thanks for your help

This just helped me with the day and night commands for my Dahua camera! Thank you!

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.