API to shut down the POE camera?

Els1

n3wb
Apr 20, 2017
29
22
I found API documentation for Dahua cameras and did a test with API shutdown call which worked however the POE camera would come back on roughly two minutes later. Is there a way to keep it powered off until another API call is issued to turn it on? The use case is I am thinking about adding a few POE cameras indoors and obviously I don't want them on when house is occupied and I want them turned on when away or certain ones turned on at nighttime when security system is armed. The alternative is probably adjusting video settings via API.

Thanks.
 
The cameras are not set up to do that. They are either on or off and don't have a standby that can be called up via API.

You could get some cheap wifi adapter that cuts power to the switch powering those or if you have a VMS simply have it disable the cameras in the VMS while home.
 
  • Like
Reactions: bp2008
It is strange that API documentation has a specific API call for shutdown what is its purpose then? As for powering off the switch, that's not an option since I use single layer 3 switch for the entire house though I can always add another switch for indoor cameras. Would have to look at BI to see if there is a way to disable the camera but my preference would be to have the camera powered off. I'll have to give it some thought.
 
Would have to look at BI to see if there is a way to disable the camera but my preference would be to have the camera powered off.
BI can handle that. Use /admin?camera=x&enable=0 for disable and =1 to enable.

I just tried these URL's and they work to disable/disable a bluebird cam that is streaming to Blue Iris:

http://‪BI-IP:BI-port/admin?camera=CamShortName&enable=0 (to disable).
http://‪BI-IP:BI-port/admin?camera=CamShortName&enable=1 (to enable)

For my Bluebird Cam:
For authentication, add "&user=BI-username&pw=BI-password" at the end, insure that under BI "Settings" => "Web server" => "Advanced" that "Use secure session keys and login page" is UNchecked.
 
Last edited:
BTW, @Els1 ,
You could set up a Shelly1-UL Wi-Fi switch, run it on 12VDC, close a switch on its input and have it send the HTTP command to BI to disable that cam, open the switch to enable it.

 
  • Like
Reactions: CanCuba
I will try the @TonyR fix but I found that under the cameras Settings-Schedule-Event Schedule you can set up Camera disable and Camera enable. I set up a rule for each and my attempt worked to disable but failed to (re)enable at the time that I entered.
I tried the Pause indefinitly and a Pause reset and it stopped recording during that time schedule but the activity was still visible on the screen.
 
Last edited:
  • Like
Reactions: TonyR
I will try the @TonyR fix but I found that under the cameras Settings-Schedule-Event Schedule you can set up Camera disable and Camera enable. I set up a rule for each and my attempt worked to disable but failed to (re)enable at the time that I entered.
That might be a bug, assuming you've checked and re-checked your settings. Does "override global schedule for this camera" need to be checked or makes no difference?
This is why I tried the HTTP enable/disable for a cam before telling the OP....you never know unless you actually try it.
 
It is strange that API documentation has a specific API call for shutdown what is its purpose then? As for powering off the switch, that's not an option since I use single layer 3 switch for the entire house though I can always add another switch for indoor cameras. Would have to look at BI to see if there is a way to disable the camera but my preference would be to have the camera powered off. I'll have to give it some thought.
Another option is to power off the switch port the camera(s) is/are connected to. If you are using fancy managed L3 switches, then you should have that ability in the switch API.
 
  • Like
Reactions: bp2008
Speaking specifically about Blue Iris, the "Profiles" feature is designed specifically for situations like this where you want different configurations to apply at different times. Via the profiles feature, you can do things like disable indoor cameras while you are home and re-enable them when you are away. Profiles can be automated via a schedule, geofencing, or API commands from external services (like a Shelly device, Home Assistant, etc).
 
BTW, @Els1 ,
You could set up a Shelly1-UL Wi-Fi switch, run it on 12VDC, close a switch on its input and have it send the HTTP command to BI to disable that cam, open the switch to enable it.


I have home automation software that talks to my security system so it knows when my security system is armed away or armed home and I can use the home automation server to make API call to BI.
 
  • Like
Reactions: TonyR
Another option is to power off the switch port the camera(s) is/are connected to. If you are using fancy managed L3 switches, then you should have that ability in the switch API.

Sadly, my old layer 3 switch does not have API though last night I read online about newer switches that I plan to replace mine later this year and they do have REST API so that is definitely an option to tell specific port to stop feeding power.