Sureflap Connect - Pet Door

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.

do we think this cat flap could be intergrated without the silly (expensive) hub in the not too distant future?

using zigbee2mqtt?

I couldn’t find .surepet.cache.lock in hass.io. (wanted to delete it) Looked everywhere.

So just changed line 14 in init.py to:

CACHE_FILE = ".surepet.cache"

Now the file is in /config/

Just set this up and it’s working great. Question, the sureflap app doesn’t always recognise when my cat leaves (I just have the one) and says an animal left rather than pet name. Is there a way of overwriting the setting in home assistant if that happens? I can only see my pet name state.

EDIT:
So solution to the above has been decided more low tech - after contacting Sureflap they have posted me a heavy duty door which has resolved it as my cat has to try a little harder to escape!

Although on an unrelated note, I have found updating my Homeassistant to 0.98.5 from 0.98.4 has broken the setup. Reverting resolves it. This the case for others?

EDIT 2:
And 0.99.2 fixed the issue from 0.98.4 so it all works. Sa’ll good!

Given that it looks like the flap communicates via zigbee, did anyone try to pair it with a generic zigbee hub/stick, like conbee or something?

Edit: Sorry I’m confused now, just remembered OP stated it uses mqtt. But read elsewhere it seems to use zigbee. Any clarification on this?

Just got one of these excellent cat flaps. Can someone explain how to install in HASSIO please…

I set this up for myself very recently, and did it by combining the advice above. Here are the steps I took, and I hope they can help others set this up :slight_smile:

  1. If you haven’t already set up either configurator or samba through their respective add-ons. I used Configurator, and I recommend this regardless, but its up to you.

  2. Create a directory named “custom_components” in config/ and then create a directory “surepetcare” in “custom_components”. You should end up with this structure: “config/custom_components/surepetcare”.
    The quotes are there for clarity, don’t actually include them in the directory names :wink:

  3. Copy all the files from this link and add them to the “surepetcare” directory we just made.

  4. We now need to restart home assistant, go to configuration, server control, check config (we haven’t changed any config yet, but it’s better to have a habit of checking the config before a restart :wink:), and if all is ok, restart server.

  5. In your configuration.yaml file, add this snippet, but replace the user specific values with your own. step 5 explains which values and where to get them

surepetcare:
  username: !secret email
  password: !secret surepetcare_pwd
  household_id: !secret surepetcare_household_id
  flaps: [{id: !secret surepetcare_flap_id, name: Inngang}]
  pets: [{id: !secret surepetcare_mitzi_id, name: Mitzi}, {id: !secret surepetcare_lucy_id, name: Lucy}]
  1. If you don’t know what the “!secret” does, read through this.
  • the username is the username of your surepetcare account, usually your email.
  • the password is the password for your surepetcare account.
  • your household id requires a few more clicks to find. benleb shows a picture where to find this from his comment on June 9 above. I’ll explain it here as well though, for the chrome web browser. Start by going to this link. Before you log in, right click anywhere on the webpage and select inspect from the menu. A window should appear on one part of the screen. Select the “console” tab, from the tabs available in this new window. At this point, select login at the bottom right of the webpage, and proceed to log in. Once logged in, at some line in the “console” tab you should find that it says household_id, value: XXXXX (where XXXXX will be your household id)
  • Flaps and pets are both lists, so if you have multiple, you will have to fill in the information for all. I have 1 flap and 2 cats, so you can see how write a list entry for both a single entity and for several.
    • The flap id is found by selecting “household” from the hamburger menu on the top left, selecting the flap under the devices menu and then checking the url. It should look like this: “https://surepetcare.io/household/device/XXXXXX” where XXXXXX is the flap id.
    • The pet id is found in a similar fashion. Select “pets” from the hamburger menu, and then the pet you want. The url will now look like: “https://surepetcare.io/pet/edit/XXXXX” where XXXXX is the pet id.
  1. Once all this is done, repeat step 4 to restart the server. Good luck, and don’t hesitate to ask if you need any more help. I struggled for while a while myself before I got it working :wink:

  2. You should now have access to the binary_sensor for all flaps and pets, as well as sensor for the battery level of flaps. You can find these entities in the entity registry in the configuration menu :slight_smile:

8 Likes

Perfect! Thank you very much. I had to reboot after step 3. Not sure if that was necessary or not. :slight_smile:

Would be nice if the sensor could show the flap as locked during curfew hours

You should also log this under feature requests …
I had no idea that this existed … but would also buy one in a flash if HA had inbuilt support for it :smiley:

Also would be better if you could get it so that it doesn’t rely on their servers, and could talk directly with the hub!

Hi @benleb, any chance of implementing the reset of the sensors?

If the code works, it works. Adding it into HA does not change much of anything else. It makes no difference if there is only one developer. It doesn’t mean it will always and forever remain supported once its merged either. Integrations can and do get removed all the time. Imagine you bought this when it was in HA and by the time you set it up the integration was removed for one reason or another. There is no reason to return it because the code still works.

They seem to be quite open to merge in 3rd party developed integrations to HA … so why not?

I know that, but if they go broke etc I want it to still work which is why I said:

You are right, I updated the post accordingly :slight_smile:

Whether its integrated into HA or a custom component will not really increase or decrease the chances it will still work “if they go broke”.

I said:

I wasn’t talking about “integrated into HA” in that regards, I mean it would be better if it talked directly with the device (using its IP address) to get information rather than through the companies web server.
They were two different points.