Introduction
We have a baby diaper trash bin and we can’t see when it’s full. Based on that id’ like to get a notification to let me know before it’s full so I don’t have to stick up my head in it 💩
How to count
First I had to identify how to count the baby diapers.
I used an Aqara open/close sensor and stuck it to the axle, I had to find a spot where it could easily be mounted and it would not be in the way of the mechanism. I am Using DeConz on Home-Assistant Bit you can also use ZHA. In order to connect the Zigbee devices do Home-Assistant, I used a ConBee II stick provided by Phoscon. You can find a Tutorial on how to install Deconz and pair zigebee devices here
Count diapers
I created a counter in Home-assistant to keep track of the diapers. and then an automation to increment it on every state change that is either close and open
(do not track EVERY state change since a disconnection or a battery update would increment the counter)
Counter & Automation
Resetting the counter
Whenever the bin is emptied the counter needs to be reset. I’ve thought about automating it but found no effective way to do it, so I just added an Aqara button which on a button press resets the counter via an automation
Notifcations
Whenever a defined threshold (15) has been reached a notification should be sent to our phones as well as on each additional item until the counter has been reset
This is done via NodeRed
Threshold Reached
Counter Reset
Display diaper count on switch
This one is a bit more tricky to explain. The bin stands next to one of our KNX light switches. These have a screen to display additional information like time, temperature or whatever additional data one would like to display.
here you can see a demo video
I won’t explain how KNX works but basically you have to set up a group address like “4/2/30” and the specific function of that switch will be added to that group. I then exposed the value of the “counter” to KNX into the specific group
I had to use percent since the switch wouldn't allow for a plain text field
Flash red light on the wall switch when threshold reached
As explained in the previous comment these switches can display some nice information. You can also define the LEDs.
Here I used Node-Red again since I had it already set up for my mobile notifications and I didn’t want to create an additional entity in HA. (see here)
In Node-Red I used a Plugin called UltimateKnx. Used a switch node to change the value “15” to “true” and value 0 to “false”
Useful Information
In case of any question, find me on Discord or on Twitter.
You can find a dedicated Discord Server for any ESPHome related question or if you have questions about the drivers for the D1 mini
If you have issues with the community add-ons, you might find help on their discord server.
If you liked this article, do not hesitate to share it
I run mostly on coffee so, if you enjoy my work, and if you would like to support me you can buy me a coffee