Is there no camera brand that can be controlled from HA (on/off, motion recording on/off)?

Hi all
To keep this short I’m looking for POE cameras (indoor and outdoor) that can be turned on/off from Home Assistant or where I can toggle motion recording on/off. The reason is that I would like (especially) the indoor camera to only be active/recording/detecting motion when my house is armed.

I have been reading a lot about this and thought Amcrest was the way forward but apparently not. Price, brand and other features aren’t that important.

Can someone please let me know if this can be done and what brand I should go for. Thanks.

This is probably too simple, but cut the power to the POE injector when the alarm is disarmed.

I have gone thru this so let me tell you my story and where I am standing now.

Most cameras have a REST API or similar where you can get or set virtually any setting, you can simply use POST/GET HTTP requests to manage it, in some cases you’ll have to send specific parameters/XML.

You’ll find these manuals online depending on the maker. This works but your camera recording will be stuck with whatever options the camera supports whether it is cloud recording or to a microSD, if you’re lucky it will support your cloud storage options, FTP, etc.

In order to further customize your setup you can get something like MotionEye, it works. It will take care of the recording (even as far as uploading to your own Google Drive) and could also take of other stuff like motion detection, schedules, triggers, etc. It’s controllable via their API.

So I had a mix at first, I controlled my cameras PTZ directly with the CGI commands and all the recording and motion sensing on MotionEye with their API. I even had a trigger in MotionEye for certain cameras to do an HTTP request to my HA to send a notification to my phone that the motion sensing was triggered.

At the end of the day an update came and screwed my camera, it got updated to cloud only management with their own app or Google Assistant.

So now I have two cameras, DLINK brand and got rid of MotionEye (anyway it causes very high CPU and RAM usage).

Screw managing the recordings and having more components, I was unable to use the REST API on my camera after that update.
I had a cheap Xiaomi camera hacked and it was very unreliable, so I’m sticking to DLINK with their default software and recording options. Still worried about privacy issues but I either have the camera turned on and recording or completely turned off. You either want privacy or not, I’d never ever leave my camera recording while I’m home unless there’s contractors remodeling or working on something around my house.

So now these two cameras record to their own cloud providers as I have no other choice as microSD defeats the purpose as if someone breaks in they can just take the camera/MicroSD with them.

One of them is connected to a smart plug, the other one to a an Ubiquiti Unifi Switch PoE.

So I just control the power with the smart plug or the PoE switch based with a simple automation like the following one:

Either they’re on and recording or they’re not. I don’t see an scenario where I want to turn off motion detection but still have the camera turned on.

The only caveat of this is that the camera takes about 1-2 minutes to turn on and be available for streaming.

Works reliably, haven’t touched it in over a year. No issues with the camera not streaming, recording or whatever.

The bright side of my setup is that if you’re out of town and your HomeAssistant or PC where you have MotionEye, BlueIris or whatever decides to crash the camera recording/controls are independent from it. Also it can be independently managed with their app and I can still manage the power via the Unifi Controller for the PoE camera or the TP Casa app in the case of the camera connected to a smart plug (TPLink smart plug).

@Hellis81
Yes, that has been my plan to be honest. Might not be all that elegant but should work. Only concern is that in order to access recording when I’m not at home I need an SD card in the camera, and if the camera is writing to the SD card when I cut the power I guess the card will be corrupted.

@gurbina93
Wow, that’s a lot of useful information! I have been debating this in my head for almost a year now and later this fall I have to get this in place when moving in to our new house. Investment and time makes me really want to figure this out in a way that works in the long run.

The Rest APIs sounds very interesting if I as a rookie can figure out how it works and if the manufacturer keeps that option open. Need to do some reading which cameras and manufacturers are to trust and go with.

I think that turning off the cameras is the best option, either by cutting the power to the POE Switch or preferably by getting a Unifi POE Switch where I can turn off the power per device. Just need to figure out if saving the clips to my own FTP (Home Assistant NUC), memory card or cloud is the best option. Would prefer cloud but not keen on monthly costs per camera since I just need the storage for a few hours.

So if I would get a Unifi POE Switch, maybe like this one, what else do I need to get in place in order to control the power to the devices? Read about a controller/gateway, what is that?
Could you also share your code for turning a specific camera of via the POE Swicth (your code sample was for the wallplug, right)?

What gurbina says makes sense.
There is an API in all ( or at least most) cameras.
They have a webpage that you control the camera with and that page uses the API.

Most likely it’s not encrypted data so either the API commands can be found in the html or by listening to post commands from the browser.

I’d definitely go this route!

Unifi protect cams and the protect integration does all this.

  • cams are poe and are awesome
  • no monthly fee, all local install
  • HA connects directly to NVR, no cloud
  • ha binary sensors for motion alerts are fast and reliable
  • ha switch for recording can change from always/motion/off
  • switching modes can be scripted (obv)

Also if you have them powered by a unifi switch you could also toggle the power to the switch port programmatically.

I’m using the protect cameras and counting the motion notifications using history_stats. If a camera gives more than xx motion events per xx time, you can fire off a related script. Like, if its also raining/snowing, then assume the motion is false alerts and turn off notification or turn off motion recording.

I’m using this in several locations and it works excellent, you won’t be disappointed.

1 Like

Nearly all cameras now offer free cloud recording but limited to certain amounts of cameras or time. For example DLink stores your clips for 1 day unless you subscribe.

The Unifi Controller is basically the Router Management portal, there’s an official add-on for HomeAssistant, you can install it and play with it. This is the Management UI you get:
https://demo.ui.com/manage/site/default

The good side is that you manage all components from the same site, the downside is that you need to run this software if you want to make any changes. You’ll need to make routine backups because if you lose the Unifi Controller you’re toasted. You can NOT make or check any setting, you’ll have to reinstall the controller and restore a backup. If you don’t have a backup you’ll have to do your network settings again from scratch.
If you lose the Unifi controller the network keeps functioning normally but you won’t be able to make changes or see anything on the dashboard.
This software can be installed anywhere PC, RPi, Server, Linux, Windows, Docker, wherever and however you want. Even when restoring you can switch to a different type let’s say you had the HomeAssistant add-on and the microSD died. You can install the software on a Windows Laptop and restore the backup, you’ll be like if nothing had happened to your network and will be able to check on the network settings and clients.

I do vouch for the Unifi Protect since you seem eager to go thru this route. They have several offerings quite a few new ones including an all-in-one router that has the NVR function built-in so you can just install a hard drive on it.

Or you can buy all the devices separately: a router, a switch and a cloud key (a cloud key is basically a small dedicated computer that runs the Unifi Controller software), or if you’re not using Unifi Cameras/Protect you can just install the standalone controller on any device for free (like the HA add-on).
Some models of the Unifi Cloud Key have the NVR function, you’ll just need to put a hard drive on it.

Very neat software and hardware. I think it’s the number one choice for most folks graduating from the consumer routers and really good value, no need for subscription or other bs stuff, the support community is pretty good just like this forum. Software updates and firmware updates are very frequent. It’s business grade gear basically.
Everything is so much better, coverage, speed, functionalities, etc. Even adding access points is like magic, you just plug it into your switch, let it get set up then you unplug it and move it wherever you want, connect it back to the power supply and voila, you have a mesh network.

Thank you both @gurbina93 and @VinistoisR!
Looks like the Unifi way is the best way forward. Kind of expensive if I go all but then I get a robust system that will solve alot of my needs.

Could you pelase comment on if I have understood the following correctly since this is an alternative and less expensive way:
I buy a Unifi POE switch and install the Unifi controller on my Home Assistant setup on my NUC. That way I can control each port (device) and turn them on or off. I can then go ahead and buy any camera that I like and be able to control the power to them.

What should I look for when choosing a POE Switch in order to be able to control it from Home Assistant?

Just get a dream machine pro. It contains a gateway, network controller, nvr, poe switch, all in one box.

Saves you a bunch of money and complexity.

Otherwise buy any unifi poe switch and a cloud key v2. I have them all - they all work the exact same. The unifi integration gets its information from the network controller, not from the switches directly. The network controller does a pretty quick job of notifying home assistant when new devices come online.

Turning each port on and off is cool, because you don’t need to reach for the cable. But you’ll find you won’t really use it… Unifi cameras are stable and, in my experience, don’t need to be hard rebooted like this. Firmware updates and settings are all taken over by the NVR (either running on the cloud key or in the dream machine).

2 Likes

Agree with @VinistoisR, that’s the easy way to go. Setting up everything from scratch if you’re not used to it or familiar with it will give you a hell of a time.

Anyway getting each complement separately is gonna be more expensive than just getting the Dream Machine Pro.
Just the switch you listed 200USD, the cheapest gateway about 100USD and the Cloud Key is gonna add up to the Dream Machine price and the performance is not gonna be anywhere close to it.
The cheapo gateway (USG and the USG4P) can barely support 1-1.5Gbps connection and when you turn on IPS it will be limited to 100 Mbps and around 250-300Mbps.
The performance difference is abysmal.

