In this fifth episode of fully unlocking UniFi Protect with Home Assistant, I will show you a basic setup where my UniFi Flex camera is doing motion recording only between 10pm to 7am.
Pre-requisite
What do you need?
- UniFi Protect camera device and controller
- Home Assistant Hub with
- UniFi Protect Integration
In this guide you will learn:
- How to create a time event triggered automation
In Home Assistant, automation consists of 3 simple steps. You have a trigger i.e. what starts the automation. Then optionally check a condition. If the condition is met, perform an action.
In this case, trigger is a time and action is change UniFi Protect camera mode.
Start recording at 10PM
Configuration > Automations > Add Automation
Start with an empty automation.
Name: I recommend naming the automation that makes sense. Currently, Home Assistant does not support folder or tag to organize automation. Reddit user shared a clever idea of using Emoji at the beginning of the name to organize. I highly recommend this.
Trigger type: Time
Fixed time
At time: 22:00:00
You can read detail time trigger setup here, but it is in legacy/YAML format.
There is no condition to set here.
Action type: Device
Device: [UniFi Protect Camera]
Action: Turn on Record Motion [UniFi Protect Camera]
If you like to have continuous video recording, you can choose Turn on Record Always instead.
Be sure to hit SAVE at bottom right.
Stop Recording at 7 am
Now you will be creating the same automation except this time, you specify 7 am for trigger time. Action will be “Turn off Record Motion [UniFi Protect Camera]”.
Test
You can test each action by hitting “RUN ACTIONS” on Configuration > Automation screen or actual individual Automation as above. This button will trigger the automation independent of actual trigger.
So you can check UniFi Protect App or Web UI and see the mode of the camera changes appropriately with each action.