This is an amazing idea. Is there a risk to having the username and password sent in clear text like that? Someone snooping the network or something? I suppose if there is a VLAN or separate network it might be okay?I am running a cam with firmware from 2021-07-09 and its API for setting sunrise and sunset is working fine.
View attachment 110032
I am not using the DahuaSunriseSunset service. Instead I am having Blue Iris send the http requests using its own scheduler.
It is a little hacky to set up in Blue Iris because you can't simply schedule a custom HTTP request. But you can modify PTZ presets in Blue Iris to send custom HTTP requests, and you can schedule calls to those presets to happen at times relative to sunrise and sunset.
The procedure is:
1. In Blue Iris, go to Camera Properties > PTZ/Control tab.
2. Enable PTZ control (if your cam doesn't have motorized pan/tilt/zoom then just pick "Dahua New V5" from the dropdown).
3. Click Edit presets.
4. TypeDay Profile
into the description of one of the presets.
5. Click "On call" button, then add a "Web request or MQTT" action.
6. Configure the URL asuser:password@192.168.0.1/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=0
, replacinguser
,password
, and192.168.0.1
with your own camera credentials and address.
7. Repeat steps 4-6 on a different preset, but with the descriptionNight Profile
and change the0
at the end of the URL to1
like this:user:password@192.168.0.1/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1
View attachment 110037
Finally you can proceed to scheduling calls to your presets:
8. Go to camera properties > Schedule tab > Events schedule.
Add each event at the desired time:
View attachment 110038
In this example, I configured it so the camera goes to Day mode 1 hour before sunrise. I configured this weeks ago and Blue Iris has automatically adjusted the exact scheduled time as the sunrise time changes daily.
View attachment 110039
This is an amazing idea. Is there a risk to having the username and password sent in clear text like that? Someone snooping the network or something? I suppose if there is a VLAN or separate network it might be okay?
If someone is snooping on your network you have way bigger problems than your dahua cam password. Moreover, think of an ipcamera password as a do not enter sign. It will only keep semi-honest folks out. I yearn for the days that the cameras allowed me to leave the default password active.This is an amazing idea. Is there a risk to having the username and password sent in clear text like that? Someone snooping the network or something? I suppose if there is a VLAN or separate network it might be okay?
My password manager and even copy/paste won't get the passwords into the Dahua password box, which is really irritating!!No, it isn't sent to the camera the way it is typed into the URL field. I am pretty sure Dahua cameras use "digest authentication" which does not transfer the password in plain text.
Even if it was plain text, there is almost zero risk in sending a camera's credentials over your LAN in plain text.
My password manager and even copy/paste won't get the passwords into the Dahua password box, which is really irritating!!
...
http://username:password@192.168.1.108:80/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[2].NightOptions.SwitchMode=0&VideoInOptions[2].NightOptions.DayNightColor=0
http://192.168.1.108/cgi-bin/configManager.cgi?action=getConfig&name=ChannelTitle
Hmm... are you right clicking to access the copy/paste commands?
I regularly use ctrl+v to paste the password into the Dahua camera web login with much success.
Maybe it's a limitation of the firmware version
One option is to use a home automation controller provided it allows for HTTP GET functions within its rules structure.
One such device is the Hubitat C7 hub as it will control Dahua cameras with a Dahua NVR using the correct HTTP API. Plug the hub into the LAN side of your router along with the NVR. And program the hub, using the built in rules machine to create a sunup and sunset rule.
To change a HFW-5849 camera from B/W to color at sunrise I use the following HTTP call within the rules machine.
To test for HTTP access, one can use a GET statement with a browser to display settings. The below will display the names of the cameras connected to the NVR.Code:http://username:password@192.168.1.108:80/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[2].NightOptions.SwitchMode=0&VideoInOptions[2].NightOptions.DayNightColor=0
Have been using the hub for both Dahua camera control and home automation. It works well for both.Code:http://192.168.1.108/cgi-bin/configManager.cgi?action=getConfig&name=ChannelTitle
http://username:password@192.168.1.108:80/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[2].NightOptions.SwitchMode=3&VideoInOptions[2].NightOptions.DayNightColor=2
http://username:password@192.168.1.108:80/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[2].NightOptions.SwitchMode=0&VideoInOptions[2].NightOptions.DayNightColor=0
@Alaska Country nailed it. I've been doing this with a Raspberry Pi for years. Just a simple cron job that executes the html calls he posted during sunrise/sunset.Thank you so much for creating this and I been using this utility for my Cams and have been working great,
However Recently helped a neighbor setup his system as well he went the NVR route however, I am still trying to see if I could somehow dial his camera profile, zoom and focus based off sunset sunrise.
The solution from this post will require a PC to be constantly on, However I was wondering has anyone figured out how can we run this maybe on a small device like raspberry pi ? or something similar which is small enough just for this utility ??
Only thing I think I came across on google search where a user seem to be running ESP8266 along with ambient sensor to trigger profile based off sunset sunrise... Again I have no idea how will I go about setting that Maybe someone here have something similar ?
Dahua cameras - switch between Day and Night video profiles
Rather than using the ‘sun’ integration with ‘sunrise’ and ‘sunset’ events, or trying to offset these events by some fixed amount, I use an ESPHome sensor built from a Wemos D1 Mini (ESP8266) and a BH1750 ambient light sensor. This sensor is located in a window on the south side of my home...community.home-assistant.io
@Alaska Country nailed it. I've been doing this with a Raspberry Pi for years. Just a simple cron job that executes the html calls he posted during sunrise/sunset.
Interesting, running the command in a browser DID immediately switch the camera to the Night profile and B/W. Odd that I am seeing the commands run in the B.I. log with the "Web: HTTP/1.1 200 OK " response at the appropriate times, but nothing happens there.You can try the URL in a web browser and see the full response.
If you want full API documentation: latest Version of DAHUA HTTP API FOR IPC Documentation ??
Yes, as I mentioned previously, I am not running the old (software based) utility, I am using the newer, currently recommended "native" B.I. API PTZ/ Camera Scheduler based method now outlined in post #1 of this thread, so yes, I do see some logging in B.I. as detailed above.This utility doesn't go into the BI logs, so you must be seeing something else. Look at the log file for this utility.
Or as an alternative run this API command directly in BI based on profile.