Even if you are gonna go with cheapo cameras with a smart plug, I still recommend you to upgrade to Unifi gear. At the end of day all your devices rely on it and it gives you so many new things to play with and that integrate with HomeAssistant.
It’s pretty common to see people complaining about smart plugs becoming unavailable in HomeAssistant and is often caused by network issues, same thing happens with cameras if they’re wireless.

I integrated Unifi with HomeAssistant to send me notifications about threaths, unauthorized devices, upgrades, etc via HTML5. (Even tho you can send email notifications natively from the Unifi Controller)
I also retrieve the periodic speedtest info, CPU, RAM, etc… and each network status I.e. VPN, LAN, LAN2, VLANs and their respective settings and info like state, IP (including public IP), number of devices, etc.
Device tracker also works like a charm with it.

It’s really kinda magical and good looking networking software. Even their iOS/Android app works superb and you can use them to troubleshoot WiFi issues like speed and coverage. It tells you which devices have network connectivity issues. So many things you’ll never regret buying it, you’ll actually very likely grow into it.

1 Like

So the Dream Machine and Cloud Key both let me control them from Home Assistant? This is very important to me.

Last question: I don’t need the Unifi WiFi router for them to work, I can use the one I have today (Google WiFi)?

Check the specs.

Dream Machine is a Switch, a Router, an Access Point, a Controller but no NVR.
The dream machine pro is the a pro version of it that also has NVR but doesn’t have a built-in Access Point, but much much powerful with more capacity and it might be upgradeable and more serviceable (haven’t checked on these, you’ll need to confirm).

The Google WiFi is a switch, router and access point.

If you want separate devices you’ll have to get a router, a switch, an access point and the Cloud Key Plus (which is the NVR and Controller).

The Dream Machine Pro is overkill but it has the NVR.
Neither one of the Dream Machine versions have PoE.

You can just buy the switch (don’t see why would want the switch unless you want the PoE feature) and the Cloud Key Plus (which is the controller and NVR), I think you could even just use the Cloud Key Plus with the cameras.

But it seems the price of the Cloud Key Plus is kinda obscene you might as well top up a little bit more and go with the Dream Machine which will grant you a big bump in network performance, capacity, features.

If you get Dream Machine Pro you can use a standard consumer router as an Access Point so you don’t have to get one. But in the case of Google WiFi I’m not sure if it can be used as an AP you’d need to check on that, they’re fairly basic and featureless devices that just works but don’t give you much control or features… since you’re going Unifi is recommend you one of their AP, they’re so much better than Google WiFi and it integrates with the controller. You can also have a mesh network with their AP, the coverage and speed is so much better. I’m using the AC LR, that thing is cheap and has huge range. The antenna is tuned for small and low powered devices like phones, smart plugs, tablets, etc which is a huge advantage as many times these devices can receive data transmission from the router but cannot send data back due to their small and low powered antennas. This might happen to you on public WiFi where you have signal and can received it but whatever data you transmit back is unable to reach router or the router is unable to pick the weak signals.

So whatever suits your budget best, you can just buy the Cloud Key and Cameras (which would be like any other NVR system) and you’re good to go.

Here’s the component for the NVR:

You’ll need to check how these integrate with HA and the capabilities.

But beware the Cloud Key Plus is 199USD retail price and the dream machine pro is like 379USD but has so many more features that neatly Integrate with HomeAssistant and will make your network so much better, the cloud key alone is kind of a rip-off.
Anyway you’ll grow into the network stuff that requires a proper router and a not a featureless Google WiFi.

For example we’ve been discussing all the stuff you can do with Cloudflare and a proper router on this thread:

1 Like

You can also buy any IP camera, connect it to zoneminder, and get the same behavior. So all is not lost if you want to go cheap. But you have to use zoneminder, and it’s old looking and a resource hog.

1 Like

Yes, that is a great option and I understand it works well. Just would prefer to not have my NUC handle these streams 25/7 but instead only record when motion is detected.

Yeah, I got rid of zoneminder because it was a resource hog. BlueIris is the same.

For me it would be a perfect solution if I could get them to work only when a camera triggers a recording based on it’s own motion detector. That way I would get all the benefits from the software and only process video data when motion is detected by the camera.

You can read which cameras can do that in openhab here and the same should be true of home assistant. The api cameras can have motion turned on and off and place very little load on your server as the motion detection is done in the camera.