One of the reasons I got a SurePet SureFlap, was to be able to tell whether or not the cat is in the house. Another reason is to lock the flap remotely, but more on that later. I’ve also always wanted to play with an ePaper display. ePaper (or eInk) displays are awesome because they can be programmed to display stuff, and it doesn’t use any power to keep the data on the screen.
Another requirement was that the ePaper controller needed to be low power. What else than a Raspberry Pi? So, I put together a Raspberry Pi and an Inky wHAT (ePaper/eInk/EPD) – Red/Black/White to create this:
Pimoroni has created excellent quick start guides to learn to control the display. An extensive library makes it possibly to write and draw on the ePaper display with very little code. Check out these getting started guides here: https://learn.pimoroni.com/article/getting-started-with-inky-what.
Weather Integration
The weather shown on the display is an existing script from Rainer Bunger. It’s easy to run; all you need is an OpenWeather account and to set the longtitude and latitude. I only modified it to show the current day and 3 days ahead, instead of 7 days ahead. Check it out on GitHub: https://github.com/rbunger/Inky-wHAT-Weather-Station
SurePat Flap Integration
After the weather was set up, it was time to add the location of the cat. SurePet has an API you use, but as with almost everything, there’s a python library that’ll make it easier. You can do a lot more with the library (like changing the pets location), but this was all I needed to get an “Inside” or “Outside” result:
# user/password authentication (gets a token in background)
surepy = Surepy(email=os.environ['SUREPET_EMAIL'], password=os.environ['SUREPET_PASSWORD'])
# get a list with all pets
pets: List[Pet] = await surepy.get_pets()
for pet in pets:
# find the cat we're looking for
if pet.name == cat_name:
return pet.location
Based on the cats location returned by the SureFlap, I could draw an image and text to announce whether it’s inside or outside. The weather station code provided good examples to get that done.
Here’s the example code: https://github.com/smitmartijn/inky-display-surepet
Leave a Reply