Home Assistant Automations - Share Your Best Ones

We all have creative little gems hidden away making our lives run as smooth as possible, post your finest works here!!

To start the thread off I thought this was a worthy candidate.

To keep my phones battery health in prime condition I have been keeping the battery below 80% as much as possible but recently hard wired a solution.

I have my iPhone run a shortcut when its battery reaches 80% which in turn updates its sensor values in HASS. HASS has an automation to turn off my bedside phone charger if my phone goes above 79% and turns back on when it falls below 70%. So now when I wake up my phone battery will always be 70% or above. No more starting the day with 21% battery!

All this effort has paid off though. My phone is 2 years old and still has 91% battery capacity

9 Likes

Right now I have automations for my home exterior lighting and also my heating pads and grow lights for my indoor nursery for my plant starts.

1 Like

I don’t have air conditioning, and it’s not really necessary because of the mild weather in the PNW, but some afternoons it gets toasty (especially if the oven is running) so I would find myself checking the outdoor temps a lot.

So, I set up an automation that compares the temperature inside and outside, and sends me a text when it’s time to open the windows and cool the place down. Won’t work for all climates but it saved me money (compared to owning and operating an ac unit).

4 Likes

Not sure if it’s a β€œbest” one, but I have an automation running on the 1st day of each month to reset EnergyTotal counters on my Tasmota smart plugs. That way I can look up how much energy each device uses each month.

5 Likes

I also live in the PNW. When we had the record heat 2 years ago, my mini-splits came in clutch.

1 Like

I use it to play a doorbell sound on my sonos speakers when a unifi doorbell is pressed. It is actually better functionally than the unifi chimes.

3 Likes

my newest automation is simple, using Shelly 1 Mini Gen3 (smart relay) device which is mounted behind a light bulb #1 in the toilet. There are 2 bulbs - one produces a lot of light and the second bulb produces a small amount of light - which is enough at night.


                                                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” 
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚           β”‚ 
       β”‚              β”‚                  β”‚ Shelly 1    β”‚     β”‚ LIGHT     β”‚ 
  ──────              β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€ Mini (Gen 3)β”œβ”€β”€β”€β”€β”€β”€  BULB 1   β”‚ 
       β”‚  common      β”‚           β”‚      β”‚             β”‚     β”‚           β”‚ 
 AC    β”‚  switch      β”œβ”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€(smart relay)β”œβ”€β”€β”€β”€β”€β”€           β”‚ 
~230 V β”‚  on the      β”‚       β”‚   β”‚      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚ 100%      β”‚ 
       β”‚  wall        β”‚       β”‚   β”‚                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 
  ──────  (ON/OFF)    β”‚       β”‚   β”‚                                        
       β”‚              β”‚       β”‚   β”‚                                        
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚   β”‚                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” 
           β–²                  β”‚   β”‚                          β”‚           β”‚ 
           β”‚                  β”‚   β”‚                          β”‚  LIGHT    β”‚ 
           β”‚                  β”‚   └───────────────────────────   BULB 2  β”‚ 
           β”‚                  β”‚                              β”‚           β”‚ 
     user can turn light      └───────────────────────────────   5%      β”‚ 
         ON or OFF                                           β”‚           β”‚ 
                                                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ 

Shelly 1 relay will turn the β€œday” lightbulb ON only during day time (6:00 - 20:00).

When you turn the light on at night (for example at 20:30) only light bulb #2 will be on :slight_smile:

Great about Shelly relay is local scripting. It can work without Home Assistant. So it’s still working independent on some central point of failure (Home Assistant or Node-RED or another home automation solution).

As you may have noticed, my Shelly is not powered on most of the time. Only when I switch on the light using the wall switch - at that moment Shelly quickly boots up and within 3 seconds it connects to Wi-Fi and gets the current time from my NTP server on my Mikrotik router and based on the current time the simple logic in Javascript decides whether to activate or deactivate the relay (light bulb).
Also Shelly can remember last state, immediately after boot it activates last state. So only once between day and night it really needs adjust it’s state based on logic in local script.

3 Likes

Ive got a few that have made my life much easier

-grow lights for plant starts turn on and off with the sunrise/set

-closure sensors on fridges and freezers send warnings to phones and eventually if not addressed to the home theater in the form of a sound recording of my partner yelling about the freezer. (Her biggest nightmare is losing a whole chest freezer of food due to defrost)

-automation that checks the brightness outside/sun height when you turn on a light and adjusts its brightness and tone accordingly. No one likes bright white at 2 in the morning.

4 Likes

To choose just a couple of my helpful ones:

