Tracking Pet Feeding with Home Automation
Changes
2021-08-30 V1 – Started Documenting
2021-09-13 V2 – Updated with notification (Outside light blink) & tidied code
2021-10-10 V3 – Now added voice notifications if not fed
Summary
A method to track whether the cat and dog have been fed in a busy household.
I think about Home Automation as being “what things are repeated constantly by people, that don’t need to“, and this in our house was the question of “Hey, has anyone fed the pets?“
The solution needed to be cheap, and simple for anyone to use. I decided to use buttons at the pet feeding station to determine when feeding has happened – the family know to press once when they feed the dog, feed the cat or top up the water.
I have a touch screen display in the lounge to display results, but I am planning on adding a simple LED display and some voice notifications for a few ‘alarm’ type events, such as ‘pets not fed recently’.
Updates
Update 13 Sep: There were a couple of times the buttons were pressed and the zigbee coordinator picked them up, but nothing was pushed to MQTT for some reason. Also, there are times people aren’t sure if they pressed the button properly. I could have given some voice/sound feedback but this isn’t great for early morning feeds so I now flash the outside light when a button is pressed (either 1, 2 or 3 times depending on which button was pressed)
Update 10 Oct: I haven’t added to the Node Red flows below, but my setup now announces over a couple of Google Home devices (one in Miss 11’s room) if the pets haven’t been fed in the afternoon. It starts around 4:30pm and keeps announcing every 40mins (about 5 times total) until the pets have been fed (If not fed by then… her internet gets switched off)
The announcements are selected from a randomised list so they are less annoying. eg “Hey, the Pets have not been fed this afternoon”, “Woof, Have you remembered to feed the Pets?”, “A friendly reminder, the pets have not been fed”
Input Devices
I managed to get some Zigbee Mi buttons for NZ$10 each. Zigbee is simple, and for non critical applications and in areas where running cables is a pain, so is a good solution. The feeding area is outside, but under cover.
https://zigbee.blakadder.com/Xiaomi_WXKG01LM.html
https://www.aliexpress.com/item/32825685057.html
I use a bunch of methods to coordinate the zigbee signals (including Zigbee2MQTT), but for this example I’m using a Sonoff Zigbee Bridge, flashed with Tasmota. The Bridges are around $25. Using the bridge just for this purpose helps to have a stand-alone setup for this application, but I’ll likely add them to the Zigbee2MQTT setup later.
https://www.aliexpress.com/item/4000986091188.html
https://sonoff.tech/product/smart-home-security/zbbridge/
https://www.youtube.com/watch?v=dC1AEyFhmnc
Outputs and Calculations
Calculations were done using Node Red & some javascript. Currently it waits for the buttons to be pressed and stores variables such as time when buttons are pressed. It does some simple calculations to determine hours since feeding happened, and if a button isn’t pressed it updates the status every 5 mins with a repeating injection node.
Node Red outputs values to my MQTT server and I also pull those values into Home Assistant. Home Assistant uses this to update a display I have on a touch screen in the lounge. We can see at a glance how many hours since feeding.
Node Red Flow
The full Node red flow can be downloaded below:
Images
Future Plans/Improvements
- some more alarm info if it goes too long between feeds (morning and afternoon)
- a Q/A to google home so you can ask it if the pets need feeding.
- notifications
using google homes andpushover including warnings if they haven’t been fed (I now use voice announcements using the audio on the touch screen and MPD) - some tidyup code for the zigbee to ensure batteries get replaced and errors are caught.
I could add… - Snapshot image from the cameras to show who fed them (could be sent to pushover or another push notification system)
- Some extra data, eg a double press of the button could indicate that the petfood is running low of something. The buttons can account for 1,2,3,4, and ‘multi’ press, as well as ‘held’ so they are being underutilised as is.