Putting eyes on the back of your Unifi G5 PTZ using Home Assistant

Or how to use other cameras and other outdoor sensors on your property to trigger PTZ preset changes

Putting eyes on the back of your Unifi G5 PTZ using Home Assistant
Unifi G5 PTZ camera mounted on a wall

On my property I have 4 cameras, one of which is a Unifi G5 PTZ which works really well when it can see something but unlike our parents growing up it doesn't have eyes on the back of its head. My PTZ is placed at the corner of my garage where 3 cameras around it are able to see various parts of it's PTZ view. Using this to my advantage i can have home assistant inform the PTZ that one of the other cameras is seeing motion so it can look in that area and I get 2 viewpoints. The fixed position the other camera and the PTZ moving to the area tha the other camera can see by using presets.

I wrote a blog posts recently Adding a tour or patrol mode to Unifi G5 PTZ using Home Assistant - Let's add a missing feature to Unifi PTZ using Home Assistant Automations so if you followed that this might as well be a part 2 to help you with getting your PTZ to notice things by the means of other sensors or "entities" that home assistant can reference.

So I have a smart doorlock and it knows when the door is locked, unlocked and open. I also have a Unifi Doorbell camera that knows if something is in front of it as well as 2 more cameras that can see my front yard and driveway. I also have my garage door which has an entity in home assistant so we know when the door is open, opening or closed and closing.

  • Smart Door Lock
    • Unlocked
    • Locked
    • Open
  • Front Yard Camera
    • Motion
  • Driveway Camera
    • Motion
  • Smart Doorbell Camera
    • Motion
  • Garage Door
    • Open
    • Opening
    • Closed
    • Closing
  • PTZ
    • Motion

With all of this data we can work out a bunch of stuff. Did the front door open? Maybe point the PTZ at the front door. Did the garage door open? Point the PTZ at the garage door. Did a car drive up in the driveway? PZT to the driveway. Having a second vantage point is really helpful and you have a PTZ you might as well have it look at the things i can't see in the yard that the other cameras can.

Doorbell Camera Motion

I started out by having the Doorbell Camera tell the PTZ someone is outside the front door.

When there is motion detected then tell the PTZ to look at the camera but also have it do some mode changes since for some reason the PTZ forgets to follow people when you have it change presets. In the previous blog post I explained HOW to setup the PTZ presets to move the camera to the preset location now we can use those presets to give us a second vantage point.

Front Door Open

If the front door opens I want the PTZ to also look at the front door to see what's going on.

When the garage door opens look at it with PTZ

So when my garage door opens I want to see whats going on outside of it might as well have it look at the garage door when its opening. What's nice about this is its look as it open vs once it is already opened so you get a bit more info before its fully opened.

What else could you do?

I think any external sensor can be used as trigger for the PTZ to go look at. Why not? For instance I have a chain link fence with a gate on it. If I had a sensor on it I'd add it as a PTZ Preset and then have the camera go look at it when its opening and closing. If i had a REALLY long driveway and had a beam cut sensor at the gate I'd have the PTZ look at the gate so you can see the car drive up. A fun one would be if you had a smart bird feeder you could have the PTZ look at that feeder so you get a second point of view.