Notifications with Frigate

If you use Frigate for motion detection, you’ll want notifications.

The trigger for the notification automation is straightforward, and exactly the same as any motion sensor:

You’ll then probably want to set a condition, such as only notifying when you’re out, or at certain times of day. I found the best way to do that was to use a manual alarm panel in Home Assistant.

The manual alarm control panel is basically a switch with three states – “disarmed”, “armed away” and “armed home”. You can set the state through other automations, such as presence detection, and it also supports the use of a key code for arming and disarming through the front end. Like many traditional alarm systems it also has a delay option, giving you time to leave the house once you’ve set it.

I set mine entirely through automations – “disarmed” when I’m home, “armed away” when I’m out and “armed home” overnight when I’m in bed. I wrote about it in more detail a few years ago, and while some of the details have changed since then, the basic functionality is the same.

The advantage of using the alarm panel is that your conditions for the notification automations are as simple as checking the state of the alarm, as other automations are taking care of whether the alarm should be armed.

To use the alarm panel as the condition for both “armed home” and “armed away”, your condition needs to check that the alarm is not disarmed:

You might also want some cameras to notify you only if the panel is set to “armed away”, or even to notify you without a condition. The third of my cameras is set to notify me all the time it detects motion. It’s at the side of my house, where I rarely go. It’s actually worth getting the odd false alarm, as it acts as a check that everything is working properly.

The last part of the automation is the action to send a notification. Obviously you’ll want a snapshot with the notification.

Frigate provides multiple camera entities for each camera, depending on which object types you’re detecting. For example, I have a back garden camera. The live feed is camera.back_garden but there is also a second feed called camera.back_garden_person.

This will show the most recent image that contains a person. If you’re detecting other object types there will be corresponding entities for each.

If you take a snapshot from the normal camera, there is a risk that the person will have moved out of shot between the motion being detected and the creation of the snapshot. By using the object camera – such as back_garden_person – you’re guaranteed to get an image of the detected object.

When I first set up notifications using Zoneminder I had to jump through some hoops to download a snapshot to use as an attachment for Pushover notifications. I did it that way because the Home Assistant companion app for Android required images to be downloaded to an internet facing directory that was not authenticated.

That’s changed, and you can now use files stored in the media library which are protected by authentication. There’s an even easier option if you use Android, which can use the camera proxy for attachments:

Note the other settings for ttl and priority – without these set, you may only get notifications the next time you unlock your phone.

It’s great getting notifications, but what if you want to do something about them? Typically you might want to have a media player play an alarm sound, or flash some lights. Rather than do so automatically you might want to check the camera first to ensure that it’s not a false alarm. Alternatively, you might want to manually disarm the alarm panel.

Obviously you could open up the app on your phone to do that, but there’s a quicker way using actionable notifications. The first thing to do is define the actions in the notification:

This will add buttons to your notifications:

You then need an automation to respond to the events that are raised when you press the buttons. The trigger will be the mobile_app_notification_action event, with the action name specified in the event data:

And then the action, which in this case disarms the alarm panel:

You can then respond to notifications directly from the notification panel on your phone. This is even more convenient if you have a smart watch, as you don’t even need to get your phone out:

I looked at actionable notifications last year, but this is the first time I’ve found a real world use for them. The combination of Frigate and Home Assistant makes for a pretty complete and flexible alarm system, and covers everything I need.

in Home Automation

Add a Comment

Your email address will not be published. All comments will be reviewed.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts