The SFDC Litter Check

I often ask myself, “When was the last time I cleaned this litter box?”

We have three cats in our house. We give them each their own box, and the boxes are spread out on every floor. It is a lot to keep track of, and if a box is not in part of the house that I am in that often, it tends to get neglected.

But dirty boxes are not good for the cats or humans around them, so I set out to find a solution to keep track of the cleanings and alert me of any of boxes in dire need of attention.

I figured that the easiest solution would be to have a physical button near the box. Something I could press once and forget about it while the action is being recorded somewhere on the internet.

I ordered three Amazon Dash buttons, particularly the Amazon Basics Pet button since it seems the most relevant. I went with the Dash buttons because I knew they were easily hackable, and because the cost of the buttons is taken off of your next Amazon order. It does not matter if you if you ever use the buttons to order from Amazon, the discount is always applied to your next order.

I found this Dash Button Node.js app and installed it on a Raspberry Pi. The app includes a script that listens to on your network and outputs the MAC address of any device that joins it. Press the button, acquire the MAC address. You can then create a Node app to listen for that particular MAC address and react to it.

In Salesforce, I created a new Litter_Box__c custom object that contains a name, MAC address, and DateTime field for the last cleaning. I set up my three litter boxes and their addresses in my org.

I then wrote a Node.js app on the Raspberry Pi to use nforce to sign into the Salesforce org and query for the custom object. Once we receive the MAC addresses, the app listens for them.

When a button is pressed, the Raspberry Pi app fires a new Platform Event on the org called Litter_Clean__e. A trigger on the event finds the Litter_Box__c record for that location and changes the Last Clean field to the current time.

I created a Lightning App for Salesforce1 to give me a visual status on my house’s litter boxes. Boxes that have been cleaned in the last 24 hours are shown in green, 48 hours in yellow, and over 48 hours in red.

Check out of this video of the buttons and app in action.

The buttons have been up for the past week and it has already been a great success. Because the buttons are right there next to the boxes, no one has forgotten to press them as they clean. And the visual indication of the Salesforce app has also set priorities on boxes that need it the most, so I will go out of my way to clean all boxes to avoid going into the red zone.

My Node.js app and SFDX code are available on my Github. Feel free to get your own Dash Buttons for household tracking in Salesforce.