Sureflap Connect - Pet Door

Thank you so much for all of your hard work on this project.

I think I have everything availbale up and running.

Question: Do you know if it is possible to make my cat’s status badge the same as a device_tracked badge showing home and away like it is for my wife and I?

image

Ive used this for a while now and don’t display the location information.

I took a close up picture of the cat and converted a copy to black and white.
I then use these pictures to donate whether the cats in (colour pic.) or out (B/W pic.) Works well.

      - type: picture-entity
        entity: binary_sensor.pet_bo
        show_name: false
        show_state: false
        state_image:
          'on': /local/bo_in.jpg
          'off': /local/bo_out.jpg
1 Like

That’s really cool.

Thanks

Hi guys,

First of all thank you for this great integration! I just got this upp and running and everything is working OK. I´m running the latest HA version. Enyone else get this in the logg:

Logger: homeassistant.util.async_
Source: util/async_.py:129
First occurred: 9:20:31 PM (1 occurrences)
Last logged: 9:20:31 PM

Detected I/O inside the event loop. This is causing stability issues. Please report issue for surepetcare doing I/O at homeassistant/components/surepetcare/init.py, line 114: device_data = await surepy.device(device[CONF_ID])

Looks like there is an open issue for this.

image

I used the composite device tracker to turn the binary sensor into a device_tracker and then created a person for my cat and used the composite device tracker.

device_tracker:
  - platform: composite
    name: Nero
    # time_as: device_or_local
    entity_id:
      - binary_sensor.pet_nero
1 Like

Awesome thank you! Works perfectly :slight_smile:

I have started to experience issues with the Sure PetCare integration connecting on startup. If I reboot HA I find that more often than not, the Sure PetCare integration fails to startup … I can usually get it to connect after a series of reboots, but I wondered if anyone else is experiencing issues. I suspect the Sure PetCare servers are slow to respond so the integration times out.

I am running HA 2021.2.3, and have only seen these issues since I updated.

Yeah me too but iv had them for a while so not only a 2021.2.3 issue

Yes, this would be great.

@antb via github sponsors :crazy_face: but we do not expect something :+1: :smile: PRs would also be a great way to „help“ :smile::wink:

@insertjokehere if you need something in the lib or a new release or anything, tell me :slight_smile:

@bda55 @getsmokes already available in the lib, so it’s „on the way“ more or less, without any guarantees :smile::v:

The config option for a device_tracker entity as well as the binary sensor would be a nice touch. Would save us having to use workarounds to configure a tracker to implement into the person’s component.

Anyone create a template switch that allows the door to be fully unlocked and locked (locked_all) using one switch so I can integrate into our voice assistants?

@nckslater can I ask how you get the information about how many hours and times your cat was outside please.

I can’t seem the get it work, or did you create sensors for that? If so could you please share your yaml code?

Thanks

EDIT: Got it with https://www.home-assistant.io/integrations/history_stats

1 Like

For anyone looking to mimic the Sureflap LCD screen, I’ve created a picture-glance that does exactly that. Works a treat!

Sureflap

type: picture-glance
entities: []
title: []
state_image:
  Locked_all: /local/sureflap_fully_locked.jpg
  Unlocked: /local/sureflap_fully_unlocked.jpg
  Locked_in: /local/sureflap_in_only.jpg
  Locked_out: /local/sureflap_out_only.jpg
  Curfew: /local/sureflap_curfew.jpg
entity: sensor.pet_flap_laundry_door
show_state: []

Download the picture assets here and copy to your www folder:

EDIT: 14th March. Assets tidied up so they are now all the same size.

EDIT: 13th May. Added Curfew Mode icon to indicate if lock state was overridden by the app

image

7 Likes

Another idea which works with this integration (if you have a 3D printer)

Couple weeks ago I printed 2 lithophane’s and modified a existing box printed that one with wood filament, than added 2 Sonoff zigbee mini’s.

So if one of the cats goes outside her lithophane lights up, this way we can directly see which cat is outside.

Here some pictures:
kat_belet_01
kat_belet_02

Thanks for this integration guys, it makes possible to make nice things!

7 Likes

Hoping somone might be able to point me in the correct direction as to why i cant get this working.

First error is

Logger: homeassistant.util.async_
Source: util/async_.py:129
First occurred: 19:51:21 (1 occurrences)
Last logged: 19:51:21

Detected I/O inside the event loop. This is causing stability issues. Please report issue for surepetcare doing I/O at homeassistant/components/surepetcare/__init__.py, line 114: device_data = await surepy.device(device[CONF_ID])

Followed by

Logger: homeassistant.setup
Source: /usr/local/lib/python3.8/asyncio/events.py:81
First occurred: 19:51:31 (1 occurrences)
Last logged: 19:51:31

Setup of surepetcare is taking over 10 seconds.

And finally

Logger: homeassistant.setup
Source: components/surepetcare/__init__.py:114
First occurred: 19:51:37 (1 occurrences)
Last logged: 19:51:37

Error during setup of component surepetcare
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 278, in _get_resource
    response: aiohttp.ClientResponse = await self._session.get(resource, headers=headers, timeout=timeout)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 544, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 890, in start
    message, payload = await self._protocol.read()  # type: ignore
  File "/usr/local/lib/python3.8/site-packages/aiohttp/streams.py", line 604, in read
    await self._waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 280, in _get_resource
    logger.debug("response.status: %d", response.status)
  File "/usr/local/lib/python3.8/site-packages/async_timeout/__init__.py", line 45, in __exit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.8/site-packages/async_timeout/__init__.py", line 92, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/surepetcare/__init__.py", line 114, in async_setup
    device_data = await surepy.device(device[CONF_ID])
  File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 184, in device
    device: Dict[str, Any] = (await self.devices).get(device_id, {})
  File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 181, in devices
    return await self.get_entities("devices")
  File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 244, in get_entities
    await self._get_resource(resource=MESTART_RESOURCE)
  File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 311, in _get_resource
    raise SurePetcareConnectionError()
surepy.SurePetcareConnectionError

Quite often when I restart HA, this doesn’t always start and I’m not sure what the problem is…

2021-03-12 13:06:34 ERROR (MainThread) [surepy] Can not load data from https://app.api.surehub.io/api/me/start
2021-03-12 13:06:34 ERROR (MainThread) [homeassistant.setup] Error during setup of component surepetcare
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 278, in _get_resource
response: aiohttp.ClientResponse = await self._session.get(resource, headers=headers, timeout=timeout)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 544, in _request
await resp.start(conn)
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 890, in start
message, payload = await self._protocol.read() # type: ignore
File "/usr/local/lib/python3.8/site-packages/aiohttp/streams.py", line 604, in read
await self._waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 280, in _get_resource
logger.debug("response.status: %d", response.status)
File "/usr/local/lib/python3.8/site-packages/async_timeout/__init__.py", line 45, in __exit__
self._do_exit(exc_type)
File "/usr/local/lib/python3.8/site-packages/async_timeout/__init__.py", line 92, in _do_exit
raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 213, in _async_setup_component
result = await task
File "/usr/src/homeassistant/homeassistant/components/surepetcare/__init__.py", line 114, in async_setup
device_data = await surepy.device(device[CONF_ID])
File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 184, in device
device: Dict[str, Any] = (await self.devices).get(device_id, {})
File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 181, in devices
return await self.get_entities("devices")
File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 244, in get_entities
await self._get_resource(resource=MESTART_RESOURCE)
File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 311, in _get_resource
raise SurePetcareConnectionError()
surepy.SurePetcareConnectionError

Any idea why this might be?

I blame the poor cloud implementation by Surepetcare. I also get these same errors and most times need multiple reboots before I get the integration to be able to connect.

That said, hopefully soon we will have a non-cloud option for DIYers in Surepet hub local for pet/cat door and feeder

@peterl is doing epic work on it.

2 Likes

Thanks @tinuva I have made some great progress and would love some help getting a few of the last issues sorted. So any assistance folks can provide especially with the CRC calculation of the message in https://github.com/plambrechtsen/pethublocal/issues/1 would really help.