Spyke

How I use Home Assistant to help with my cats

I'm a big Home Assistant fan and power user. It's the home automation platform of choice in our house and I've added many devices and automations, sometimes to the chagrin of Rachelle.

We also have five cats so it only makes sense to use some automations to help manage all the cat chores.

Top row: Lily and Mac. Second row: Linus, Lennie and Polly.

The dashboard

To help me stay organized and visualize all the cat automations and functionality, I've created a cats dashboard. Let's walk through the dashboard, and I'll explain as we go.

Cat door

Our cats are indoor/outdoor cats and we have a SureFlap Microchip Cat Flap. This thing talks to a little Sure Petcare hub in our living room, and that hub is what connects to Home Assistant. It's Cloud Polling, which isn't the best but when I was shopping, I couldn't find one with better local connectivity.

It allows us to use Home Assistant to lock the door when needed so the cats can't go out. Home Assistant does this on a schedule. It's open during the day but prevents the goblins from leaving after sunset.

We have a little Unifi G3 Instant camera pointed at the cat door so we can see who's coming and going and fiddling around at the door.

All of our cats have a microchip and it uses this chip ID to only allow our cats in. That means no neighborhood cats or raccoons can use the door, thank you please. We also get presence reporting so we can generally see who's in, who's out and when they transitioned.

Automatic feeders

We have Aqara Smart Pet Feeders that we use to dispense breakfast and snacks. They're zigbee devices so they connect directly to Home Assistant and are fully local. No Aqara app needed for any part of it. These are pretty basic devices and I wish it could alert us on food level but alas, they simply dispense. The automatic feeders hit at 6 a.m., a time I set from a tile on the dashboard rather than hardcoding it. Cats go scattering every which way to get their spot at a feeder.

Litter boxes

We have two Litter Robot 4s we purchased used from Facebook Marketplace. They're Cloud Push, which means the internet has to be up for these to work correctly with Home Assistant (or I presume the Whisker app). This thing allows us to unlock a couple of fun automations.

Voice announcements when a Litter Robot is full

When a litter box is full, Home Assistant announces it over the speakers: "The black litter robot is full and needs to be emptied." Then when we're up there, we pull the bag of dirty litter and reset it. If it needs a top off, we do that too. With two litter boxes and five cats, we can go a few days before one of them needs to be emptied! Not bad.

Send the robot vacuum after a cat has used the robot litter box

This is probably one of my favorite automations. Home Assistant can detect when a cat uses a litter box, which allows us to trigger automations to send the Roomba to spot clean the litter box area. We gate when the vacuum can run as we don't want the thing running during the middle of the night if a cat goes to the bathroom.

Lennie is an especially messy litter box user so this has been a great automation.

Helpers and trackers

So there are several helpers and trackers we use to keep up with everyone's different dates and things and such.

  • Flea collar: We use Seresto flea collars and they need to be replaced about every 8 months. I set up a helper to track this so it announces it in the good morning announcement message when it's due.
  • Age: Based on their birthday!
  • With Us: Based on their gotcha date!
  • Yearly Vaccines: I've not built this yet but I plan to also track when each cat received their vaccinations so I can remember when it's time to reschedule.

Improvements

Cat door

I purchased the wrong cat door. When we first purchased it, we had Oliver and he was a bigger boy and I was skeptical he could fit through the smaller door. The problem is the larger door is all or nothing: locked or unlocked, for everybody. The smaller flap they sell can be set per cat. That would have been helpful in the past when someone was sick or wasn't confident using the cat door yet and we were going to be away. We could restrict the kitten or the sick kitty while letting the rest come and go as usual.

Automatic feeders

I wish the Aqara feeders reported food levels instead of just dispensing. I also wish the automatic feeders were the chip variety and allowed us to restrict certain feeders to only certain cats. Linus likes to go around and finish off everyone else's bowls.

Water fountains

We purchased an AquaPurr fountain but have never fully installed it. We had it in one of the bathrooms but disconnected it. My plan is to move it into the guest bathroom then hopefully we can stop fiddling with these little plastic filter ones. This thing doesn't connect to anything but it would be super nice to eliminate the water fountain clean chore.

Conclusion

So that's it! Thanks for reading this. Do you have any smart home automations that you especially like?

View original on infosec.pub
71

I bought a cheap pm2.5 sensor and got it working with ESPHome for my outdoor air quality sensor suite.

