Sureflap Connect - Pet Door

I was interested in this catflap - apart from the need to use a third party service (partly due to privacy - I don’t really want my cat’s movements being shared to a third party; but also for concerns about longevity - the pet door has a control panel which allows access to most features, but the smaller cat door requires the android app to access pretty much any setting).

So would be interested in a way of using this without needed the amazon\xively services.

One route would be to intercept the hub to server communications - which might be possible with some DNS spoofing in the local router as long as the hub isn’t doing detailed validation on the ssl certificates.

A cleaner route might be to intercept the communication between the flap and the hub - i.e. to create a “virtual hub” replacing the official hub. I suspect the communication is via standard 802.11 wifi with some mechanism to negotiate the SSID and\or key between the flap and the hub, but I don’t know how easy that would be (or how keen sureflap would be on that idea).

Matthew

hello

can you please send me a
installing dokumentation
configuration dokumentation and
some sample API calls

for the rcastberg/sure_petcare

thank you

Klaus

I finally got it working! Thank you @rcastberg :slight_smile:

My situation

  • First itme HA user
  • Home Assistant 0.80.1 installed in my LXC container (no HASS or raspberry pi)
  • Sureflap Catdoor Connect

Steps

  1. Went in to my HA directory: cd /root/.homeassistant/

  2. git clone https://github.com/rcastberg/sure_petcare.git

  3. Tried ./sure_petcare/sp_cli.py to verify I can connect to API with credentials

  4. Added sure_username and sure_password to secrets.yaml

  5. mkdir -p custom_components/sensor and place sure_petflap.py in there

  6. ./sure_petcare/sp_cli.py ls_pets to find name of pet

  7. Copy sensors.yaml, binary_sensors.yaml and groups.yaml into HA directory and change name of pet

  8. As i am an HA noob :slight_smile:, i didnt knew i had to include these 3 files in my configuration.yaml:

    sensor: !include sensors.yaml
    binary_sensor: !include binary_sensors.yaml
    group: !include groups.yaml
    
  9. Install sure python package: pip install /root/.homeassistant/sure_petcare/sure_petcare/ -t /root/.homeassistant/deps/

  10. Restart home-asssistant service, got some errors:

in "/root/.homeassistant/binary_sensors.yaml", line 3, column 7
expected <block end>, but found '<block mapping start>'
in "/root/.homeassistant/binary_sensors.yaml", line 13, column 8

Found out it was because indentation in sample config was wrong. Changed the binary_sensors.yaml etc to two spaces indent.

  1. Got more errors:
  File "/root/.homeassistant/custom_components/sensor/sure_petflap.py", line 59, in setup_platform
    username = config.get(CONF_USERNAME)
NameError: name 'CONF_USERNAME' is not defined

Fixed it by making a quick hacky change to /custom_components/sensor/sure_petflap.py . I commented out import homeasssistant so is_hass_component wouldnt throw an exception. As said i dont use HASS.

Afterwards, it is working fine :smiley:
(This was last night, described steps afterwards so there might be one missing…)

4 Likes

Hello
is it possible to run the rcastberg code without Home Assistant? only on a raspbian operating system?
If yes can you please say me how?
Thank you

Klaus

Very interested in getting this up and running but using haas.io, will this work on the hass.io platform running on a RPi 3

1 Like

Yes, it looks like it will run using Hassio

1 Like

Thats great, how do I go about installing this as Ive only been using hassio for about a month now so still learning.

1 Like

Same here, great project. I’d love to see a step by step write up.

1 Like

I have copied over the folders to the relevant places and after restating I’ve got a Sure Cat Flap Status panel come up with:
Hub online Status - Disconnected
Flap online Status - Disconnected
Sure Flap - Locked

I now believe I need to run the ‘pip install . -t /config/deps/’ but not sure how to do this in hassio, any pointers please as I don’t want to crash things again and have to do a new hassio install on my RPi.

When I look in the ‘config/deps/’ folder, I only have ‘lib’ in there.

I would be grateful of some help on this. I don’t know where to start to populate the /deps/ folders with the necessary folders or files

Now that my cat flap has arrived and I’ve used it I have to say that I’m quite impressed with it.

I now think that the only thing I need HA to do with it is to have Google Assistant announce which cat has gone in/out over my Google home minis.

Is there a simpler way?

I can’t get this to work. Whatever I do I get:
Platform not found: sensor.sure_petflap

And in Putty I get the following error with step 9:
-bash: -bash:: command not found

Can someone explain me how I get to run this exactly? Where do I have to copy the files exactly? And why can’t I install the python package?

Thanks in advance!

Is it possible to make an hassio addon of this?

4 Likes

I build a pip package for this which makes installation much easier: https://pypi.org/project/sure-petcare

This is NOT maintained or anything else by the author of the code, rcastberg. If he will provide a pip package sometimes, i will remove this one.

3 Likes

I’m getting this error:
WARNING (MainThread) [homeassistant.config] Package sure_petcare contains invalid customize

Is there any checklist how to get this working? I have followed [xatr0z]'s checklist.

Update: did “pip install requests” and got the module error out of the way. Can connect to sp_cli.py. It just returns an error about no credentials provided.

What Widda said. I got everything installed. Things just go wrong when I try to access sp_cli.py, either with our without the ls_pets added. This is the outcome of the “./sure_petcare/sp_cli.py” command:

Traceback (most recent call last):
File “./sure_petcare/sp_cli.py”, line 7, in
import sure_petcare
File “/config/sure_petcare/sure_petcare/init.py”, line 9, in
import requests
ModuleNotFoundError: No module named ‘requests’

I Should note that the git pull command put everything in /config/sure_petflap instead of /config/custom_components/sure_petflap. (I run hassio on a RPI3B). Will that make a difference?

I used pip install -t /deps, while I was in the config folder. Worked like a charm.

1 Like

I almost got it al working. The last snag refused to go away and eventually seemed to crash my system: the sensor was not found by Home Assistant. I was able to get the pet’s names and all. But the error kept turning up on reboot.

I then gave the sensor file all kinds of permissions, restarted my Pi and… half an hour later I was reinstalling en restoring a snapshot.

Any suggestions?

Has anyone managed to get a definitive set of instructions for this ?

Could anyone please make a step by step install guide for hassio?

1 Like