New Sure Petcare Binding for Cat/Pet Flap

Sure Petcare Binding

I’ve created a new binding for the Sure Petcare family of Internet connected pet flaps and feeders. It’s my first attempt of a binding development and the code is still relatively alpha, but it has been running in my local OpenHAB installation for a couple of weeks without any issues.

Restrictions / TODO

  1. The Sure Petcare API is not publicly available and this binding has been based on observed interactions between their mobile phone app and the cloud API.
    If the Sure Petcare API changes, this binding might stop working.
  2. The current version of the binding supports only cat/pet flaps. Feeders are not yet supported as I don’t own one yet.
  3. The binding is currently read-only. I.e. no changes to the Sure Petcare devices can be made through the binding.

I would appreciate if people can give me some feedback before I submit an official PR.

The code can be found here: https://github.com/renescherer/openhab2-addons/tree/feature/surepetcare_binding/bundles/org.openhab.binding.surepetcare

Best wishes
Rene

6 Likes

Sounds create
Please say me how i can install the binding on OH 2.4

Klaus

Hi Klaus

I’d like to wait until the code has been accepted by the PR reviewers and then I’m happy to create a build for 2.4. I’m running 2.4 myself at the moment.

Since this is my first OpenHAB contribution, I’m not sure how long the review process takes.

Cheers,
Rene

Awesome… Thanks for this binding…

I know its in a early state but I’m missing the SET pet location function. thats why i will stay on my javascript rule solution for now… anyway… its great to see movement on the surepetcare binding solution front.

I’ll take a look at it in the next days and maybe i can came up with a PR for the feeders.

Thank you!

Thank you

Had ro recreate my PR. The new one is: https://github.com/openhab/openhab2-addons/pull/6160

Hi Rene,

a nice binding you have here!
I’ve created my own a while ago and been using it since but it needs some refactoring as I created it when I was short on time.
Perhaps some of my work can be used in your binding.
We have a Pet Flap and some Feeders.
I have some more endpoints and JSON requests/replies.
I grabbed them by using the app in Chrome after pressing F12.

1 Like

Hi Wietse

Sounds good. Holger has also added quite a few more features and the latest version now supports feeders as well as flaps.
Would you be able to share your code, so that we can have a look at the differences and make it as efficient as possible?

Thanks,
Rene

1 Like

Hi Rene,

sorry for the delayed reply, busy times…

At this point my code isn’t really in a shareable state I’m afraid :slight_smile:
The idea was to enhance and clean up somewhere in November and release it by the end of the year.

I checked your binding and there are no effeciency improvements to be taken from my version :slight_smile:
It’s already really complete and moving at a fast pace.

I do have fast polling as a value which can be set, you already have it in the feedback but it’s read only.
Fast Polling: by default the Feeder and Flap check the chip on first activating and from then on use the proximity sensors to detect the pet.
So if an authorzied pet starts eating, an unauthorized pet puts his head next the the authorized one and the authorized one leaves, the feeder will stay open.
If you enable Fast Polling it will continuously use the chip to detect the cat and close when the authorzied one leaves (does use more battery).

In the devices I named some values:

lockingModeType

<option value="0">Standard mode</option>
<option value="1">Keep inside</option>
<option value="2">Keep out</option>
<option value="3">Lock both ways</option>

bowlsCloseDelayType

<option value="20">Slower</option>
<option value="4">Normal</option>
<option value="0">Faster</option>

I also experienced inconsistencies with our 3 feeders where the actual total amount eaten doesn’t match the calculated result of each feeding.
I used endpoint: https://app.api.surehub.io/api/report/household/<householdId>/pet/<petId>/aggregate?from=2019-10-29&to=2019-10-29
to get the daily report and then calculate through the feed
Are any of you experiencing the same issues?

I also had following endpoints which might be handy as reference:
api/me
api/notification
api/start
api/household
api/timeline/household/
api/product
api/tag

Hi Rene,

I just tested the binding and it only lists our pets but none of the devices.
I get following message:

Exception caught during topology cache update: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.devices[4].control.curfew

in the binding you expect an array in curfew while in my case it’s a single value:

"control": {
	"curfew": {
		"enabled": false,
		"lock_time": "23:00",
		"unlock_time": "10:00"
	},
	"locking": 0,
	"fast_polling": true
}

If you need me to look into it further just let me know.

Hey Wietse,

I also have 2 feeders… but didnt noticed that for now… will investigate this in the next days… thanks for pointing this. I also liked to have had this value in the binding at a later point.

we do use the values in the thing.xml and do the translations via .properties files.
There are 5 types of locking mode…Mode 0 is also used by curfew(which is IMHO wrong from the API), but even if a curfew is set (active or inactive) the API never respond we expected mode 4…

I also played alot with the API endpoints and noticed that you can limit the timeline by ?page_size=5

If i remember correctly this was changed from 1 curfew to 4 curfews… mid of this year…

Multiple curfew settings for Microchip Cat Flap Connect.

Can you please test to delete you current curfews and add them again.

Thanks

Hi Holger,

thanks for the additional info.

I couldn’t find any way to add or remove a curfew and found in the Google Play description of teh app following:

one curfew per day for the Microchip Pet Door Connect or up to four curfews per day for the Microchip Cat Flap Connect

and we indeed have the Pet Door Connect so it makes sense.
I’m not sure if they will implement multiple curfews for this device but if not, this would need to be treated differently or ignored.
The product_id is 3.
If you need me to test some stuff just let me know.

Oh, yeah somehow I’ve not noticed that… thanks.

can you send me a complete json result from the API of that pet door device via PN. Thanks :slight_smile:

Great, thanks for looking into it.
I just sent the JSON for the Pet Door.

Where can i find a compiled jar?

/Mike

Hi Mike

Great, if you can help testing it. I’ll build you a jar for the latest 2.5.0 release in the next 2 days. Just need to get my build env sorted out again.

Cheers,
Rene

2 Likes

I have compiled it now and have started to test.

/Mike

1 Like

First Comments
It just auto-discover pets nothing else.

It would be nice to have things configuration like this:

Bridge surepetcare:bridge:bridge "Sure Pet Care API Bridge" @ "SurePetcare" [ username="email", password="password", refreshIntervalTopology=36000, refreshIntervalStatus=300 ]
{
  Thing pet pepsi "Pepsi" @ "SurePetcare" [id=12345]
}

and then diplsy id in autodiscovery list.
/Mike

Great ! let me know when you have a compiled release fro test on 2.5. have 2 Feeders and 3 Flaps to integrate :slight_smile:

do you have a version to share for 2.5 ?