Long story short I'm in the process of building an outdoor air quality, temperature, humidity, pressure, and motion sensor setup for my front porch. One is the PM1006K which is a cheap (10.00 on Amazon) pm2.5 sensor. It's supposedly used in some consumer air filter systems and a review said it worked with ESPHome... well it does after a ton of poking and prodding with a little flogging of the wires.

The link is to the github page where I have the final product posted. I know there are better sensors available but they tend to run more and the really good ones use a laser sensor and burn out over time so it becomes an ongoing (some only last 8000 hours) expense.

This one is a DC01 Infrared PM2.5 Air Quality Sensor. And I'm pairing it with a DHT22 for temperature and humidity, a BMP280 temperature and barometric pressure sensor, an MQ-2 + MQ-7 + MQ-135 for hazardous gasses and smoke, and a BH1750 light sensor, a AM-312 + a HC-SR04 for motion detection. All running on an ESP32-S3 which is also acting as a Bluetooth Low Energy proxy.

All the code will be able to be found at https://github.com/nightshade00013/MuttMutt-ESPHome when it's 100% completed. But being the pm2.5 working correctly was a huge step in the right direction. And the main reason why I am posting this now so others who are interested in building a cheap sensor can get started.

I bought a cheap pm2.5 sensor and got it working with ESPHome for my outdoor air quality sensor suite.https://github.com/nightshade00013/PM1006KOpen linkView original on lemmy.world
55

Smarter Thermostat with Home Assistant

A smart thermostat was one of the first connected devices I purchased when I started building our smart home. I wanted automatic presence detection so the thermostat could set an away mode when we leave and "we're home" mode without us having to do anything. Never mind the fact that Rachelle and I both work from home and are both homebodies. On the rare occasion that we're both away from home, the house knows it, automatically! ;)

Throughout the year, I'd find myself fiddling with the set points though. 68°F (20°C) in February feels different than 68°F in August. So twice a year, as the seasons started to tip over into warmer or colder weather, I'd change the upper and lower bounds.

It feels weird to run the AC in winter or the heat in summer. We sleep with the thermostat set at 65°F (18°C). Our preference for day time temp is 68°F to 72°F (20°C to 22°C). So when we wake up, and toggle sleep mode off in Home Assistant, the thermostat sets itself to the day time values and turns on the heat to raise the temp from 65 to 68; even in summer. That bothers me. I'd rather the thermostat just set the lowest temp to 68 and allow the house temp to naturally rise.

Plus, I have all these damn sensors in the house, outside the house, and a weather forecast available. I feel like I have all the inputs needed to make some data-driven decisions.

My climate dashboard.

Goal

My goal was to stop running heat on summer mornings and AC on winter evenings. The set points stay fixed. What changes is the HVAC mode: heat-only, cool-only, or both.

Data

For Home Assistant to pick the right mode, it needs to know what's going on outside, so I made a couple of template sensors.

Outdoor Blend

It all comes down to one template sensor: sensor.outdoor_temp_blend. It's the average of three numbers: the current outdoor temperature, today's forecast high, and today's forecast low. The result tells me what kind of day this is rather than what the temperature is right this minute. That blend feeds sensor.thermostat_season, which labels the day heating, cooling or shoulder-season. The season is what picks the HVAC mode.

Why average instead of just reading the current outdoor temp? A 50°F dawn before a 75°F afternoon shouldn't kick the heater on for an hour at sunrise. The blend flattens out the time-of-day swings so the thermostat isn't reacting to a number that's about to change anyway.

- sensor:
    - name: "Outdoor Temp Blend"
      unique_id: outdoor_temp_blend
      device_class: temperature
      unit_of_measurement: "°F"
      state_class: measurement
      availability: >-
        {{ state_attr('weather.forecast_12_grimmauld_place', 'temperature') is not none
           and states('sensor.today_forecast_high') | float(none) is not none
           and states('sensor.today_forecast_low') | float(none) is not none }}
      state: >-
        {% set current = state_attr('weather.forecast_12_grimmauld_place', 'temperature') | float %}
        {% set high = states('sensor.today_forecast_high') | float %}
        {% set low = states('sensor.today_forecast_low') | float %}
        {{ ((current + high + low) / 3) | round(1) }}

Thermostat Season

sensor.thermostat_season reads the outdoor blend and labels the day as one of three states:

  • cool once blend reaches 68°F, holds until blend drops below 65°F
  • heat once blend falls to 55°F, holds until blend rises above 58°F
  • heat_cool for everything in between

