Change Day Schedule on Dahua IP Camera via Dahua API

Yeah... this is way above my skill set. This is just way too much information to absorb and figure out. I thought maybe it would be something simple, but it ain't for me.

The freelancer will have to do for this, or I'll have to live with setting the time plan for each camera and live with it being off a good bit from beginning of the month to end.

Gotta have a month code app to change the month... whew... just when you think you might have a grip on it... boom... add another "gotcha". lol

Yep the month part is what really screws it up LOL.

I ended up finding a chart of the daily sunrise/sunset for my area and did the average time for each month and then used that in the monthly part of the GUI and have it start daytime 15 minutes after the sunrise and end 15 minutes before sunset and it works well enough that I haven't screwed around anymore with trying to have it be something BI or the utility could do.

Another wrinkle is the APIs are different whether the camera has infrared or not, so when I came across that, I settled for just setting up the monthly.

Now if there was a way to export just that out to add to another camera LOL.
 
  • Like
Reactions: Leroy60
Yep the month part is what really screws it up LOL.

I ended up finding a chart of the daily sunrise/sunset for my area and did the average time for each month and then used that in the monthly part of the GUI and have it start daytime 15 minutes after the sunrise and end 15 minutes before sunset and it works well enough that I haven't screwed around anymore with trying to have it be something BI or the utility could do.

Another wrinkle is the APIs are different whether the camera has infrared or not, so when I came across that, I settled for just setting up the monthly.

Now if there was a way to export just that out to add to another camera LOL.
Another wrinkle? All of my cams have IR, I think, so maybe that would not matter for me. No... wait... the B180's do not have IR. Ugggghhhhh.

So I'm wasting time trying to find a freelancer to do this, huh?

Yeah... I found a chart for my area that I could pick the day of the month for sunrise and sunset, so just picked the 15th for a respectable average for the month. That also got me past the first and second week changes for daylight savings time, which is yet another kink for the Time Plan settings.
 
By the way, what do you run your HA install on? Perhaps a Pi4?
I have the green box... purchased for $99 from HA. I'm not sure what platform it's based on. They do a comparison of it vs the Rasberry Pi.

I just got it installed and connected to it for the first time tonight. I've had it for several months. It automatically recognized a bunch of stuff in my house, but really not sure what I'd ever use it for. I need physical automation... lol.
 
Interesting. May have to look into the green box or other alternatives. Looks like it will support Z-Wave and Zigbee but will require the addition of a RF device for radio connectivity. i.e. no RF radio built in.
 
Last edited:
Here is the APP code that is used in Hubitat to change the month variable. This is one way to make it work. Considering that HA has more hooks, etc this should be an easy task to implement.

PTZ_Month_Trigger.PNG

PTZ_Month_Actions.PNG

As a point of clarification, I name all variables both local and global as follows:

var_then_my_name_for_the_variable (var_ptz_month)
 
Last edited: