Surepetcare Sureflap connect

Hi all,

I have added the surepetcare integration for my Sureflap Connect but get the following error:

Logger: homeassistant.setup
First occurred: 20:17:39 (1 occurrences)
Last logged: 20:17:39

Setup failed for surepetcare: No setup function defined.

  username: !secret surepetcare_username
  password: !secret surepetcare_password
  flaps: [436xxx]
  pets: [187xxx]  

I am totally new to HA. I would be grateful for any help.

Extracted the numbers for the flap and my cat from Chrome developer.

Thank you

Stupid question, but are the brackets needed? [ ]

Thanks for your reply I’ve fully integrated this now

Brilliant. How you finding it? I’m looking to get one.

Absolutely loving it!

It’s by far my favourite HA integration!

Ordered mine yesterday. Thanks for the screenshot.

If you need any assistance with the integration let me know. I had a bit of difficulty but people on here were very helpful.

Now considering a GPS collar, PAWTRACKS. I’ve emailed the company regarding API or third party apps to see if it is possible to integrate this as a device tracker. I live in Spain and in the summer we have the windows open. I won’t be able to see if my cat is in/out as he won’t be using his flap.

Thanks. Any chance you could share some YAML of what you’ve got so far? I’ve got the door installed and integrated and can lock and unlock from HA which is fantastic!. I’m now looking to create some automations to half lock the door at sunset and then double lock when both cats are in.

That’s what I have so far. I haven’t had a lot of time recently to add to it as work has been mental but I’m sure there is a lot more I could do with it

#####Cat Flap Login #######
  username: xxxxxxxxxxxxxxxxxxxx
  password: xxxxxxx
  flaps: [xxxxxx] 
  pets: [xxxxxx
#### tracker icon Vaska#####
   - platform: composite
     name: Vaska
      - binary_sensor.pet_vaska ] 
   - platform: template
        friendly_name: Vaska Location
        value_template: "{{ state_attr('binary_sensor.pet_vaska', 'where') }}"
        friendly_name: Sure Flap Battery
        value_template: "{{ state_attr('binary_sensor.pet_vaska', 'battery') }}"
        unit_of_measurement: '%'

Thanks. I see you’re using the custom component to create a device tracker. You’ve also created a battery sensor but my integration created that automatically. Here are the sensors mine created by default after registering one cat and one dog.


I couldn’t get the battery sensor to work out of the box so had to do some fiddling.
I’d love to get the curfew integrated and the timeline but just not been able to make time for it.

Here’s what I’ve done so far.

  - alias: "Half Lock Cat Door if open after sunset"
    initial_state: true
      - platform: sun
        event: sunset
        ## postive value is after sunset ##
        # offset: '00:20:00'
        # offset: '-00:45:00'
        ## 45 minutes before sunset looks like the above ##
      - condition: state
        entity_id: sensor.pet_flap_laundry_door
        state: 'Unlocked'
      - service: surepetcare.set_lock_state
          flap_id: !secret flap_id
          lock_state: locked_in
      - service: script.ghm_tts ## Calls the Google Home app group called media_player.tts_homes
          tts: "I've locked the cat door so the cats can't go out"
          volume: 0.5

  - alias: "Unlock cat door at sunrise"
    initial_state: true
      - platform: sun
        event: sunrise
        ## postive value is after sunset ##
        # offset: '00:20:00'
        # offset: '-00:45:00'
        ## 45 minutes before sunset looks like the above ##
      - condition: state
        entity_id: sensor.pet_flap_laundry_door
          - Locked_all
          - Locked_in
          - Locked_out
      - service: surepetcare.set_lock_state
          flap_id: !secret flap_id
          lock_state: unlocked

    alias: 'Lock cat door'
      - service: surepetcare.set_lock_state
          flap_id: !secret flap_id
          lock_state: locked_all

Nice work. I’m novice in Home Assistant but want to setup my Sure Petcare devices correctly in this app.
I have two cats, one cat flap and two feeders.
It should be nice if I can script that cats are allowed to leave our home starting from sunrise till sunset.
As I see the examples above I was wondering where I can find more information / documentationon the scripts created and shared above.

Anybody experienced issue with the component after upgrading to 2021.4.0 version.
I have the following error message:

Logger: homeassistant.setup
Source: util/ 
First occurred: 11:43:54 PM (1 occurrences) 
Last logged: 11:43:54 PM

Error during setup of component surepetcare
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/", line 240, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/surepetcare/", line 116, in async_setup
    device_data = await surepy.device(device[CONF_ID])
  File "/usr/local/lib/python3.8/site-packages/surepy/", line 184, in device
    device: Dict[str, Any] = (await self.devices).get(device_id, {})
  File "/usr/local/lib/python3.8/site-packages/surepy/", line 181, in devices
    return await self.get_entities("devices")
  File "/usr/local/lib/python3.8/site-packages/surepy/", line 244, in get_entities
    await self._get_resource(resource=MESTART_RESOURCE)
  File "/usr/local/lib/python3.8/site-packages/surepy/", line 262, in _get_resource
  File "/usr/local/lib/python3.8/site-packages/surepy/", line 410, in get_token
    raw_response: requests.Response =
  File "/usr/local/lib/python3.8/site-packages/requests/", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.8/site-packages/urllib3/", line 234, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/local/lib/python3.8/http/", line 1255, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.8/http/", line 1266, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/local/lib/python3.8/site-packages/urllib3/", line 214, in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/util/", line 150, in protected_loop_func
  File "/usr/src/homeassistant/homeassistant/util/", line 139, in check_loop
    raise RuntimeError(
RuntimeError: I/O must be done in the executor; Use `await hass.async_add_executor_job()` at homeassistant/components/surepetcare/, line 116: device_data = await surepy.device(device[CONF_ID])

1 Like

I tried updating and got the same message.

I’ve rolled back for the moment

1 Like

Same issue here with surepetcare, I notice they have changed their app and updated the surepetcare software too.

Have a look at Tractive:

Nice Daniel, will take a look at that.


I like the look of Pawtrack collar because it’s smaller than others but I’ll definitely look into this mate :+1:

hi, Is this still working for you?