Skip to content

Create a notification light when your dog has been fed using Node-Red and Home Assistant

Last updated on August 31, 2024

With life recently getting a little more complicated, I found myself either forgetting to or double-feeding my 9 year old Aussie Doodle. After running into this issue a few times, I sat down to implement a solution. The pantry where the dog food is located has an RGB light. So what I wanted to implement was a notification via the light to say that he’s been fed.

Requirements

  • The light turns green when the dog is fed
  • The light should stay on for an hour and then turn off
  • An audible alert if accidentally feeding the dog a second time
  • Reset the logic at noon and midnight

Hardware

I have a few extra Aqara door/window sensors, so this was a great use for it. These sensors are Zigbee-based and have a battery that lasts for a year or two. I mounted the sensor inside the lid of the food container and the magnet is on the lip of the container.

Challenges

Since the container we have has an attached lid, the lid will close after you first reach in to get the food to place it in the food bowl. So, the logic has to allow a grace period where you can reopen the container to put the scoop back in the container without thinking this is a second feeding. Additionally, I found that upon reboot of Node-Red, the system was in an unknown state. So I added a null state to the switch node to handle this case.

The Flow

The flow is started by the opening of the window sensor and then uses a switch node to divert the logic based on the number of times the sensor has been triggered. A flow variable keeps track of the count and is reset twice a day.


JSON code for import into Node-RED

Published inHome AssistantHome AutomationNode-RED

Be First to Comment

Leave a Reply

Discover more from D Khaz

Subscribe now to keep reading and get access to the full archive.

Continue reading