Sureflap Connect - Pet Door

Try: GitHub - Danielhiversen/home_assistant_petcare: Petcare intgration for Home Assistant
Can be set up from the gui

1 Like

Oh wow you stole basically all the code without even mentioning it :smiley: nice job bro, that’s how opensource works! :clap:

Best of all he is asking for donations too.

oh wow… I’ve just tried that integration and its early days but it appears to work???

What is this integration? did someone just grab the official integration and modify the code???

It is a total rewrite, but uses the same endpoints (of course)

1 Like

I see… well it works so thankyou very much… as I said above in ha 2021.05 the other integration just stopped working… entities present, nothing in the logs, the statuses just didn’t update

Not sure what you guys do with this integration but I hope this might serve as inspiration. Our two cats have people accounts in our home assistant. I set up virtual trackers and update the virtual trackers when they enter/leave. I also set up a virtual open/close sensor so we know each day how many times the catflap has opened and closed… I like to have a seven day bar graph showing a count of their comings and goings. As we all know any changes in how much time they spend indoors or how many times they come and go can be handy for keeping an eye on them. Its all driven by the following automations.

# ============================================
- alias: Rufus Tracker Arrive
  trigger:
    - platform: state
      entity_id: sensor.rufus
      to: "INSIDE"
  action:
    - service: device_tracker.see
      data_template:
        dev_id: rufus_location
        host_name: rufus_location
        location_name: "Home"
    - service: input_boolean.turn_on
      data:
        entity_id: input_boolean.cat_flap_debounce
    - delay: "00:00:15"
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.cat_flap_debounce
# ============================================
- alias: Rufus Tracker Leave
  trigger:
    - platform: state
      entity_id: sensor.rufus
      to: "OUTSIDE"
  action:
    - service: device_tracker.see
      data_template:
        dev_id: rufus_location
        host_name: rufus_location
        location_name: "Away"
    - service: input_boolean.turn_on
      data:
        entity_id: input_boolean.cat_flap_debounce
    - delay: "00:00:15"
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.cat_flap_debounce

Should be fixed here: GitHub - benleb/surepetcare: dev branch of the Home Assistant surepetcare integration (sorry, manual install)

Thats the repo for the “dev branch” of the official surepetcare integration. This makes it a little more independent from the home assistant release cycle and I can provide fixes/feature much faster for the people interested :v:

2 Likes

of course… so, please remove it or respect the license of my (and maybe also that of the HA parts) code and mention where you got the code from. We both know that github or anyone else looking at the code will see whats going on :laughing:

just for my curiosity… why don’t you want to support this project here (Home Assistant!) and create a PR but steal code and put it to HACS?! From what I have seen from you in the past, I thought you are one of the cool guys :thinking:

1 Like

Thank you very much!!

I suspected something was missing but didn’t want to cry out “wolf” too early.
Keep up the good work and let me know how I can shoot you a coffee.

Most of the code is completely different than yours, so it is not a copy.
It also seems that we are using different endpoints? I mainly use https://app.api.surehub.io/api/timeline

I wanted an alternative integration to limit the number of requests to petcare as much as possible, and to have locks in HA to control the flaps.

I will add a link to your integration and explain that GitHub - Danielhiversen/home_assistant_petcare: Petcare intgration for Home Assistant is an alternative integration with some advantages and some disadvantages

cool :slight_smile: but think about contributing to the “official” integration. I am open to any improvements or changes and in the end we all could profit :+1:
(thats also true for the surepy lib itself btw)

1 Like

I still think my integration is far superior, but I am obviously biased. :slight_smile:

Perhaps I should spend some time investigating how to make it a proper integration rather than just creating MQTT sensors and switches using MQTT Discovery, and have the component just listening to the raw hub packets and parsing them using my parser code. Since then all you would need would be the flask web server to cache the credentials and reconfigure your MQTT server to also be listening on TLS on 8883.

3 Likes

Hey guys - any help appreciated - basically it seems as if there is a problem starting my integration for Surepet as of now. With that said - i have tried to remove the configuration.yaml entries that defines the integration in total, rebooted and problem but also integration is obviously gone. As soon as I am referencing it again in the configuration.yaml same error returns, being:

Logger: homeassistant.setup
Source: components/surepetcare/__init__.py:150
First occurred: 11:25:37 AM (1 occurrences)
Last logged: 11:25:37 AM

Error during setup of component surepetcare
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 248, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/surepetcare/__init__.py", line 88, in async_setup
    await spc.async_update()
  File "/usr/src/homeassistant/homeassistant/components/surepetcare/__init__.py", line 150, in async_update
    self.states = await self.surepy.get_entities()
  File "/usr/local/lib/python3.8/site-packages/surepy/__init__.py", line 253, in get_entities
    surepy_entities[entity_id] = Pet(data=entity)
  File "/usr/local/lib/python3.8/site-packages/surepy/entities/pet.py", line 37, in __init__
    self.state = PetState(data["status"])
KeyError: 'status'

Is there any way of “forcing an update” / restore of the files associated with the integration and its dependencies that you are aware of? Another key thing that I am trying to understand is: the paths listed in the error (e.g “/usr/src/homeassistant/homeassistant/setup.py”) cannot be seen from my ssh console. I am running hassio and since i am not a Linux type of fellow - is that due to the paths being referenced are run within a container - or is that simply the problem itself, that the files needed are not place? If i look in my “/usr” directory - i dont even see a /src or a sub /src/homeassistant path trailing…

Thanks in advance dudes…

@benleb I was not updating to latest version of HA because the integration was not included yet.

Today I bite the bullet and installed latest version of HA, did remove the unnecessary lines in configuration.yaml and also remove the old integration files. When upgrade of HA was finished everything seems to work, but I noticed nothing updates, if the cats go outside it shows still inside, waited 20 minutes nothing changed. Then checked the entities everything seems to work except the sensor.pet_flap_tuin_kattenluik I am not sure if this is part from old integration or the new one.

Am I doing something wrong here?

Here a screenshot of the entities:

Hay what the font you are using and how did u set it up

Raleway font and the Noctis theme… see noctis repo for install instructions

locking/unlocking already fixed in GitHub - benleb/surepetcare: dev branch of the Home Assistant surepetcare integration

regarding the update problem, I think I fixed it, works for me, will push it today or tomorrow probably :slight_smile:

2 Likes

It would be great value to the community to have a solution that does not rely on the internet service of the company. All companies go belly-up or stop supporting services at some point in time, and then these expansive cat flaps will become a brick.

Like you, I have the cat flap connect with Hub; but honestly have not the skills to replicate what you have created. There are some smart cookies on this chat who could prob create a solution over time, but I understand that you all have day jobs as well and already have built part a solution independently.

Well done to all and hopefully over time we have the privilege to a solution that is no longer dependent on the cloud

I’ve build the local instance that does not require the cloud already @axa4953

You need a raspberry Pi to run in your own home network and a router… but for the most part it already works.

2 Likes