Announcing delivery vehicles using with Frigate, Home Assistant and Chime TTS

Announcing delivery vehicles using with Frigate, Home Assistant and Chime TTS
Photo by Andrew Stickelman / Unsplash

For over two years, I've relied on Frigate, an open-source Network Video Recorder (NVR) with real-time object detection, as my home security backbone. Its robust integration with Home Assistant and MQTT has made it an indispensable tool, but my favorite feature goes beyond traditional security: detecting and announcing delivery vehicles directly to my Sonos speakers. With Frigate, I'm not just monitoring my driveway—I'm getting precise, instant notifications about which delivery service just dropped off a package.

Frigate's advanced object detection supports identifying vehicles from Amazon, DHL, FedEx, UPS, and USPS. However, you'll need Frigate+ to unlock the model that can distinguish between these specific delivery services. This guide assumes you already have Frigate set up and integrated with MQTT and walks you through creating a smart delivery announcement automation.

The key to avoiding duplicate triggers lies in using an MQTT trigger with a template that detects only 'new' values. Pro tip: You'll need to switch to YAML editing, as the visual automation editor doesn't support templates for the MQTT trigger.

trigger: mqtt
topic: frigate/reviews
payload: new
value_template: "{{ value_json.type }}"

Trigger (when)

Then, I use an 'and if' (formerly, condition) to proceed only for events where a delivery vehicle was detected:

condition: or
conditions:
  - condition: template
    value_template: "{{ 'amazon' in trigger.payload_json['after']['data']['objects'] }}"
  - condition: template
    value_template: "{{ 'ups' in trigger.payload_json['after']['data']['objects'] }}"
  - condition: template
    value_template: "{{ 'fedex' in trigger.payload_json['after']['data']['objects'] }}"
  - condition: template
    value_template: "{{ 'dhl' in trigger.payload_json['after']['data']['objects'] }}"
  - condition: template
    value_template: "{{ 'usps' in trigger.payload_json['after']['data']['objects'] }}"

Condition (and if)

Finally, my action is to set a value for an input_text helper that I've created before. I have a separate automation that announces the value of said helper whenever it's value changes. For my TTS, I use Chime TTS because it does a great job of managing my speakers, generating a chime that precedes the TTS and local caching. Alternatively, you can go straight to a text-to-speech (TTS), push notification or whatever you prefer.

action: input_text.set_value
target:
  entity_id: input_text.last_announcement
data:
  value: >
    {% set json = trigger.payload_json %}
    {% set frigate_objects = json['after']['data']['objects'] | default('no
    objects') %}
    {% if 'amazon' in frigate_objects %}
      Amazon is here!
    {% elif 'ups' in frigate_objects %}
      UPS is here!
    {% elif 'fedex' in frigate_objects %}
      FedEx is here!
    {% elif 'usps' in frigate_objects %}
      USPS is here!
    {% else %}
      Vehicle detected!
    {% endif %}

Generate text to announce based on the type of delivery vehicle detected

I then add a delay of 3 minutes, to eliminate the likelihood of generating multiple notifications from the same delivery vehicle.

delay:
  hours: 0
  minutes: 3
  seconds: 0
  milliseconds: 0

This keeps the automation running for an additional 3 minutes, if it is triggered again during that time, it won't run again.

This guide demonstrates how to leverage Frigate's advanced object detection to transform your home security system into a smart delivery notification platform. By combining Frigate+, MQTT, and Home Assistant, you can create an automation that precisely identifies and announces delivery vehicles from Amazon, UPS, FedEx, DHL, and USPS directly to your speakers.