Program for flipping cameras to day/night on Linux

It will be set to whatever you have the script to flip it to. So, for example before first run of the script, if it’s during the day, then set it for day. When night comes and the script runs, it will flip it to night.
 
  • Like
Reactions: tech101
well I ran it a couple times already, and my profile management is still set to schedule which was what I had before running. and yes the script was flipping day night mode during my script testing
 
well I ran it a couple times already, and my profile management is still set to schedule which was what I had before running. and yes the script was flipping day night mode during my script testing
Ok, I see what you are saying. My cameras are all set to "Full time". Then the script will flip it to Day/Night but leave it in Full time.
 
I'm trying to set day/night modes on my new Empire Tech IPC-Color4K-T/Dahua DH-IPC-HDW5849HP-ASE-LED running Dahua branded firmware.

I'm getting stuck with wget authentication issues. Has anyone gotten wget to authenticate to this camera? Here are the details and debug info:

C:\Program Files (x86)\GnuWin32\bin>wget -d --user admin --password obscured! ""

C:\Program Files (x86)\GnuWin32\bin>wget -d --user admin --password obscured! ""
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
Setting --user (user) to admin
Setting --password (password) to obscured!
DEBUG output created by Wget 1.11.4 on Windows-MinGW.

--2022-12-18 12:38:04-- Host `192.168.1.247' has not issued a general basic challenge.
seconds 0.00, Connecting to 192.168.1.247:80... seconds 0.00, connected.
Created socket 440.
Releasing 0x01058c10 (new refcount 0).
Deleting unused 0x01058c10.

---request begin---
GET /cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0 HTTP/1.0
User-Agent: Wget/1.11.4
Accept: /
Host: 192.168.1.247
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to 104b38735a49387a0225714e54110f5f", qop="auth", nonce="2005133106", opaque="7b07fb92c508a1c0c0e1373f90b552ca72291fd2"
Connection: close
CONTENT-LENGTH: 0

---response end---
401 Unauthorized
Closed fd 440
seconds 0.00, Connecting to 192.168.1.247:80... seconds 0.00, connected.
Created socket 448.
Releasing 0x010591e0 (new refcount 0).
Deleting unused 0x010591e0.

---request begin---
GET /cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0 HTTP/1.0
User-Agent: Wget/1.11.4
Accept: /
Host: 192.168.1.247
Connection: Keep-Alive
Authorization: Digest username="admin", realm="Login to 104b38735a49387a0225714e54110f5f", nonce="2005133106", uri="/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0", response="d1580426f2555419ec21ff39818412c8", opaque="7b07fb92c508a1c0c0e1373f90b552ca72291fd2"

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 401 Unauthorized
Connection: close
Content-type: text/plain;charset=utf-8
Content-Length: 27

---response end---
401 Unauthorized
Closed fd 448
Authorization failed.

C:\Program Files (x86)\GnuWin32\bin>

---end---
 
Code:
C:\Program Files (x86)\GnuWin32\bin>wget -d --user admin --password obscured! "http://192.168.1.247/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0"

C:\Program Files (x86)\GnuWin32\bin>wget -d --user admin --password obscured! "http://192.168.1.247/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0"
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
Setting --user (user) to admin
Setting --password (password) to obscured!
DEBUG output created by Wget 1.11.4 on Windows-MinGW.

--2022-12-18 12:38:04--  http://192.168.1.247/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0
Host `192.168.1.247' has not issued a general basic challenge.
seconds 0.00, Connecting to 192.168.1.247:80... seconds 0.00, connected.
Created socket 440.
Releasing 0x01058c10 (new refcount 0).
Deleting unused 0x01058c10.

---request begin---
GET /cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0 HTTP/1.0
User-Agent: Wget/1.11.4
Accept: */*
Host: 192.168.1.247
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to 104b38735a49387a0225714e54110f5f", qop="auth", nonce="2005133106", opaque="7b07fb92c508a1c0c0e1373f90b552ca72291fd2"
Connection: close
CONTENT-LENGTH: 0

---response end---
401 Unauthorized
Closed fd 440
seconds 0.00, Connecting to 192.168.1.247:80... seconds 0.00, connected.
Created socket 448.
Releasing 0x010591e0 (new refcount 0).
Deleting unused 0x010591e0.

---request begin---
GET /cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0 HTTP/1.0
User-Agent: Wget/1.11.4
Accept: */*
Host: 192.168.1.247
Connection: Keep-Alive
Authorization: Digest username="admin", realm="Login to 104b38735a49387a0225714e54110f5f", nonce="2005133106", uri="/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=1&VideoInOptions[].NightOptions.DayNightColor=0", response="d1580426f2555419ec21ff39818412c8", opaque="7b07fb92c508a1c0c0e1373f90b552ca72291fd2"

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 401 Unauthorized
Connection: close
Content-type: text/plain;charset=utf-8
Content-Length: 27

---response end---
401 Unauthorized
Closed fd 448
Authorization failed.

C:\Program Files (x86)\GnuWin32\bin>
 
I suspect this is going to be a digest authentication standard version issue where my older Windows version of wget may not understand whatever digest standard my newer Dahua branded firmware is using.

I'll try a newer version of wget from one of my Linux boxes.
 
Using wget version 1.20.3 running on Linux solved the authentication problem I described. This was tested and verified on my 5831s, 5442s as well as my new production IPC-Color4K-T all running the most current Dahua branded firmware.

---end---
aside: As much as I would prefer to use Andy's firmware, unfortunately I have to use the bleeding edge Dahua branded versions to get my Dahua Analytics plugin to load in my NX Witness-based Wisenet Wave VMS.
--------------------------------------------------------------
 
  • Like
Reactions: CanCuba
Here I experience something that others may recognize...

In Linux, if I issue the command "curl -g --digest -u user:password "" " , then I get the answer: "curl: (56) Recv failure: Connection reset by peer".
Even if I try the same, but with "--basic" authentication.

When I send this command from a windows computer within the same network, I also get the response: "curl: (7) Failed to connect to x.x.x.x port 10081 after 2142 ms: Connection refused".
If I now request the URL "" from the same Windows computer in Chrome, I get "ERR_CONNECTION_REFUSED ".

Also thought it was due to Curl/wget's version but these have been updated...

Now the strange thing is that if I try to log in directly to the camera via: I also get the result "Connection refused", but when I go to the camera's login through the web interface of the NVR, I get the same page and I can log in.
If I have successfully logged in there, my curl commands will also work from that computer.

So access to the camera seems to depend on the NVR, who knows if this can be turned off, or can it be solved differently, so that I can control my camera with URL commands (day/night)?


On Linux use wget version 1.21.3 and curl 7.86.0, Windows curl 7.83.1
NVR NV4108P-4KL and Camera IPC-T5442T-ZE from Andy with software version 2.840.15OG00D.0.R,2022-08-18.
 
Now the strange thing is that if I try to log in directly to the camera via:
I also get the result "Connection refused", but when I go to the camera's login through the web interface of the NVR, I get the same page and I can log in.
I recall that if the cameras are installed directly on the NVR's POE ports then they will be on a private subnet that is blocked from the LAN.

- Thomas
 
Here I experience something that others may recognize...

In Linux, if I issue the command "curl -g --digest -u user:password "" " , then I get the answer: "curl: (56) Recv failure: Connection reset by peer".
Even if I try the same, but with "--basic" authentication.

When I send this command from a windows computer within the same network, I also get the response: "curl: (7) Failed to connect to x.x.x.x port 10081 after 2142 ms: Connection refused".
If I now request the URL "" from the same Windows computer in Chrome, I get "ERR_CONNECTION_REFUSED ".

Also thought it was due to Curl/wget's version but these have been updated...

Now the strange thing is that if I try to log in directly to the camera via: I also get the result "Connection refused", but when I go to the camera's login through the web interface of the NVR, I get the same page and I can log in.
If I have successfully logged in there, my curl commands will also work from that computer.

So access to the camera seems to depend on the NVR, who knows if this can be turned off, or can it be solved differently, so that I can control my camera with URL commands (day/night)?


On Linux use wget version 1.21.3 and curl 7.86.0, Windows curl 7.83.1
NVR NV4108P-4KL and Camera IPC-T5442T-ZE from Andy with software version 2.840.15OG00D.0.R,2022-08-18.

Set the NVR to Bridge Mode. I had a similar problem and this solved it.

 
Looked in the NVR and cameras, but do not have a Bridge option in the SWITCH tab.

Is it true that the NVR has a private network with the IP cameras in the range 10.1.1.x and my normal LAN network is on 192.168.30.x.
However, when I go through the NVR to a camera's configuration page (NVR\Camera\Camera List\Webpage), it calls it on my normal LAN network with a specific port. IP of the NVR is 192.168.30.2 and the login of the camera is then:
That's why I thought that the day/night pages can also be called via this url. It would make sense that something would have been invented, that you can also configure the cameras through the NVR.
 
Looked in the NVR and cameras, but do not have a Bridge option in the SWITCH tab.

Is it true that the NVR has a private network with the IP cameras in the range 10.1.1.x and my normal LAN network is on 192.168.30.x.
However, when I go through the NVR to a camera's configuration page (NVR\Camera\Camera List\Webpage), it calls it on my normal LAN network with a specific port. IP of the NVR is 192.168.30.2 and the login of the camera is then:
That's why I thought that the day/night pages can also be called via this url. It would make sense that something would have been invented, that you can also configure the cameras through the NVR.

Until I enabled bridge mode, my Dahua NVR showed two networks.

Now I have my access point plugged into the single network port and I can connect to any device in the subnet I have configured on the POE ports.

Hope you get this figured out.