zorruno wikki: Tracking Pet Feeding with Home Automation

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 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'.

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 10's room) if the peds 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.

Input Method

I managed to get some Zigbee Mi buttons for $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.
https://www.aliexpress.com/item/4000986091188.html
https://sonoff.tech/product/smart-home-security/zbbridge/
https://www.youtube.com/watch?v=dC1AEyFhmnc

Calculations & Output

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.

Images

Mi Zigbee Buttons.
I had thought about placing them in a nice wooden panel at some stage, but at the moment they are fine stuck to the wall.
text

Button Stickers
I designed some simple labels and a friend who runs a signage business printed me out some on vinyl.
text

Touch Screen Display
The whole 19" touchscreen isn't displayed here (it is a work in progress recessed into our lounge wall) and this is the first iteration of the pet feeding display on the touch screen. It will show orange and red as the time extends out more than half a day. At the moment, it averages when the cat/dog button is pressed, but I'll account for the possibility that only one button is pressed for some reason.
text

More notes on the touchscreen: ViewSonicTouchscreen implementation.

Node Red Flow
The full code is here to download
text

Buttons In place
text

text

Future Plans/Improvements


-- some 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 and pushover including warnings if they haven't been fed
-- 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)
-- 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.

Last edited by ZorrUno
Sun, 10 Oct 2021 03:21 UTC [diff]


CategoryHomeAutomation
CategoryMQTT
CategoryHomeAssistant
CategoryNodeRed
CategoryZigbee
CategoryPets