Radon and Air Pollution Control

My wife and I live in a rental a manufactured home/trailer that we discovered has high radon levels. It’s common where I am in Colorado, and the trailer skirt acts to β€œtrap” the radon, where it then seeps up into the house.

To mitigate this (not being able to modify a rental) I have a smart air quality monitor (an Airthings View Plus) that HA monitors. When the levels of any of the air quality components (radon, CO2, VOC, PM2.5) get above levels I define in the automation, it will turn on a smart window fan (Vornado Transom via Alexa Media Player on HACS) to bring in fresh air and put the house in a positive-pressure state. In addition to this, I have limits to prevent the automation from running if it’s too cold or hot outside (32F or 85F) as well as if the air quality outside is worse than it is inside (like during forest fire season). This also coordinates with my Generic Thermostat integration (since I also use the window fan as a β€œcooling” device whenever outside ambient temperature is below the interior temp when cooling is requested) to not turn on or off the fan if something else is calling it.

AI Assisted Food Categorization

Using HA Voice and the Ollama integration, I have a local AI server running on my desktop computer that HA uses for the integrated assistant. In addition to general commands like β€œTurn on X light”, I wanted to use the reasoning skills of the AI assistant to help me keep track of my nutrition intake. This was a little more advanced than normal voice commands and fell outside of the built-in intents. So I needed an automation that would trigger on a voice command input, pass the information to the AI assistant, capture and parse the output, and then do an action based on keywords found in that output. Something like saying β€œCategorize a pepperoni pizza” will generate a response that says β€œSure. Categories: Starch, Protein…” ect.

I already had built my wife a dashboard in HA (as a Christmas present lol) that allowed her to record by category what she had eaten that day or week. Each category has an input helper entity that gets incremented as necessary by recognizing key words in the response output. Here’s a section of that dashboard for those who are curious:

It works surprisingly well, but I want to do a lot more with this workflow, and it’s been tricky. I’d like the AI to toggle the entities directly, instead of having to parse the output in a β€œdumb” way. If I expose the food category input_number entities to the assistant, it does recognize correctly what it needs to toggle, but it can’t actually increment the input numbers because there isn’t an β€œintent” for that. When I’ve tried to play with custom intents, I get stuck. It seems HA wants to grab an intent before it gets passed to the AI, whereas I want to determine intents based on the OUTPUT from the AI. More reading I need to do there.

Spotify Album Art Background Color

Finally, on a more easygoing note, I have an automation where I use the Color Picker integration to analyze the image displayed on my AndroidTV when Spotify is playing. Based on that hex color code, I set the accent light behind my TV to that album color. It’s fun :grin:

1 Like

My sprinkler automation is pretty cool, uses local sensor with online weather data to run the sprinkler system using some zigbee relays. Its winter so my moisture sensor is inside with the batteries out, which breaks the status markdown card, but normally the status shows when each program last started, ran, its runtime. Along with tell you what programs and stations/zones are running along with gives an time remaining for everything, along with the running station/zone. I have 5 programs the Smart program is the main one the others are just for manually running any group of sprinklers. As you can see if you click the edit button for any prgram it takes you to a sub page to set the program. Also using the image buttons on the buttons for each sprinkler zones manual start so the so doesn’t have to guess which station/zone is which. To post the automations and jninja2, and helper entity configuration that makeup all of this would be close to ~1200 lines.


2 Likes

If you’re a Geek and have solar, you really need to hook it up to Home Assistant.

This is my Node Red Home Assistant program that I wrote to maximize solar battery usage. Our power company charges much more to sell us electricity than they pay to buy it from our solar, and we are on a time of use plan, so minimizing usage during the peak periods is a big money saver:

It’s kind of a mess currently, but running 24/7, and working pretty well.

This shows a real-time view of the status of the energy flow:

3 Likes

This is what you get almost for free once you get the sensor feeding into HA. Unfortunately it looks like I removed tracking of total charge and discharge of the battery, so the battery shows 0 currently:

1 Like

How is this different from Homey Pro?

Is your question β€œHow is Home Assistant different from the Homey Pro?”

If so, having very little experience with the Homey, I would say the main difference is privacy and control. Home Assistant puts everything within your (the user) control. Whilst there are options to use cloud services, Home Assistant can and will run 100% off line. You can set it up on and get it working and have it NEVER hit the internet. Your data stays yours. Metrics, CCTV, personal notes, usage stats. The list goes on. There are quite a lot of options for those who just want the functionality and don’t care about privacy or where the lack of privacy is heading as far as β€œBig Tech” etc are concerned. Amazon, Apple Home Kit, Homey Pro.

