Smart Litter Box (or Smart Cats)

Hallo @teachingbirds !

First of all: THIS IS SUCH A GREAT IDEA! I LOVE IT

Just integrated a adjusted version of your code

to be honest, just a few adjustments :)I did it with a template sensor with input number behind, because of mqtt install problems, and some changes to the settings

Which motion sensor do you use?
Do you show “last time toilet cleaned”? If yes how you do this. Tried to read out the last triggered attribute of the reset automation and reset script, did not work (breaking change sometime between our posts) anyway GREAT WORK

Really would love to see some „cat littering data“ of people who integrated something like this… :cat2: :smile_cat:

GREEZ from Vienna
Martin

1 Like

I’m not showing the latest time it was cleaned, but that is a great idea. Will have to figure that out. I’ve since this post moved this to Appdaemon, so I could probably do it there.

Hey!
Love this idea
I’ve not used a Xiaomi human body sensor before. How does this part work?
Does it attach to the box and sense motion in or? Or something else?
Any chance you can share an image of the setup and parts with the tray please?

It’s really nothing more than setting up the motion sensor so that it detects when the cat moves inside the box. This could be difficult depending on the litter box model and placement. I have large plastic storage boxes without lids for my cats, placed in less visited corners of the rooms. I just placed the motion sensors as far inside the corner as possible and aimed them downwards at the litter boxes.
If you have the enclosed ones with flap door I guess you could use a magnet sensor on the flap door (with some kind of timeout so that it doesn’t register another visit when the cat exits), or a bit more diy with a load cell for sensing when the weight changes.

1 Like

Image of sensor setup completed with cat peeing. :smiley:

5 Likes

ha! thanks!

What sensors do you guys use for this & are they battery powered? Can’t wait to set this up :poop:

I have xiaomi motion sensors.

Cool
Do these require a hub?
I do have a z wave stick on my HA box

They do require a hub or a zigbee stick

1 Like

Thanks for these useful scripts! I’m using it exactly like you, with a Xiaomi Motion Sensor attached to the roof of my litterbox.

The only gripe I have so far is that the counter resets every tyme I restart Home Asssistant. Removing the ‘python_script.dlitter_reset’ on startup of HA won’t work; because it will display a ‘-’ instead of the most recent number of visits after a restart. I have only one kitty and can go up to a week (!) without cleaning the litterbox, in which time I’ll usually restart HA for updates as I’m still tinkering with a lot of things.

I’m not that savvy yet writing yaml, is there an easy way to store the number of visits and have HA recall them after a restart? If anyone is still using this usefull snippet, of course… :slight_smile:

The only gripe I have so far is that the counter resets every tyme I restart Home Asssistant.

I also have a “connected” litterbox set up (with motion detector, door sensor and light - some say it’s overkill but I disagree :slight_smile:), but my counter doesn’t reset if HA restarts.

This is my config:

counter:
  litterbox_visits:
    name: Visits to litterbox
    icon: mdi:cat

There’s a “restore” boolean in the counter configuration that is supposed to “restore the last known value when Home Assistant starts”, but it defaults to true so I haven’t used it.

1 Like

Thanks. Using a simple counter looks like a more elegant solution to me, without the need for external scripts. Thanks for the hint.

1 Like

wow, just what I have looked. Thanks jhqv for the the tip (Y)

One problem still with this. It does not restore the sensor.litter_box_visits value after restart. but the counter.litter_box_visits shows right value.