Sure Petcare Catflap / Pet Door

Hey all,

I finally have a working solution for my connected cat flap from Sure Petcare This soultion is not the very best way… but it works :slight_smile:

I tried to do this with a binding, but havent success, so i stick with this ruels for now… maybe some Dev can create a binding in the future.

Note: I’m running on the latest Snapshot builds with JSR223 Rules and I’m using HABPanel…
If you are on another version of openHAB or if you are using BasicUI, you may need to adjust the following steps a bit…
This is for testing only… if you found bugs or find a better way to do things, please let me know in the comments.
You also nee to get you Auth token and need to insert it into the 3 jsr223 rules (explained below).

Look in Matrix Theme (outdated)

Look in Basic HABPanel widgets

This is what works so far:

  • polls the main catflap data every 6 hours (there are not much changing)
  • polls the pet location (and pet feeder data if available) every 5 minutes
  • you can set the status of the cat through openHAB
  • for now only 1 household is supported
  • if you have multiple users in your sure petcare account, openhab shows which user set the cat status manually via sure petcare app (f.e. if you have pet sitters)
  • otherwise the device name (where the cat entered/left the house) is shown
  • map transform file to translate into your language
  • device status of your Hub and Cat Flap and Pet Feeder devices

This will only work if you are on openHAB version: 2.4M3, S1319, or newer

Get the files from my GitHub Repository and add them to your openhab2-conf folder.
keep the folder structure.

log into openhab console and rund these commands:

openhab-cli console
log:set INFO jsr223.javascript

enter into openhab2-conf/scripts and make the script executeable

cd /etc/openhab2/scripts
chmod +x

get your API Auth token:

click to show code

I’m using the postman app but you can also do this online at API Tester


then click TEST and in the Response -> Response Headers you have your token, everything after "Authorization: Bearer "

copy this and update the files:

  • 001_surehub_start.js in Line 18
  • 002_surehub_get_pet_location.js in Line 18
  • 003_surehub_post_pet_location.js in Line 29

go to PaperUI and install under Add-ons -> TRANSFORMATIONS -> JSONPath Transformation
go to PaperUI and install under Add-ons -> TRANSFORMATIONS -> MAP Transformation

go to PaperUI and install under Add-ons -> MISC -> Rule Engine (Experimental)

go to PaperUI -> Rules -> click the play button for the rule “Surehub START”
then take a look into your logs (frontail) and search for “Found Pet ID”
copy those IDs and insert them in the file 002_surehub_get_pet_location.js around line 16
you also need to edit the url string in line 22

HABPanel code:
get the .json widgets from my GitHub Widget Repo and import them into your HABPanel

Thats it! Have fun with your cats data in openHAB.

Please also note that i’m not a developer… but i tried my best to get this working. If you have suggestions please let me know. Also feel free to create a PR HERE and HERE

If you like this addon to openHAB please let my know by clicking that heart button :point_down: :slight_smile:


I’ve created a Github Repo to keep track of the current changes and for the new pet feeder i’m about to add to these rules.

The repo can be found here

Just a quick update.

I’ve got the Sure Petcare Cat Feeder data into openHAB. and fixed a couple of bugs i found while including these new functions. and also integrated a discrete plugin for to inside/outside times.
Will push a update to Github in the next days.

I love the OTT nature of this :slight_smile:

1 Like


I’ve cleaned up this topic a bit…
and also rewrote the install instructions in the first post…

@Weidenwarft and @Snupru as you helped me beta testing this… if you have time can you please check the steps in the first post and tell us if it is working this way. Thank you :slight_smile:

I bought and installed one of these hub cat flaps at the weekend and am extremely disappointed to learn that I can’t control the movement of individual cats! The whole reason I upgraded to this cat flap from the dual scan was I though I’d be able to close off the cat flap to my two new kittens overnight while still allowing my older boy full access. Apparently the only way I can do this is to reprogram the kitten’s chips on the actual cat flap to indoor only every time I don’t want them to be able to leave.
Will this solution allow me to do this remotely if I attempt the instructions above? Or does anyone know if there is a solution that does this?
Thanks in advance

Hi Charlotte,

you are able to do this… but you need to lock and unlock those kittens manually. but its possible.

this script just read the API and is mostly read-only… the only thing you can set is the location for a specific pet. in case it entered or left the house through a window/door.

Thanks for the quick response.
After scouring the app last night I’ve finally found the indoor/outdoor switch for each kitty. No idea why it was under a different menu but oh well!

Another curiosity - while you were looking through the pet data did you come across ‘version’ under the pet info? Two of my cats are Mw== and the other is Mg== and I have no idea what this means, any idea??

[0] => Array
[id] => 63826
[name] => Moose
[gender] => 1
[date_of_birth] => 2004-04-01T00:00:00+00:00
[weight] => 5
[comments] =>
[household_id] => 45655
[breed_id] => 382
[photo_id] => 72402
[species_id] => 1
[tag_id] => 53989
[version] => Mw==
[created_at] => 2019-07-29T22:05:29+00:00
[updated_at] => 2019-07-31T11:48:54+00:00

No, me neither.
IIRC this String changes if you change/update the pet(info) in the app… but i’m not sure… its been a while.

Just to let people know: I’ve started work on a native binding for the Sure Petcare devices.