PC Pro

PAU L OCKENDEN

Paul turns Ace Ventura as he uses technology to spy on his pets, but falls short of logging the data to a spreadshee­t

- Paul owns an agency that helps businesses exploit the web, from sales to marketing @PaulOckend­en PAUL OCKENDEN

This month, Paul turns Ace Ventura as he uses technology to spy on his pets, but falls short of logging the data to a spreadshee­t.

F or this month’s column, I’m going to turn pet detective. In the past I’ve often written about using various types of trackers to monitor where your pets roam. In fact, as I write this I can look out of my office window and see our tortoise ambling around in the garden. She looks just like a normal tortoise, with the exception of a Bluetooth Low Energy (BLE) tracker attached to her shell. Being a low-powered Bluetooth tracker, there’s no GPS facility so I can’t use it to plot her route around the garden, but it is useful when we need to locate her. An app gives you a rough distance (but not direction) and, when she’s in range, an audio alert causes the tracker to emit a beep that helps us to pinpoint her position. She tries to hide under shrubs or piles of leaves, but we can always find her.

I’ve been through many different brands of BLE tracker, including wellknown names such as Tile and some of the smaller players. The device that’s now Sugrued to her shell is a Nut Find3. I particular­ly like this device because it’s fairly waterproof and makes frugal use of its battery, often lasting for two years or so on a single CR2032.

It’s half tempting to swap this tracker for one of those new-fangled Apple AirTags, but without a recent iPhone you can’t use ultra-wideband (UWB) communicat­ion with the AirTag and it defaults back to BLE. As I’m currently in the Android camp when it comes to phones (I tend to swap and change between Android and iOS every few years) and my only iOS device is an elderly iPad, an AirTag would offer no real advantage over the tracker I’m using. Other phones (recent Samsung devices, for example) offer UWB, but right now they won’t play ball with AirTags. So I think I’ll hold off upgrading my tortoise tracker until Apple opens things up a bit.

Tracking isn’t the only way that we can bring tech into the life of our pets. Long-time readers might remember I was an early adopter in the field of microchip cat flaps. These are great because they read the microchip embedded between your moggy’s shoulders and make sure that only your own cat gains access to the house. It’s good for the cat (no strangers stealing its food) and good for us because strange cats will often scent-mark new places. Eww…

There are quite a few manufactur­ers of these devices, and we’ve been through many of them over the years, but a while back I settled on those made by Sure Petcare as the most flexible and reliable. It makes two models: one is called a Cat Flap and the other a Pet Door, which is also suitable for very small dogs. Our current moggie, who isn’t especially huge, struggled with the small size of the Cat Flap so we changed to a Pet Door, which seems much better. In fact, it’s pretty much the he size I’d expect a normal cat flap to be.

A few years back, Sure ure introduced “connected” connected” versions of f its Cat Flap and Pet Door oor products. You need eed a small hub to use

these, which communicat­es to the flap via RF. It says 2.4GHz so I initially assumed it was either Bluetooth or ZigBee, but digging shows that it’s actually MiWi. This is based on the same IEEE 802.15.4 physical and MAC standard used by ZigBee, but is more suited to closed systems that don’t need third-party interopera­bility. Truth be told, ZigBee has become a bit of a monster with a large footprint, whereas MiWi is much leaner, so it’s an ideal candidate for Sure Petcare’s local area network. The hub needs a wired Ethernet connection (it doesn’t talk Wi-Fi) and it communicat­es via MQTT with Sure Petcare’s cloud infrastruc­ture. You then use a phone or tablet app to control everything.

At its simplest, you get a notificati­on (thankfully optional) every time your cat goes in or out of the flap. The default notificati­on noise is “meow!” What’s neat, though, is that, in a multi-cat household, it tells you which of your cats has gone through because the cat flap reads the animal’s microchip. You also get an at-a-glance view showing whether your pets are indoors or outside. It even alerts you if a neighbour’s cat tries to gain entry – obviously it won’t get in because its microchip won’t be registered so the mechanism won’t unlock, but it does register that a feline stranger was looking through the flap.

The connected models offer a lot more than tracking, though. There are simple things, such as updating the onboard clock twice a year when the clocks change through to setting curfew times and monitoring the battery health. I find that with good alkaline C cells you’ll only have to change them every two years or so.

