Skip to main content

Lady Catterton's Automated Cat Alert System

image.pngLady Catterton isn't allowed outside, but she doesn't let that stop her from keeping a close eye on the neighborhood cats that pass by. Here's how she does it completely locally.

Lady Catterton runs Home Assistant OS on a spare HP Mini PC. You can read about how she set it up here: https://www.wswapps.com/books/home-assistant/page/setup-home-assistant-on-a-mini-pc

Lady Catterton runs Frigate NVR as an addon in HAOS to monitor her local cameras and detect objects. You can read about her setup here: https://www.wswapps.com/books/home-assistant/page/frigate-nvr

And finally, Lady Catteron has configured some automations in Home Assistant to let you know any time she spots a fellow kitty. Below is an example of how she does that. She prefers to post to Mastodon, but you can post your important news anywhere. Maybe one day she'll get more creative with her words as well. Kitten steps.

This automation config looks for cat events coming from Frigate on a specific camera only after the event has ended, to ensure we only post about it once. After posting, we delay for 5 minutes to ensure that we don't get too excited and post again right away.

alias: Mastodon - Back Door Cat
description: Posts to Mastodon with cat image when Frigate detects a cat
triggers:
  - trigger: mqtt
    topic: frigate/events
    payload: end
    value_template: "{{ value_json.type }}"
conditions:
  - condition: template
    value_template: >-
      {{ trigger.payload_json.after.label == 'cat' and trigger.payload_json.type
      == 'end' and trigger.payload_json.after.camera == 'Back_Door' }}
    enabled: true
actions:
  - variables:
      source_filename: >-
        {{ trigger.payload_json.after.camera }}-{{ trigger.payload_json.after.id
        }}.jpg
    enabled: true
  - delay: "00:00:03"
  - data:
      config_entry_id: MASTODON_ACCOUNT_ID_ASSIGNED_BY_HA_HERE
      visibility: unlisted
      status: >-
        A 🐱 just came by the back door!

        #cat #homeassistant #frigate

      media_description: >-
        I'm {{ (trigger.payload_json.after.score * 100) | round(1) }}% sure this
        is a cat!
      media_warning: false
      media: /media/frigate/clips/{{ source_filename }}
    action: mastodon.post
  - delay: "00:05:00"
mode: single

Improvements

  • Randomize the posted messages a but by defining a yaml file with a list of possible messages to be picked at random. For example, here are some of the intros which are then embedded into the status field when she posts:
>
  {{ [
    "Oh Boy!",
    "Here kitty kitty.",
    "Great Scott!",
    "A visitor has arrived!",
    "Mrrrp.",
    "*Slow Blink*",
    "Look!"
  ] | random }}

Leave a Comment