Sunrise and Sunset IPCamera modes Rule Machine

Best way to achieve this??

Would like Hubitat to send commands to my Dahua IP cameras when sunset and sunrise occur (this changes the cameras day/night recording modes).

The NVR and the hub are both connected to the LAN side of the router. The Windows desktop is running Dahua Smart PSS for camera settings. Also NVR camera settings are directly accessible (not using Smart PSS) using the built in NVR software. However most camera changes are made by directly accessing individual camera settings by logging into each separate IP camera via Smart PSS.

Thank you,

Jim
Anchorage, Alaska

Can the NVR or cameras receive commands by HTTP calls?

From what I can tell it does.

This is what the NVR data sheet states:

In the NVR data sheet under Network
Network Function HTTP, HTTPS, TCP/IP, IPv4/IPv6, UPnP, RTSP, UDP, SMTP, NTP, DHCP, DNS, IP Filter, DDNS, FTP, SNMP, IP Search (Support Dahua IP camera, DVR, NVS, etc).

Third Party Support
Arecont Vision, Airlive, AXIS, Canon, Dynacolor, JVC, LG, Panasonic, Pelco, PSIA, Samsung, Sanyo, Sony, Watchnet and more.

Thank you,

Jim

This is what the Dahau camera supports.

Network
RJ-45 (10/100 Base-T)

SDK and API
Yes

Protocol
IPv4; IPv6; HTTP; HTTPS; TCP; UDP; ARP; RTP; RTSP;
RTCP; RTMP; SMTP; FTP; SFTP; DHCP; DNS; DDNS; QoS;
UPnP; NTP; Multicast; ICMP; IGMP; NFS; SAMBA; PPPoE;
802.1x; SNMP

Interoperability
ONVIF (Profile S/Profile G/Profile T); CGI; Milestone;
Genetec; P2P

Management Software
Smart PSS; DSS; DMSS
Mobile Phone IOS; Android

What’s the model # of each device?

My Dahua cameras are a few years old and the profile management can't be controlled through an API. However, you can do this through the camera's UI.

I'm not familiar with the Dahua NVR as I use Blue Iris but I found most of the Dahua API info at

I'm not sure if these work on the NVR as well or not.

HTTP info there should help you out

Also there is a windows utility here:

The camera is a Dahua HWF-5849 bullet. The NVR NVR4216-16P. Would have liked to attach a PDF of the data sheet but could not locate a way to perform that function.

Thank you

Yes, I do use the Smart PSS camera utility to set the day/night times. The overall issue is that the time here changes at the rate of 40 minutes per week(for this time of year) or about 6 minutes per day. Thus requiring frequent updates. Too bad that Dahua doses not include a camera utility that is based on ones location (lat/long) plus offset for their devices.

Appreciate the link for the NVR info. Do not use BI but did notice that Hubitat will work with it for sun up/down applications.

Thank you

Understood... I was in Fairbanks a few years ago on business and the sun came up around 10 am and went down around 2 pm. Not sure I could handle that for very long.

Thanks for the links on the Dahua API information. Changing some of the other settings based on day/night would be ideal. However, the main goal is to only do the sun rise/set switch.

Since the Hubitat hub is running 24/7 would rather not use the Windows desktop. The hub is on 24/7 already, so the thought if possible it could be used for another control application as it does an excellent job in switching outside lighting based on location.

The other option is to go with the Raspberry Pi 4 as that would also work. But again, it is adding another system that needs care and feeding!

Will take a look at the links you provided on ip cam talk. That is a good site. However, a bit on the thin side for Hubitat integration IMO.

Thank you

If you decide to go with this option you might want to look into Home Assistant. There is a Dahua integration that does exactly what you're looking for.

If your cameras respond to the http commands, then integration with Hubitat is simple. You can use rule machine to send those http requests based on any triggers and conditions that meet your needs.

Would like to give this a try. Can instructions be provided to make up a test to see if HTTP commands will work either with the camera or NVR using the hub?

Here is a screenshot of a rule I use to control the input on one of the zones of my whole-house audio system. It’s a very simple rule; just a trigger and an HTTP post action.

You’ll need to confirm whether your cameras are expecting an HTTP POST or GET (rule machine can be configured to send either).

That will help. So far today found out that yes the NVR and/or cameras use "The HTTP APP is taken in GET form". Was successful in using FireFox with an HTTP request to change the camera from color to B/W.

Terk supplied the Dahua API HTTP guide version 1. Also found on IP Talk version 1.67. Is there a more current version available?

The next issue is to add the user and password to the HTTP request. So far have not been able to make that work. Did the standard (user:password@192.168.1.XXX) and the password input box still shows up FF. Suggestions?

Once this works will then port over to Hubitat and see how it performs.

One interesting note is that the cameras are listed from 0-15 in the API. Thus camera four is actually camera three when using the HTTP request.

Thanks again for your screen shot and assistance.

Jim

The HTTP request is a SET. Here is the URL used to change the camera from color to B/W.

"http://192.168.1.108/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[3].DayNightColor=2 "

This works in FireFox and would assume it would also work with Hubitat once the user and passwords issue is resolved.

Note: This is actually camera 4. Dahua numbers their cameras in the API from 0 through 15. Day/NightColor 2 is monochrome.

Jim

Solved the issue when using FireFox to access the cameras on the NVR. Prior to the change, the user/password had to completed by filling in a pop up form field. The solution was to add port 80 to the URL as in the following URL.

Blockquote
http://user:password@192.168.1.108:80/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[1].DayNightColor=0

Did a quick test using the Hubitat C7 hub and the camera can be switched from color to B/W from the Hubitat interface. The Rules Machine, once setup, should be able to switch all the cameras from sun up/down using the included trigger functions. Will have to check for the proper syntax in the Dahua HTTP API.

Thank you all for your kind assistance.

Jim

1 Like