Blog

Advanced Home Assistant Automations

Home Assistant Automation and Why Randomness Beats Generative AI

Why My Cats Don’t Need Generative AI

Welcome to the next post in my series on the foundational configurations that form the bedrock of my Thinking Home. While we often focus on the hard logic of sensors and switches, there is a softer side to Home Assistant automation that is just as critical: Maintainability and Personality. If you are trying to figure out how to use variables in Home Assistant to avoid digging through code, or simply asking how do you do random alerts to keep your house from sounding like a broken record, you have come to the right place. The answer lies in the strategic use of variables and a little bit of chaos theory, or as we call it in YAML, random.

We live in an era where we expect our toasters to have opinions.

We have reached a point in technological saturation where the immediate impulse for solving any domestic problem is to throw a Large Language Model (LLM) at it. We want our homes to “think,” to “reason,” and to “compose” polite conversation. But sometimes, you don’t need a supercomputer to solve a problem. Sometimes, you just need a list.

Specifically, a list of complaints from a cat.

The Biological Imperative

In our house in Loja, Ecuador, we have two cats, Ari and Noodles. Like all biological entities, they operate on a strict input-output cycle. The “output” portion of this cycle requires access to a specific location: the main bathroom, where the litter box resides.

The problem is architectural. Humans have a habit of closing bathroom doors. Cats lack the opposable thumbs required to operate brass knobs. When these two facts collide, we enter a danger zone I like to call “The Carpet Risk.”

We needed an intervention. A way to remind the humans, my wife Randy and me, that the portal to relief was sealed.

The Over-engineered Temptation

Now, the “modern” way to solve this in 2025 would be to strap a camera to the hallway, feed the video stream into an object detection model running on a neural processing unit, identify the cat’s specific posture of distress, and then send a prompt to OpenAI:

“You are a disgruntled feline. Write a haiku about bladder pressure.”

The result would then be piped into a text-to-speech engine and broadcast to the house.

This sounds impressive. It is also, to use a non technical term, bonkers.

It introduces latency. It relies on the cloud. It costs money per token. And frankly, do I trust an AI not to digress and tell me the cat is actually planning a way to reign over us mere mortals? I do not.

There is a virtue in stewardship; in using the right amount of power for the task at hand. My Home Assistant server is a workhorse, but there is no reason to make it sprint a marathon just to say, “Open the door.”

The Elegant “Dumb” Solution

Instead of Artificial Intelligence, I used something far more reliable: Randomly Selected Hard-coded Sass.

I built a Home Assistant automation that does three things:

  1. Watches the door. If the contact sensor reads “closed” for 30 minutes, it assumes the worst.
  2. Sets a flag. It flips an input_boolean to ‘on’, creating a visual alert on my dashboard.
  3. Nags us.

The “nagging” is where the magic happens. I didn’t want the house to say the same robotic “The door is closed” every five minutes. That becomes background noise, like the hum of a refrigerator or the sound of politicians on the news. We tune it out.

To keep it fresh, I had to figure out how to use variables in Home Assistant to create a digital personality. I used a variables: block.

In the world of coding, variables are usually just containers for numbers or states. But here, I used a variable called cat_messages: to store a list of 26 distinct, hand-written pleas for mercy.

variables:  
cat_messages:    
– “Houston, we have a problem! The main bathroom door is closed…”    
– “Code Meow! The litter box is crying for freedom…”    
– “I’m a cat, not a camel! Ari and Noodles can’t just beam through…”

The automation simply picks one line from this list using the {{ cat_messages | random }} filter and sends it to our speakers. If you have ever wondered how do you do random selections in YAML without writing complex Python scripts, this simple Jinja filter is the answer.

Why Simplicity Wins

This approach is superior to the AI method for three reasons.

1. It is deterministic: I wrote the jokes. I know they are funny (or at least, “dad joke” funny). I know they won’t accidentally offend a guest or speak in a weird accent. The randomness is controlled. It feels organic, but the boundaries are set.

2. It is instant: There is no API call to a server in California. The logic runs locally on the N100. The moment the timer hits 30 minutes, the electrons do their dance, and the speaker speaks.

3. It is easily tweaked: Because I defined the variables at the top of the file, I don’t have to hunt through fifty lines of logic code to change the delay time or add a new Star Trek reference. It separates the what (the data) from the how (the logic).

The Ghost in the Machine

There is a tendency to equate “smart” with “complex.” We assume that for a home to be truly intelligent, it must mimic a human brain. But often, the most intelligent thing a system can do is be reliable.

My automation is a loop. It checks a sensor. It picks a string of text. It speaks. It repeats.

It is a digital Rube Goldberg machine stripped of all the unnecessary boots and pulleys. It doesn’t need to “know” what a cat is. It doesn’t need to understand the concept of a bathroom. It just needs to know that binary_sensor.door_bath_main_contact has been off for 1800 seconds.

And when I hear the speakers announce, “Great Scott! The bathroom door is still closed!” I don’t marvel at the neural networks involved. I just smile, walk down the hall, and open the door.

Ari and Noodles don’t care about the code. They just appreciate the open door. And really, isn’t that the point?

Steal This Code

If you want to implement this yourself, you do not need to reinvent the wheel. I have posted the complete automation to my GitHub repository. It is a perfect starter project for your own Home Assistant setup. You can grab the YAML, swap out my entities for yours, and customize the list of grievances to suit your specific household pets.

https://github.com/TheThinkingHome/Automations/blob/main/main_bath_litter_box_obstruction.yaml

Leave a Reply

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