Curfew times are one of the best features of the Pet Door and you don’t need the connected model to use them, but it’s a lot easier to use the Sure app than the fiddly buttons and tiny screen on the flap itself. We have ours set so that the flap locks around 9pm. The cat can still get in if he’s still out at that time, but once home he can’t go back outside again. And then it unlocks at 6am. We adjust the curfew via the app a few times a year as the days get longer. Being kept in at night means we’re less likely to come downstairs in the morning and be confronted with a dismembere­d bird or mouse left as a present, as our moggie tends to hunt at night.

Feeder and Felaqua

After the Cat Flap and Pet Door products, Sure Petcare released a microchipc­ontrolled pet feeder. We don’t have a need for this here as we only have one cat, but the idea is that if you have two or more cats and one needs a special diet, or perhaps some medication in its food, you can ensure that the feeder only opens for the one particular cat. As the lid retracts as the cat approaches, it takes some of them a while to get used to the feeder, but food is usually a good incentive when it comes to cats! The bonus is that because the bowl is covered when the cat isn’t around it keeps it fresh and won’t attract flies into the house. Incidental­ly, as with the pet door, the feeder will work perfectly with small dogs too.

As with the flaps there’s also a connected version of the feeder, and what’s really clever is that the unit has integrated scales, so it’s able to measure the quantity of food that you add, and then the amount of food that the cat has consumed each time it visits the feeder. I guess if you’re a bit of a nerd you could log these values to a spreadshee­t (more on that in a bit), but for the rest of us what’s important is to be able to see changes in the animal’s eating habits over time as this can be an indication of illness. You don’t need spreadshee­ts for this: the app is good for being able to spot trends and changes.

The newest addition to the range is called the Felaqua and this time it’s a connected water bowl. There’s no unconnecte­d version this time because the whole point is the monitoring. Much like with the feeders, the Felaqua measures how much water your pet is drinking. This is really important for elderly cats because changes in drinking patterns are a critical health indicator – they’re prone to kidney problems and increased thirst is one of the first signs that vets ask cat owners to look out for.

Although it reports the amount drunk in millilitre­s, the actual mechanism is based around weight. Essentiall­y the whole unit is a set of electronic scales. As the pet drinks water from the bowl, the overall weight of the unit decreases and the scales measure this. It helps that 1ml of water weighs 1g – thank you SI units – but having the Felaqua weigh not just the water but the whole unit is a stroke of design genius. As with electronic bathroom scales, I’ve found it gives more reliable readings when placed on a hard floor rather than carpet.

Sure Petcare makes a big point about its various products all being able to use the same hub, but there’s a flaw. If you’re monitoring your pet’s water intake using a Felaqua and also have one of the connected cat flaps then there’s a pretty good chance that your cat will drink while out of the house as well. Cats seem to love slurping from ponds, puddles or grotty old watering cans.

Generally, things work well, but the cloud infrastruc­ture that powers the connected devices does seem to falter at times. For example, I’ve seen the cat drink from the Felaqua, the lights on the hub flash to show that this has been registered, but then nothing at all in the app. No notificati­on and no record of water having been removed. Another time the Pet Door mysterious­ly lost its clock sync, and the curfew times went haywire. I had to do a power cycle to get the time correct and then set the curfew times from scratch. Without these (albeit infrequent) problems I’d give the products an unreserved recommenda­tion, but

“It tells you which cat has gone through because the flap reads the microchip”

“It’s important to note that the CLI options of surepy are a bit rough around the edges”

unfortunat­ely that has to be tempered with a warning about the cloud infrastruc­ture. Luckily, though, the fault isn’t with the hardware, which seems to be fairly bulletproo­f. I just think Sure Petcare needs to harden its cloud facility.

I discovered that it’s hosted on Amazon’s AWS and is fronted by load balancers, so all signs of a well thought-out infrastruc­ture. Yet I also found that most of the traffic seems to be using Amazon’s “us-east-1” region data centres (Boston, Houston and Miami), rather than those in Europe and the UK. That shouldn’t be the cause of the occasional instabilit­y, although best practice is usually to use the cloud region closest to home. I really hope that the reason for this isn’t cost – it depends on the AWS service, but the UK data centre is usually between 10-25% more expensive than the US east coast. On the other hand, there’s no monthly subscripti­on fees once you’ve bought these (admittedly quite expensive) products, so the fact that they are hosted on AWS at all rather than some bargain basement IoT platform is a nice change.

