Sureflap Connect - Pet Door

I don’t know if this ever will be merged and I am quite sure it will not until august. In the meantime you can copy the components/surepetcare folder from the PR to your custom_components/ and use it this way :v:

5 Likes

I’m thinking of trying out your component, but where do I find the “household ID”?
I have found Flap ID and Pets ID(s)…

Update:
Ah, found it… Had to dig in the “console” (development tools) on the SurePet site.
I’m not sure where to look. But what “sensors” and “binary’s” do I get with your component?
Is there a list somewhere? :slight_smile:

Update:
Here is what I got…
binary_sensor.flap_laundery_flap = off
battery_voltage: 1.2918749999999999
locking_mode: 4
device_rssi: -53.142857142857146
hub_rssi: -54.5
mac_address: XxXxXxXxXxXxX
version: MzIx
friendly_name: Flap Laundery
icon: mdi:lock
device_class: lock

binary_sensor.pet_cappuccino = on
pet_id: nNnNnNnN
tag_id: nNnNnNnN
device_id: nNnNnNnN
where: 1
since: 2019-06-09T13:59:38+00:00
ETag: XxXxXxXxXxXxXxXxXxXxXxXxX=
friendly_name: Pet Cappuccino
icon: mdi:cat
device_class: presence

binary_sensor.pet_kakan = off
pet_id: nNnNnNnN
tag_id: nNnNnNnN
device_id: nNnNnNnN
where: 2
since: 2019-06-09T14:20:38+00:00
ETag: XxXxXxXxXxXxXxXxXxXxXxXxX=
friendly_name: Pet Kakan
icon: mdi:cat
device_class: presence

sensor.flap_laundery_flap_battery_level = 11
voltage: 5.17 V
voltage_per_battery: 1.29 V
unit_of_measurement: %
friendly_name: Flap Laundery Battery Level

However, it’s not updating the status correctly (at all?), the status is not correct…
And the flap I have are usually in “Curfew mode” (open and closed on specified times), that does not show…

Have I missed something?

I have the same issue.
I tried this config:

surepetcare:
  username: xxxxx
  password: xxxxx
  household_id: 29838
  flaps: [{id: xxxxx, name: Balkongen}]
  pets: [{id: xxxxx, name: Jenna}]
  scan_interval: 00:00:100:

However its not updating at all. I see that you are using:
from surepy import SurePetcare

But it feels like surepy is very slow at updating, or even udating at all?
At least I would like the component to update every minute or so.

Are we doing something wrong here @benleb?

Visit https://surepetcare.io while your browsers dev/js console is open. The household ID will be visible there multiple times, searching for “household” gets you to your ID :+1:

1 Like

The component is working, I get all the sensors. But its not updating.
My cat is inside, the component shows inside, when she goes out, it doesnt update. Waited like 45 minutes. If i restart home assistant ,then its updated. So it seems like the component only fetches the status upon restart. But not after that.

I guess it has to do something with surepy…

you are using hass.io right? I will check this, but dont expect an solution today… I stripped many lines of code from this component this weekend, maybe also one which I shouldnt… :sweat_smile:

Besides that… The scan_interval defaults to 3 minutes as Sure Petcare explicitly does not like/want that their API is used this way. I have talk to them a few times and it was really disappointing… So, you can change the update interval via the scan_interval config option, but please be aware that nobody knows what will happen if you pull to often…

Okey, it might have to do something with hass.io then? I will remove the scan_interval from my config and wait until you have a fix =). I guess you didn’t test it with hass.io?

I found a solution. Just comment line 11 in init.py
Works perfect now…
#import utils as utils

1 Like

hey! no, shit! My fault, will fix this today or tomorrow, sorry :smiley:

1 Like

Thanks :), meanwhile im using the old component that has been discussed in this thread.

works for me again…

Just comment line 11 in init .py
Works perfect now…
#import utils as utils

Okay :smiley: fyai… probably I will just post about this in the PR on github and not here also :slight_smile:

2 Likes

Thanks guys the

#import utils as utils

solved it for me

1 Like

I talked to their tech support, to add more requests for a supported API, and they mentioned that the communication between the door and the hub is via bluetooth. I don’t have my door yet (the cat door connect + hub bundle is backordered on amazon) and I’m also pretty lousy with reverse engineering bluetooth protocols (tried for a few hours with a bluetooth radon detector). But maybe knowing that it’s bluetooth will inspire someone else to investigate? Would be sweet to have a way to interact with the door that doesn’t require a trip out to the internet.

It’s not BT/BLE, it’s https://en.m.wikipedia.org/wiki/IEEE_802.15.4
so probably zigbee

All working great, however updates seem to stop after ~24 hours, and a restart of HA is required to resolve, using the default update frequency.

Also, would be great to be able to determine if the door is actually locked whilst in curefew mode.

I believe this happened after installing HACS:

Error while setting up platform sure_petflap
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sure_petflap/sensor.py", line 61, in setup_platform
    add_devices([SurePetConnect(username, password)])
  File "/config/custom_components/sure_petflap/sensor.py", line 80, in __init__
    self.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 224, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/sure_petflap/sensor.py", line 104, in update
    with self.sure:
  File "/config/custom_components/sure_petflap/__init__.py", line 646, in __enter__
    raise SPAPICacheLocked()
custom_components.sure_petflap.SPAPICacheLocked

any thoughts on the issue or what I can do please.

To fix the SPAPICacheLocked issue, please stop Home Assistant, remove the file ~/.surepet.cache.lock and then start Home Assistant again.

The cache lockfile was not correctly removed at a recent shutdown so make sure to remove it before you start Home Assistant again

Thank you @dajomas, Ive tried to find the file but can’t locate it. Im using terminal in the hassio add-on.

Ive done nothing except updated to 0.96.0 and Sureflap is back up and working again.

I have no idea why but pleased its working.