Smart Home Automation Project: Cat Litter Box Tracker

I recently completed a smart home automation project that I wanted to share with the community. It’s a cat litter box tracker that notifies me when my cat has used the litter box and sends me a push notification if I’m at home and not asleep. When I clean the litter box, the light turns green briefly, so I know the sensor has been reset. Then, the light either turns back off if the light switch is off, or to a normal white color if the light switch is on. If anyone needs to use this restroom before I get to clean the litter box, the light switch still functions normally, and will always turn on to a normal white color when the switch is used, and then back to red when the switch is turned off if the litter box still needs to be cleaned.

Hardware Setup

I used a combination of Zigbee sensors and a Shelly 1 to achieve this. The Aqara Zigbee motion sensor detects when the cat has used the litter box, and the Sonoff Zigbee contact sensor detects when the litter box lid is opened. The Feit Electric bulb changes color based on the status, and the Shelly 1 behind the light switch ensures normal functionality of the switch.

Automation Logic

The automation logic is quite detailed. When the motion sensor detects motion, it turns on a helper boolean in Home Assistant. When the contact sensor detects the lid being opened, it turns off the helper boolean. The light changes color based on the state of this helper boolean. Additionally, I have automations set up to send me notifications depending on my location and whether I’m asleep.

Challenges and Solutions

One of the challenges was ensuring that the notifications were only sent when I was home and not asleep. I used a bedtime script to determine this and set up conditional notifications. I also had to experiment with the values for the RGB color settings to get the desired white color.

Conditional Cards for Lovelace UI

I added a couple of conditional cards to my Lovelace dashboard to show the status of the litter box. These cards only appear if the helper boolean is on, and they display how long it has been since the litter box was last used. There’s also a button to manually mark the litter box as cleaned.

Final Thoughts

This project was a great way to utilize my existing Zigbee sensors and get creative with smart home automation. It’s been working perfectly for about two weeks now, and I haven’t had any false detections. I’m really happy with how it turned out and would love to hear if anyone else has similar projects or suggestions for improvement!