Pet door project

Hey, old thread I know. I have the sureflap connect retail connected flap. Wondering if anyone has worked out a way to integrate?

1 Like

Did you get any joy with this project. I’m considering buying a sureflap. It appears to have a separate hub and I’m all Hubbed out so was hoping to run if off the ST Hub.

This guy on Github has reverse engineered the sureflap and posted some sample PHP code: https://github.com/alextoft/sureflap

Someone has then forked to a PowerShell version and an Alexa skill (unpublished).

So theoretically it would be possible to port to SmartThings. Not sure I have the time or knowledge to do so though.

I’ve put the php code provided by alextoft into an Azure web app and can get pet location back as a webpage so was wondering if I could pull info from this website into SmartThings but it may be better to do it all directly from SmartThings.

1 Like

I’ve just created an integration between SmartThings and the Sure Petcare connect range if anyone’s interested

2 Likes

this sounds great, im going to give it a try…
have three cats with various access rights to the building (one is an indoor only cat!)

see what things I can now do as a consequence of the integration… eg turn on the patio lights when they leave at night!

Fantastic. Been looking at doing this myself but haven’t got the skills. Managed to connect to SureFlap via PowerShell but that was as far as I got.

@Alyc100 I noticed the battery percentage wasn’t updating and was always showing as 100%, I think due to the way groovy handles numbers in case statements.

I’ve resolved this by updating your getBatteryPercent function to use ifs and also changed the voltage thresholds based on my experience…
I find the app’s reporting of the battery completely useless as the batteries last ages after the app says they need replacing so I’ve been logging the voltage daily via a script. Today the cat flap started misbehaving, not tracking the cat, etc. so I was able to get a baseline for a “dead” battery.

Here’s the updated function I’m using:

def getBatteryPercent(voltage) {
log.debug "Executing 'getBatteryPercent'"
log.debug "Battery voltage " + voltage + " volts"
/* Battery voltages
6.27v = new batteries
5.2v = flap starts misbehaving i.e. batteries dead
0.27v increments for each 25% = 6.27, 6, 5.8, 5.5, 5.2
*/
def percentage = 100
if (voltage < 5.2) {
    percentage = 0
} else if (voltage < 5.5) {
    percentage = 25
} else if (voltage < 5.8) {
    percentage = 50
} else if (voltage < 6) {
    percentage = 75
}
return percentage

}

I just split the percentages over the difference in voltage from a full battery to a “dead” one, which might not be entirely accurate if you were to look at battery discharge curves but probably good enough.

1 Like

This is great! Would you mind if I push this into the main code?

Sure go for it. I have a feature request too :grinning:

Would it be possible to have the ability to set the pet’s presence from within the device and have that update the Sure Petcare system, like you can do within the Sure Petcare app?

Thanks

Also, added this to record the battery voltage in the app:

sendEvent(name: "battery_voltage", value: flap.status.battery + " volts")

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.