One of my initial automations in Home Assistant was a Cat Tracker. We allow our cats onto an enclosed back porch on the west side of the house, where they relish basking in the afternoon sun. However, a recurring issue was forgetting whether the cats were indoors or outdoors, or sometimes even forgetting they were outside entirely. Enter the solution: The Cat Tracker. This automation utilizes a Boolean helper, an NFC tag, smart speakers, and a Mushroom Template card to help us keep tabs on our feline companions.
The purpose of the toggle helper is to track the cats' location (inside or outside) and to trigger and stop the automation. You can create the toggle helper using the steps below:
If desired, add a button to your Home Assistant dashboard that could be manually triggered. I've included the YAML for my Mushroom Template card bard below:
type: custom:mushroom-template-card
primary: Cat Status
secondary: |-
{% if is_state('input_boolean.cat_tracker', 'on') %}
A cat is outside.
{% else %}
The cats are indoors.
{% endif %}
icon: mdi:cat
icon_color: |-
{% if is_state('input_boolean.cat_tracker', 'on') %}
red
{% else %}
green
{% endif %}
tap_action:
action: none
hold_action:
action: toggle
double_tap_action:
action: none
entity: input_boolean.cat_tracker
Although optional, writing an NFC tag is an easy way to toggle the automation and provides an introduction to what NFC tags can offer for your home automations. They are inexpensive and easy to find on Amazon. The following steps need to be completed using the Home Assistant Companion app on a device capable of NFC.
This step toggle the toggle helper created in the first step. If an NFC tag was not written, this step can be skipped. The following steps can be completed using Home Assistant or the Home Assistant Companion app.
I've included the YAML for the automation below:
alias: Cat Out Reminder
description: Provide an aural reminder that a cat is outside.
trigger:
- platform: state
entity_id: input_boolean.cat_tracker
to: 'on'
condition: []
action:
- choose:
- conditions:
- condition: sun
after: sunset
sequence:
- service: switch.turn_on
target:
entity_id: switch.back_porch_plug_switch
- repeat:
sequence:
- service: chime_tts.say
data:
chime_path: /media/j-alert_generic.mp3
offset: 450
final_delay: 0
tts_speed: 100
tts_pitch: 0
volume_level: 0.5
tts_platform: cloud
message: A cat is on the porch.
target:
device_id: f1dbf28b268b6db14ce753df7a065459
- delay:
minutes: 10
until:
- condition: state
entity_id: input_boolean.cat_tracker
state: 'off'
- service: logbook.log
data:
message: "Cat reminder announcement repeated every 10 minutes."
name: Cat Tracker Automation
mode: single
Now we get to the meat and potatoes of the automation. This automation turns on lights if toggled on after sunset it turns on the back porch light and then repeats a message on smart speaker(s) every 10 minutes to remind you that your cat is outside.
alias: Cat Out Reminder
description: Provide an aural reminder that a cat is outside.
triggers:
- entity_id: input_boolean.cat_tracker
to: "on"
trigger: state
conditions: []
actions:
- choose:
- conditions:
- condition: sun
after: sunset
sequence:
- target:
entity_id: switch.back_porch_plug_switch
action: switch.turn_on
data: {}
- repeat:
sequence:
- data:
chime_path: /media/j-alert_generic.mp3
offset: 450
final_delay: 0
tts_speed: 100
tts_pitch: 0
volume_level: 0.5
tts_platform: cloud
message: A cat is on the porch.
target:
entity_id: media_player.all_speakers
action: chime_tts.say
- data:
name: "Automation: Cat Out Reminder"
message: Aural reminder played.
action: logbook.log
- delay: "00:10:00"
until:
- condition: state
entity_id: input_boolean.cat_tracker
state: "off"
mode: single