Day / Night profile switching

Lastly, are the indices at the very end of your calls just the different profile slots on the camera? Perhaps 0 is Day, 1 is Night and 2 is General?
Since you have the newer UI use a customized scene and for the profiles 0 is Day, 2 is Night and 1 is General.

Here's an example of how to set this up for Home Assistant...

Add the following to configuration.yaml file, adjusting the username, password and IP address accordingly.

Code:
rest_command:
  lpr_set_profile_day:
    url: "http://admin:[email protected]/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=0&VideoInOptions[].NightOptions.DayNightColor=0
    method: GET

  lpr_set_profile_night:
    url: "http://admin:[email protected]/cgi-bin/configManager.cgi?action=setConfig&VideoInOptions[].NightOptions.SwitchMode=3&VideoInOptions[].NightOptions.DayNightColor=2"
    method: GET

Then you can call these using automations.

Example: switch to day profile at sunrise

Code:
alias: ALPR Day Profile
trigger:
  - platform: state
    entity_id: sun
    to: "sunrise"

action:
  - service: rest_command.lpr_set_profile_day

Example: switch to night profile at sunset

Code:
alias: ALPR Night Profile

trigger:
  - platform: state
    entity_id: sun
    to: "sunset"

action:
  - service: rest_command.lpr_set_profile_night

Keep in mind that your focus from day to night might change as well. If it does, you'll have to change your rest commands accordingly.


 
  • Like
Reactions: oblivioncth
Since you have the newer UI use a customized scene and for the profiles 0 is Day, 2 is Night and 1 is General.

Here's an example of how to set this up for Home Assistant...
Thanks! I've done HTTP requests via HA before so this all looks like a pretty solid starting point. I do still wonder about the Customized Scene schedule's possible interference, but I'll try blanking it out like I noted before and just see if it works.
 
This is the API for both day/night and Web 4/5 Dahua cams.

Test in a browser before implementing in either HA or Hubitat.

For Web 4 the Profile Management is set for Full Time. For Web 5 it is Customized Scene.

One can also use PowerShell for mode switching, but Hubitat is the simpler solution using the Rules Machine, with local rise/set times with an offset or Hubitat with an external LUX sensor in place of time.
Thanks, this obviously is more on the nose for changing the actual mode. I've been pursing the API doc and poking around one of my cameras via curl.

Seems like the VideoInOptions portion might have been deprecated actually (from the manual):
It’s not recommended to use the CGI command from “ video in options ” ; It’s now recommended to
use the commands in 5.1 – 5.7

but even if that's true, I'm going to get this working using the "known" method first, before reading through those sections for a possible modern equivalent.
 
(Sorry for the multiple replies, the forum maintenance keeps particularly getting in my way for edits)

It seems that note in the manual does make sense, as most of the VideoInOptions were broken down into smaller sections via the endpoints mentioned (5.1 - 5.7); however, having had more time to look at the sheet, it seems that the 3.26 version listed on empiretech's site is a few years out of date now (and I guess pre-dates the WEB 5 devices), as nowhere in there is there a "VideoInMode" section. That endpoint clearly is reflective of the newer Customized Scene section since it seems to you reference the profiles directly by name, per Alaska's example.

@Alaska Country can you share, or do you know where I may find documentation of these newer endpoints (evidentially you have knowledge of something :) )?

I've found a few other documents that mention "VideoInMode" via Google (like for Amcrest, I guess just rebranded), but ironically they seem much older and don't mention "ConfigEx" as a parameter.

Or perhaps you just poked around enough to find this section?
 
Last edited:
I have 2 LPR cameras, one older and one newer. The endpoints I posted work on the newer one, which I assume you have.
I'm sure they very well would work, but it seems like a slightly older approach from before Customized Scene was added, and (correct me if I'm wrong), works by essentially forcing the Day or Night profiles from within the Day/Night Working mode, while simultaneously disabling auto-switch. At least, that seems to be the case from how those endpoints you used are described in the API doc. At the end of the day I can use it, but I'm curious about the newer endpoints highlighted by Alaska Country, which seem to be able to change to the various modes under Customized Scene directly by name, it's just I haven't found any documentation about them

