Monday, December 18, 2023

Watering the cat




 I took some time off at the end of 2023. I had a chance to resurrect some of my old projects including the notorious water fountain for the cat. I've been enjoying accomplishing various things with resources I already have on hand, so I dusted off a raspi3 and the Intel Movidius stick I have and set to work putting the project back together. This time around I already had a hole in the countertop, so I wasn't going to bother with the wireless or battery power aspects of the concept.

I had bought a nice fountain with an infrared sensor which worked very well for the past 4 years (except for just one tubing blowout that happened when I was home, and the manufacturer was extremely responsive sent a new tube and it never happened again). However, nowadays I often find myself occupying that section of my counter (espresso workstation), and so the cat fountain would often trigger. Also it ate counterspace.

I used a very quick and dirty setup to accomplish the task, looping the control through home assistant via an MQTT sensor published by the raspi, which was linked through a simple automation to a Zigbee relay. With the sensor state and relay state coupled, all I had to do was resurrect the old stream_ty python script and ask ChatGPT to make me a nice MQTT sensor class to send updates to Home Assistant. I had to make sure to ask for the class to do LWT and keepalive and to retry if it lost connection. I also had to make sure it sent a config json to the config topic for automatic discovery.

Since I already had the water spout and under-sink plumbing, valve and a new hole in the counter (from plumbing the espresso machine), I was able to check the box on this task in a couple of days (after screwing around with a raspi zero, which didn't work in the end...). It's interesting that when I looked into running tiny yolo on the raspi 3 it seems like I could probably have done this without the Movidius... maybe I'll try someday.


No comments:

Post a Comment