Does the Homey offer the same control and privacy?

There is also a bigger choice of hardware you can run Home Assistant on. You can use an old PC, a raspberry pi or a newer high end system depending on what you use case is. Home Assistant is flexible and as Wendell has mentioned in his latest video, quite mature at this stage.

I have personally been running the same install of Home Assistant for several years and it is only becoming more and more robust and stable.

I hope this helps! Feel free to hit me up or reply if you are unsure about anything or need help spinning up your own Home Assistant. Trying it is FREE!!!

EDIT: I just did a quick check, the Homey Pro costs € / $ 2.99 per month. If the above wasn’t enough to sway anyone, perhaps β€œMONEY” is a consideration.

my favorites

-Living room has 7 scenes thy can be called independently in the app (via dashboard buttons) or through an ikea Styrbar. The scenes will loop around from 7 to 1 or from 1 to 7. This makes it not need to remember which β€œend” of the list I am in. My favorite part is that I have a notification on the TV for which scene just got called.
-In the living room when a Borg episode plays on Plex a Borg light scene is called (turns a few of the lights green while leaving the work lights where they are) the original scene is called when the episode ends or is otherwise stopped. Does nothing when the ep is paused.
-while working from home HA monitors the volume of network traffic from my voip phone and turns a light blue when it looks like a call is happening
-when coming home and my phone has just connected to WiFi, when our back door opens the living room lights come on, the LVRM tv comes on and attempts to play our β€œbigg shuff” playlist. It tries with the playing, but it does always get plex pulled up
-motion sensor in my stairs turns on a few lights and adjusts them according to Adaptive Lighting. In the evening after the tv has been off for at least 20 minutes it will change to an explicit sleeping light.(really dim red) if the tv comes on at any point it will go back to Adaptive Lighting. The bedroom has a switch to force the sleeping scene when someone wants a nap in the middle of the day

I’ve got a few others, but those are my favorites

3 Likes

My current Home Assistant system hardware is running on a 8GB Raspberry PI 4 with a voice assistant using a Raspberry PI Zero 2 W with a 2 mic ReSpeaker, some of the motion sensors and temperature sensors are home made with ESPHOME and ESP8266 micro controllers, and a LLM running Ollama 3.1 AI on a AMD 7800X3D with a Nvidia 3090 linux desktop connected to the voice assistant. My devices include lights, motion sensors, water sensors, temperature sensors, humidity sensors, door sensors, power monitoring, Cameras and a voice interface. Remote access via a split turned VPN. My automation are; Door chime (Played over the HomePods and Google homes), Detect garage door left opened, Hallway motion light, Front Foyer motion light, Detect when someone is leaving the house or coming home, Back Foyer light (on when door is opened), Basement office motion light, Basement stairs button 2 double press turns off all basement lights (Office, stairs, laundry), Kitchen motion light, kitchen motion lights at 100% during the daytime stays on for an 1 hour, Kitchen motion lights at 5% at night stays on for less than a minute. Living room 4 button remote, bedroom 4 button remote, HVAC UV light turns off after HVAC has been off for 5 hours, Alerts when water in basement, Alerts when water is on bathrooms floors. My voice assistant’s wake word is β€œHay Zen” (The computer from the 70’s TV show Blake’s 7). My main dashboard is the floor plan of the house and the lighting of the image changes if the light in the area is on. I 3D printed a case for my Voice assistant to look like the Zen computer.
zen-level1
house-level1

1 Like

What sort of latency are you getting from your voice assistant?
I recently tried the same setup but using a M1 mac mini with 16Gb RAM to run ollama over the network but found the latency was just a bit too much to make it usable.

Any setup tips to improve latency?

It is slow, about 11 seconds to respond to any question or control. I was thinking it was the Pi 4. Maybe moving Home Assistant to a docker container on my Linux desktop will help. While things do work ok, the number of things it hears wrong is very high, maybe around 30%. And with my custom wake word, it is going off all the time miss hearing things and just adds junk to my shopping list. I did just switch to speech-to-phrase and most responses are about 4 second, but I am still testing.

1 Like

If you run whisper or if your using an llm through ollama in a docker container on your desktop where that will run faster leave ha on the pi, then just point the integration at the correct ip and port for the container.

This is how I have it setup. HA in a VM under proxmox with a good amount of resources under its command and then Ollama running on a M1 Mac mini with 16Gb of RAM.

I feel like my network is running poorly as I never get full speeds on it and perhaps this is an area that could be improved. But at the same time, it sounds like you were getting similar latency as me with a different but the same setup.