The mode scripts (thermostat_active_mode, thermostat_sleep_mode, thermostat_away_mode) read this sensor to decide whether the thermostat should run cooling only, heating only, or both with a deadband.

That 3°F gap on each side is on purpose. Without it, a blend hovering right at 68°F would flip the HVAC mode every time the value bounced from 67.9 to 68.1 across forecast updates. The hysteresis means the season has to meaningfully change before the mode does. Once it decides it's summer, it doesn't second-guess itself over one cool morning.

- sensor:
    - name: "Thermostat Season"
      unique_id: thermostat_season
      icon: >-
        {% set s = this.state %}
        {% if s == 'cool' %}mdi:snowflake
        {% elif s == 'heat' %}mdi:fire
        {% else %}mdi:swap-vertical{% endif %}
      availability: >-
        {{ states('sensor.outdoor_temp_blend') | float(none) is not none }}
      state: >-
        {% set blend = states('sensor.outdoor_temp_blend') | float %}
        {% set prev = this.state if this.state in ['heat','cool','heat_cool'] else 'heat_cool' %}
        {% if prev == 'cool' %}
          {# stay in cool until blend drops below 65 #}
          {{ 'heat_cool' if blend < 65 else 'cool' }}
        {% elif prev == 'heat' %}
          {# stay in heat until blend rises above 58 #}
          {{ 'heat_cool' if blend > 58 else 'heat' }}
        {% else %}
          {# in heat_cool, transition based on outer thresholds #}
          {% if blend >= 68 %}cool
          {% elif blend <= 55 %}heat
          {% else %}heat_cool
          {% endif %}
        {% endif %}

Helpers

I built some helpers that allow me to easily set the temperature range. They're just input_number helpers, one pair per mode: day, night and away. The scripts below read them by name, so when I nudge the day time high from 72 to 71 on my dashboard, that's the number the thermostat gets the next time anything runs.

Putting it all together now

Three scripts do the actual work: thermostat_active_mode, thermostat_sleep_mode and thermostat_away_mode. They're deliberately dumb. Each one reads sensor.thermostat_season, picks a branch, and writes to the thermostat. That's the whole job. None of them know a thing about the weather.

Here's the day time one. I trimmed a couple of housekeeping steps off the end (it also flips some booleans and sets the fan mode) to keep the important part visible:

thermostat_active_mode:
  alias: Thermostat active mode
  sequence:
    - choose:
        - conditions:
            - condition: state
              entity_id: sensor.thermostat_season
              state: cool
          sequence:
            - action: climate.set_temperature
              target:
                entity_id: climate.t6_pro_z_wave_programmable_thermostat
              data:
                hvac_mode: cool
                temperature: "{{ states('input_number.thermostat_day_temp_high') | float }}"
        - conditions:
            - condition: state
              entity_id: sensor.thermostat_season
              state: heat
          sequence:
            - action: climate.set_temperature
              target:
                entity_id: climate.t6_pro_z_wave_programmable_thermostat
              data:
                hvac_mode: heat
                temperature: "{{ states('input_number.thermostat_day_temp_low') | float }}"
      default:
        - action: climate.set_temperature
          target:
            entity_id: climate.t6_pro_z_wave_programmable_thermostat
          data:
            hvac_mode: heat_cool
            target_temp_high: "{{ states('input_number.thermostat_day_temp_high') | float }}"
            target_temp_low: "{{ states('input_number.thermostat_day_temp_low') | float }}"
  mode: single

In cool season the script sets hvac_mode: cool and one number, the day time high. That's it. No lower bound anywhere in that call, so nothing can ask for heat. Winter is the same trick backwards, hvac_mode: heat and just the day time low. Only the shoulder season sends both numbers as a deadband, which is what I had before.

Sleep and away are the same shape. They just read their own pair of helpers.

What calls the scripts

Mostly, nothing new. My wake, sleep and away automations already called these three scripts, because that's how the house has worked for a while now. They picked up the season awareness for free. I didn't have to touch a single one of them. So that's cool.

The one thing I did have to add is an automation for when the season itself changes:

- id: thermostat_reevaluate_on_season_change
  alias: Thermostat, re-evaluate on season change
  triggers:
    - trigger: state
      entity_id: sensor.thermostat_season
      to:
        - heat
        - cool
        - heat_cool
  conditions:
    - condition: template
      value_template: >-
        {{ trigger.from_state is not none
           and trigger.from_state.state in ['heat','cool','heat_cool'] }}
  actions:
    - choose:
        - conditions:
            - condition: state
              entity_id: input_boolean.thermostat_away_mode
              state: "on"
          sequence:
            - action: script.thermostat_away_mode
        - conditions:
            - condition: state
              entity_id: input_boolean.thermostat_night_mode
              state: "on"
          sequence:
            - action: script.thermostat_sleep_mode
        - conditions:
            - condition: state
              entity_id: input_boolean.thermostat_day_mode
              state: "on"
          sequence:
            - action: script.thermostat_active_mode
  mode: single

Without it, a season flip in the middle of a Tuesday afternoon would just sit there. Nothing would be calling a script until bedtime. This one re-runs whichever mode is already active so the thermostat catches up.

The condition looks fussier than it needs to be. It's there because the season sensor drops to unavailable for a split second now and then, usually when the weather integration hiccups or Home Assistant restarts. Without the guard, every one of those blips would re-fire the thermostat. I went back through the last couple of weeks of history and it happened 16 times. So, worth having.

Conclusion

So, back to the thing that bugged me. Summer morning, house is sitting at 65, I toggle sleep mode off. The season is cool, so the script sends cool-only at 72 and there's no lower bound for the furnace to chase. The house drifts up to 68 on its own, for free, the way it would have anyway if I'd just left it alone.

I pulled the history to make sure I wasn't fooling myself. Over the last twelve days there were 13 mornings where the house was sitting at exactly 65°F when we got up, and the furnace ran for zero minutes. Under the old setup that's 13 mornings of running heat in the middle of summer.

I should say though, it's August. The heat branch has never actually fired for real. I've read it a dozen times and I think it's right. Ask me again in December.

I'm not an HVAC guy and there's almost certainly a smarter way to do this. What's your approach? Does your thermostat know what time of year it is, or do you fiddle with it twice a year like I used to?

View original on infosec.pub
53

How did the Canadian wildfires show up in Home Assistant here in VA?

A few weeks ago, the Canadian wildfire haze reached Central Virginia, where I live, and we noticed it as a haziness in the air. Well, I have an AirGradient Open Air (model O-1PST) outdoor sensor and two AirGradient ONE units (model I-9PSL) indoor sensors. I'm a data-driven person, and I was instantly curious how this was showing up to the sensors in Home Assistant.

Here's what it looked like in the sensor logs:

Hourly mean PM2.5, 17-18 July 2026, central Virginia. The shaded band spans the two indoor sensors; the dashed line is the EPA 24-hour "unhealthy for sensitive groups" breakpoint (35.4 µg/m³).

The signal was unmistakable. Outside, PM2.5 peaked at 164 µg/m³, against a normal range of 7 to 15 for that sensor. Inside, both sensors traced the same curve at about a quarter the height, topping out near 38.

What I didn't expect was the timing. Outside peaked at 9 a.m., but inside didn't level off until noon. And the house was slower to clear than the air outside was. At the worst of it, inside was running about a fifth of outside. The next morning, as the outdoor numbers dropped away, inside was still sitting at a third of them.

Here are some of my automation ideas based on this event:

  • I have a morning automation that fires at 7 a.m. It basically just gives the current weather conditions, the daily forecast, if any litter robots need to be emptied, etc. I can add an air quality alert to this announcement if it's outside of the 'good' range.
  • I can also use the same sensor data to trigger ad hoc voice announcements and alerts.
  • I built a Corsi-Rosenthal Box a couple years ago, but Rachelle really didn't like it because it's ugly. I think I will resurrect one anyway. I still have the fan, and I've already purchased new MERV filters for it. Wildfires are the exact use case for these box fan filters, so I intend to use one! When the indoor sensors cross my clean-air threshold, I can build automations to run the filter.
  • Of course, I'll need automations and sensors to track how long the fan filter has run so we can have some idea on when to change the filters out.

Did you detect the wildfires where you live? Do you have any smart home automations about air quality?

View original on infosec.pub
42

Local Access Issue

Hi All, I cannot keep the connection stable to my pi. I put HAOS on a pi5 and I managed to get logged in on the app eventually and everytime I leave and come back it cannot reconnect.

It says it needs to refresh external IP but I only use it locally so I cant see why it would need this and I have location access allowed so it should know I am home.

I am also attempting to access on local IP 8321 and failing.

View original on lemmy.world
12
homeassistant | Spyke