Taking command

I joked about logging the data from the pet feeder to a spreadshee­t, but I know some readers of this column would do exactly that. It would be easy if there was an IFTTT integratio­n, but unfortunat­ely there isn’t. There is an API, though, so I’ll show you how to use that, and you can then write a wrapper to upload the data to a spreadshee­t, database or whatever.

Rather than reinventin­g the wheel, let’s make use of the work that others have already done. It all started with Rene Castberg’s sure_ petcare Python library ( github.com/ rcastberg/sure_petcare) – a great starting point from three years ago, which handled the original connected Cat Flap and Pet Door. Rene’s work then formed the basis of an improved work by Ben Lebherz from Germany and his surepy project ( github.com/ benleb/surepy), which provides both a Python library and CLI interface, and which will talk to all four Sure Petcare device types.

So let’s have a play. As is usual for the experiment­s in this column, I’m going to suggest firing up a spare Raspberry Pi. Before you do anything else, as always, go through the usual

sudo apt-get update, upgrade and dist-upgrade steps. Plus a reboot for good luck. That way we’re starting from a known good place, but if you haven’t updated your Raspberry Pi for a while then you should be prepared for the steps to take a while.

You also need to make sure that your version of Python is up to date. To do so, run:

python3 --version

And if it isn’t at least 3.8, you’ll need to upgrade. Although you can try:

python3.8 --version

Why? Because you might have the newer version installed but not set as the default for the python3 command. You’ll find loads of web pages listing the steps to upgrade the version of Python on a Raspberry Pi (you’ll need to build it from scratch – ignore any pages that talk about

ppa:deadsnakes because these repositori­es are for Intel only – lots of people get caught by this one).

Once you’re all up to date, issue the following command:

python3 -m pip install --upgrade surepy --user

This will install surepy. You can check that it’s working by just typing

surepy

If it says commend not found, try:

~/.local/bin/surepy

If that works, you need to add your local bin folder to your path:

PATH=$PATH:/home/pi/.local/bin

And at this point, the surepy command should work.

It’s important to note that the CLI options of surepy are a bit rough around the edges. It’s intended purely to check that the library is working correctly and allow you to interact with the Sure Petcare cloud infrastruc­ture without writing code. Because of this, you’re likely to find it blowing up if you do something wrong, rather than seeing nice friendly error messages.

For example, you’ll see a mess of error messages if you type:

surepy devices

This is because you need to get an access token before you can access the online API. You do this with:

surepy token -u -p

Here, un and pwd are the username and password that you use to access the Sure Petcare app. Once you’ve done that, you’ll be able to use the devices and various other commands without seeing an error.

There’s decent help text available, so if you wanted to see what parameters the token line above takes, you’d do:

surepy token --help

That would explain about the -u and

-p parameters. But like I said above, the real power comes with the library rather than the CLI commands. You will find a simple example at pypi.

org/project/surepy, which lists all of the pets registered on your Sure account, as well as all of the devices. And if you run the Home Assistant home automation system, you will find built-in Sure Petcare integratio­n based on surepy – for more details, navigate to home-assistant.io/ integratio­ns/surepetcar­e.

 ??  ?? BELOW The Nut app doesn’t give you directions but it does show distance
BELOW The Nut app doesn’t give you directions but it does show distance
 ??  ??
 ??  ?? BELOW The Felaqua measures its own weight to monitor water consumptio­n
BELOW The Felaqua measures its own weight to monitor water consumptio­n
 ??  ?? ABOVE The Sure Petcare app keeps track of your pet’s comings and goings
ABOVE The Sure Petcare app keeps track of your pet’s comings and goings
 ??  ?? ABOVE Ben Lebherz’s surepy lets you talk to all four of the Sure Petcare devices
ABOVE Ben Lebherz’s surepy lets you talk to all four of the Sure Petcare devices
 ??  ?? BELOW Make sure you do the usual Pi updates and upgrades before you begin
BELOW Make sure you do the usual Pi updates and upgrades before you begin

Newspapers in English

Newspapers from United Kingdom