On my camera I see
Bash:
C:\Users\Chris>curl --digest -g -u user:pass -k "https://camera/cgi-bin/configManager.cgi?action=getConfig&name=VideoInMode[0]"
table.VideoInMode[0].Config[0]=0
table.VideoInMode[0].Config[1]=1
table.VideoInMode[0].ConfigEx=Day
table.VideoInMode[0].Mode=2
table.VideoInMode[0].TimeSection[0][0]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[0][1]=0 00:00:00-23:59:59
table.VideoInMode[0].TimeSection[0][2]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[0][3]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[0][4]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[0][5]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[1][0]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[1][1]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[1][2]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[1][3]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[1][4]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[1][5]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[2][0]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[2][1]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[2][2]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[2][3]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[2][4]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[2][5]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[3][0]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[3][1]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[3][2]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[3][3]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[3][4]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[3][5]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[4][0]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[4][1]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[4][2]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[4][3]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[4][4]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[4][5]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[5][0]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[5][1]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[5][2]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[5][3]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[5][4]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[5][5]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[6][0]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[6][1]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[6][2]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[6][3]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[6][4]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSection[6][5]=0 00:00:00-24:00:00
table.VideoInMode[0].TimeSectionEX[0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[0][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[1][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[2][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[3][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[4][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[5][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[6][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[7][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[8][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[9][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[10][0]=00:00:00-24:00:00 Day
table.VideoInMode[0].TimeSectionV2[11][0]=00:00:00-24:00:00 Day

You can even edit the built-in time schedule if you wanted (though I don't lol)! Without the documentation I'm not sure what Mode nor the Config array are for, but Alaska somehow knows it should be 4 for this use case :)
 
Thanks, this obviously is more on the nose for changing the actual mode. I've been pursing the API doc and poking around one of my cameras via curl.

Seems like the VideoInOptions portion might have been deprecated actually (from the manual):


but even if that's true, I'm going to get this working using the "known" method first, before reading through those sections for a possible modern equivalent.

Dont know if you saw this post:
It's how I deal with setting day night on the newer V5 cameras.

Also attached the API from 2023... not sure how up to date this is.
 

Attachments

  • Like
Reactions: oblivioncth
Another member found "ConfigEx" to change day/night modes for the Web 5 cams. Have implemented that change and it works well with Hubitat.

Up to this point, with Web 5, have been manipulating "Time Plan Settings" to achieve the same goal. However, that process is not as simple as using "ConfigEx" for the mode switch.
 
  • Like
Reactions: oblivioncth
Dont know if you saw this post:
It's how I deal with setting day night on the newer V5 cameras.

Also attached the API from 2023... not sure how up to date this is.
No I hadn't but I appreciate it because it's useful to know the various different ways to try and accomplish the same thing, since they may have pros/cons.

I have that API doc already. It is the latest I can find as well, but ironically it doesn't include some of the newer Web 5.0 stuff even though it came out after that was introduced.

Another member found "ConfigEx" to change day/night modes for the Web 5 cams. Have implemented that change and it works well with Hubitat.

Up to this point, with Web 5, have been manipulating "Time Plan Settings" to achieve the same goal. However, that process is not as simple as using "ConfigEx" for the mode switch.
Exactly, this seems like the most straight forward way.

It seems then that this specific config endpoint is undocumented then lol, since it's not in the API manual and someone just had to find it. Well, I'm glad they did!
 
excuse me for chiming in Guys, i lately posted a thread about a dahua bullet cam with details etc and nobody helped...
yet i see this thread, im a power user, but i dont understand one bit of what you discussing here.

what are these V4, V5, or API? where are hubitat scripts go? are you programmers who make these systems for customers or why do you need this? what is a hubitat?

downloaded the attached APIs, i presume these are hidden switches so to say, but from where and how?
are there APIs for this cam too?

dahua F5D-PV

for the above cam, low light wasnt an issue bc of strong streetlights and ok sensor, but basically everything else was problematic, pre/post record time, person/vehicle sensitivity, keyframe interval, audio compression too high, setting different detection areas...

id like to make a 2 cam system that would detect(record) on a complicated set of rules, loitering and sound included, bc my current detection count is ~800/day, but i cant even get a cam thats transparent enough to start with.

ps: what i also didnt get, the OPs product codes show empiretech cams...
 
Ironically it seems that VideoInMode might itself be "legacy", yet was updated to properly handle the new Customized Scene profiles? I was able to find reference to it in older Dahua/Amcrest API guides. The most recent I was able to find it in is V2.63 (you can Google for it), but in that doc version it only has the values 0 and 1 for mode, and doesn't really explain what Config[] is for that section. It just implies it will have specific static values depending on what the value of Mode is. It seems Mode 0 may also work for reliable external control as the guide notes that should be "no switch", but I'm not sure if that's still true on these newer models. Regardless I'm going to give my setup a shot using this endpoint and ConfigEx, rather than the Day/Night specific ones.


excuse me for chiming in Guys, i lately posted a thread about a dahua bullet cam with details etc and nobody helped...
yet i see this thread, im a power user, but i dont understand one bit of what you discussing here.
The Dahua (and their rebrand) cameras has gone through different web UIs over the years, and the most recent two are V4 (which is grey and orange) and V5 (which is white and blue). Noting these is just helpful when clarifying where settings are because they have changed over time (new ones added,, etc).

The Web API is a separate thing that has also gone through various versions. It's a separate way to control the camera via making HTTP requests (in essence, the same thing as putting a URL in your browser) that offers more control that what you can just do through the UI alone. Unfortunately, they use a very old CGI approach and the API is somewhat cryptic and confusing in its nature. Not the most useable thing, but it seems to often get the job done.

Hubitat is a smart home platform, like Home Assistant, Samsung SmartThings, and (if I must include them) Amazon Alexa and Google Home.

A number of people, whether they be programmers, IT people, or are just good at tinkering, use things they have setup with their smart homes (i.e. sunrise/sunset data, light sensors, etc) to change their camera settings on-the-fly for a better image, depending on various conditions. The only way to do that programmatically is via this HTTP API.

This goes into a number of subjects that are complex and broad for a beginner.

I can only say I wish that not only was the API less of a beast, but that the cameras/Web UI had deeper features that reduced the need for the API's use in the first place, especially for the average user.

@Alaska Country The Web 5 example does work for going between Day/Night but sadly cannot seem to switch into the other profiles for Customized Scene. I think I'd be satisfied with two profiles, but maybe I can figure out how to switch to the others.

@Vettester, I just wanted to clarify a couple things. I see in your original post (which was presumably for your older camera), you modify the final .Config0 value, which doesn't work on my newer camera (as I imagine is expected). Your last example seems to go into day/night by using

head.NightOptions.SwitchMode=0 i.e. "NoSwitch, always use day options."

for day (while also forcing color mode) and

head.NightOptions.SwitchMode=3 i.e. "NoSwitch, always use NightOptions."

for night (while also forcing B/W mode).

Do you happen to know how to get into General Mode on your newer model? Perhaps head.NightOptions.SwitchMode=3 i.e. "NoSwitch, always use NormalOptions" ? Of course I could manipulate the NormalOptions section via the API directly, but I'd prefer if it lined up with a profile shown in the UI.
 
Last edited: