Sureflap Connect - Pet Door

I can answer this myself, I’ve implemented it with some history_stats sensors:

- platform: history_stats
  name: "Ash Away Today"
  entity_id: binary_sensor.978_101084057949
  state: 'off'
  type: count
  start: "{{ now().replace(hour=0, minute=0, second=0) }}"
  end: "{{ now() }}"

- platform: history_stats
  name: "Ash Away Yesterday"
  entity_id: binary_sensor.978_101084057949
  state: 'off'
  type: count
  end: "{{ now().replace(hour=0, minute=0, second=0, microsecond=0) }}"
  duration:
    hours: 24

- platform: history_stats
  name: "Ash Time Away Today"
  entity_id: binary_sensor.978_101084057949
  state: 'off'
  type: time
  start: "{{ now().replace(hour=0, minute=0, second=0) }}"
  end: "{{ now() }}"

- platform: history_stats
  name: "Ash Time Away Yesterday"
  entity_id: binary_sensor.978_101084057949
2 Likes

How did you get the mushroom person card to use the Sure Petcare binary sensor please? For the home/away status

Sensor…

# Cats hours in or out
  - platform: history_stats
    name: puss hours away
    unique_id: puss_hours_away_from_home
    entity_id: binary_sensor.puss
    state: "off"
    type: time
    start: "{{ now().replace(hour=0, minute=0, second=0) }}"
    end: "{{ now() }}"

  - platform: history_stats
    name: puss hours home
    unique_id: puss_hours_in_home
    entity_id: binary_sensor.puss
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

Card …

type: custom:stack-in-card
card_mod:
  style: |
    ha-card {
      position: relative;
      background-image: {{ 'linear-gradient(rgba(79, 65, 64, 0.6), rgba(255, 248, 247, 0.9))' if is_state('person.puss', 'home') else 'none' }};
      background-blend-mode: overlay;
    }    
cards:
  - type: custom:mushroom-template-card
    primary: Puss
    secondary: >
      {{ states('sensor.puss_hours_home') | round(0) }} Hours In {{
      states('sensor.puss_hours_away') | round(0) }} Hours Outside 

      Battery {{ states('sensor.cat_flap_battery_level') | round(0) }}%
    layout: vertical
    entity: binary_sensor.puss
    multiline_secondary: true
  - type: custom:mushroom-chips-card
    chips:
      - type: template
        entity: lock.cat_flap_locked_in
        icon_color: |
          {% set state = states(entity) %} {% if state == 'locked' %}
            #F44336 
          {% elif state == 'locking' or state == 'unlocking' %}
            #FFEB3B
          {% elif state == 'unlocked' %}
             #9E9E9E
          {% endif %}
        icon: >
          {% set state = states(entity) %} {% if state == 'locked' or state ==
          'locking' or state == 'unlocking' %}
            mdi:lock
          {% elif state == 'unlocked' %}
            mdi:lock-open-variant
          {% endif %}
        content: In
      - type: template
        entity: lock.cat_flap_locked_out
        icon_color: |
          {% set state = states(entity) %} {% if state == 'locked' %}
            #F44336 
          {% elif state == 'locking' or state == 'unlocking' %}
            #FFEB3B
          {% elif state == 'unlocked' %}
             #9E9E9E
          {% endif %}
        icon: >
          {% set state = states(entity) %} {% if state == 'locked' or state ==
          'locking' or state == 'unlocking' %}
            mdi:lock
          {% elif state == 'unlocked' %}
            mdi:lock-open-variant
          {% endif %}
        content: Out
      - type: template
        entity: lock.cat_flap_locked_all
        icon_color: |
          {% set state = states(entity) %} {% if state == 'locked' %}
            #F44336 
          {% elif state == 'locking' or state == 'unlocking' %}
            #FFEB3B
          {% elif state == 'unlocked' %}
             #9E9E9E
          {% endif %}
        icon: >
          {% set state = states(entity) %} {% if state == 'locked' or state ==
          'locking' or state == 'unlocking' %}
            mdi:lock
          {% elif state == 'unlocked' %}
            mdi:lock-open-variant
          {% endif %}
        content: Both
    alignment: center
    card_mod: null
    style: |
      ha-card {
        margin-top: 5px;
        margin-bottom: 5px;
      }

puss

2 Likes

Since a few weeks the integration does not work for me in home assistant anymore. I’ve been trying to setup the integration a few times again, reinstalled it and for some reason it keeps giving me a invalid authentication when setting up the integration. I couldn’t find anything in the community that could solve this for me. Does anyone else have this problem as well, or even better, any idea what is going wrong for me?

Can we start with the obvious? Are you sure you can login to the website with the same username and password you’re using in the integration?

https://www.surepetcare.io/

Haha, ok fair enough. But yes, I checked the login, I can see the status in the app and the online portal. I know I had to set up some settings to get the API token correctly. But not sure if that is going OK, might be that it is related to that. But the weird thing is that it just stopped working a few weeks/months ago. So it feels like it should not be related to that. Not really sure where to look at at this point.

Anything else in the HA logs that might give more info?


Although I even tried to change and update my login credentials, it still seems related to the authentication. :face_with_monocle:

Hans, try to log off in the handy app (or even login to the webapp and logoff again). then login to the app (or webapp) again and watch, if sureflap offers you to accept the terms of use. these change from time to time and i have to agree to the terms about 2 times a year. after that everything works normal for me.
worth a try. greez

Thanks for the tip, unfortunately that didn’t work for me. :frowning:

I got it working. And wanted to show off. :wink:
Family is more relaxed now they can see that everybody is safe when we’re away for a while. Personally I’m looking what else we can do with this data.

Just a pitty that we don’t have the ‘cat has looked through’ data. Find this ‘amusing’ data, especially since 1 cat isn’t allow to go outside.

Schermafdruk van 2023-11-28 12-52-08


Having this working, I’m eager to get the food and drink bowls. Maybe they should give a reduction to people using HA?

It’s totally possible to get the ‘looked through’ working. Unfortunately, SurePet hates the open source community. I wouldn’t be surprised if they go the MyQ route eventually.

sorry Boland I’ve not logged on in a while, glad u managed it though

FAO hans449 and all others who are struggling to get the SureHA integration working.

It looks like the actual API has moved house recently, if you need to re-authenticate you are likely going to be unable to with the current version of the dependency ‘surepy’.

If you’re seeing these issues in your log files:

… then you might benefit from the code change that was correspondingly suggested:

However, I’m not sure the correct API is being used in the suggested code-change. I commented on the PR to this effect, especially around generating auth tokens.

Your mileage may vary. Good luck! I hope benleb is back soon. :slight_smile:

Hey all, I am considering to buy a Sureflap connect (we have the offline version already), but we need a specific feature, that I believe the original app does not support:
One of our cat can’t go outside during the day (sun is bad for him), but we would like to let him out when the sun goes down. Also we have two other cats and they are free to go anytime they want.
But as I saw we can’t set curfew for only one cat.
Can I solve that with HA with community plugins?
Cheers!

Not currently. I’d love to be able to toggle a pet to indoor only, but its not a function of surepy. We’d need @benleb’s help.

Aw, sad news, but thanks!
I think I will write to Sureflap about that, if they plan to add that feature in the future.

They already have that feature in their app. And they hate us, so good luck.

Oh, so the default app got that curfew mode uniquely set to each cat, just it is not accessible in HA?

Hi all,

after all the issues recently, i uninstalled sureha and installed all the surepetcare folders and yaml coding across

rebooted and failed to login, i think im missing something simple but can’t see what, any help is greatly appreciated