Monitor Your Pet's Health with Litter Exporter
A Prometheus exporter for…what?
The Litter Robot 3 Connect is a WiFi enabled self-cleaning litter box.
Why on earth?
The Litter Robot 3 Connect first and foremost is a self-cleaning litter box. It starts a cleaning cycle after a configurable wait period after each use. It empties waste into a drawer below the globe and sends push notifications to cell phones when the drawer needs emptied. The app also offers graphs of litter box usage: there are aggregated usage metrics for each day of the current week and each week of the last month.
Unfortunately, it does not send notifications when your pet uses the litter box more often than usual, which can sometimes indicate something is wrong with your furry friend.
One morning I noticed my cat was in and out of his litter box a lot and each visit was unproductive. With the help of my vet we got him straightened out, but I felt really terrible during the whole ordeal that I didn’t notice sooner, and I found myself really wishing I could get notifications for an increase in use.
This is why I built the Litter Exporter. I can now get near real-time metrics on how often its used and when. I can even alert when my cat uses the litter box more than usual or more frequently than usual.
How I Use It (and you can, too!)
I run the Litter Exporter alongside Prometheus, Grafana and Alertmanager via Docker Compose (see the examples section in the repo for more).
- The exporter collects metrics from the upstream API*
- Prometheus collects the metrics from the exporter
- The metrics are displayed on Grafana dashboards
- I use Alertmanager to send notifications if there is a potential problem
Disclaimer: there is no officially-public API for the Litter Robot 3 Connect, so this exporter is experimental. Breaking changes can occur at any time with no warning, so use at your own risk. I reached out to AutoPets and a public API is on the roadmap, but likely won’t be available in 2021.
Special thanks to the users who reverse engineered the Litter Robot API: joshjcarrier, natekspencer.
Source: DEV CommunityNovember 8, 2021