Sureflap Connect - Pet Door

What’s the benefit of lower case with _?

I don’t get a comment about not following the standards from @martinhjelmare in the next code review after submitting to the HA repo :grinning_face_with_smiling_eyes::grinning_face_with_smiling_eyes::+1: (best reviews ever btw., :ok_hand:)

but I wanted to test how to implement options in this funny config_flow/ui thing anyway,
maybe that’s a nice test case… :grinning_face_with_smiling_eyes:

1 Like

icons!!!

3 Likes

Have I missed something?

This integration as totally stopped working since 2021.5.x

I’m trying to configure it for the first time ever today. Using the integration component details here I am able to get the integration to load and detect my flap connectivity, hub connectivity and battery, but no other entities show up.

I’ve tried to follow the instructions in this thread to find the IDs by using the console during a login to surepetcare.io but seems that no longer works / obsolete.

After changing to the beta as described above, the component does not load at all.


Version	core-2021.5.4
Installation Type	Home Assistant OS
Development	false
Supervisor	true
Docker	true
Virtual Environment	false
Python Version	3.8.9
Operating System Family	Linux
Operating System Version	5.4.109
CPU Architecture	x86_64
Timezone	Pacific/Auckland

I can get some logs if required, but sounds like I’m not the only one with this issue

The current core integration is broken in 2021.5.x with various issues tracked on Github. I’m holding on 2021.4.6 with manual workaround pending resolution.

The beta also appears to be broken.

The beta works for me, but you need to reconfigure by removing your config in Configuration.yaml and configuring the integration in the GUI

Hi Ben,
Out of interest, how often does this hit the Sureflap cloud API? Do you have to poll the API to get the status of say for example the cat flap entry/exit? Or is this on a callback type of setup?

Thanks for the work!

its a poll-only API and currently we query it every 3min

OK, thank you.

Wait, where is it configured in the GUI?

edit: Oh I see now! Nice. Although just a heads up, the integration didn’t tell me what the fields were for, but I was able to guess that it was ID and password.

Could you please elaborate? I also don’t see it. I’ve followed these steps:

  1. Remove from configuration.yaml

  2. Clone the beta repo to config\custom_components\surepetcare

  3. Restart HA

  4. Looked everywhere?

edit … oh… nevermind. Post this then find it within seconds. For anyone else looking, after following the above steps go to Configuration / Integrations / Add Integration. Search and you will find it. As above config, fields are unlabeled, but for username/password.

I added it via HACS, then went to Integrations and added the Surepet Beta integration.

1 Like

I feel like I’m finally getting somewhere with this integration, thanks for your help everyone who’s posted here, and especially benleb.

If anyone wants to change the status txt to remove the _ it’s a simple as creating a new sensor like this:

sensor pet_door_status:
  - platform: template
    sensors:
      pet_door_status_template:
        friendly_name: "Pet Door Status"
        value_template: >-
          {% if is_state('sensor.pet_flap_pet_door', 'unlocked') %}
            Unlocked
          {% elif is_state('sensor.pet_flap_pet_door', 'locked_in') %}
            Locked In
          {% endif %}
        icon_template: >-
          {% if is_state('sensor.pet_flap_pet_door', 'unlocked') %}
            mdi:lock-open-variant
          {% elif is_state('sensor.pet_flap_pet_door', 'locked_in') %}
            mdi:lock-outline
          {% endif %}

Of course I’ve reverted to a basic mdi icon, but you could fairly easily point at at a custom image.

Also, without reverting to custom cards (still haven’t pulled that pin) this is the best I’ve been able to do for a button card - any other suggestions without custom stuff?

type: button
tap_action:
  action: call-service
  service: surepetcarebeta.set_lock_state
  service_data:
    flap_id: 1234567
    lock_state: unlocked
  target: {}
entity: sensor.pet_flap_pet_door
show_state: false
icon: 'mdi:gesture-tap'
hold_action:
  action: call-service
  service: surepetcarebeta.set_lock_state
  service_data:
    flap_id: 123457
    lock_state: locked_in
  target: {}
show_icon: true
name: Unlock / Lock (long press)
icon_height: 100px

Ok, I think I’m happy with this:

Here’s the switch for lock/unlock

switch petdoor_lock_unlock:
  - platform: template
    switches:
      petdoor_switch:
        friendly_name: "Pet Door Switch"
        value_template: "{{ is_state('sensor.pet_flap_pet_door', 'locked_in') }}"
        turn_on:
          service: surepetcarebeta.set_lock_state
          data:
            flap_id: 123457
            lock_state: locked_in
        turn_off:
          service: surepetcarebeta.set_lock_state
          data:
            flap_id: 1234567
            lock_state: unlocked
        entity_picture_template: >-
          {% if is_state('sensor.pet_flap_pet_door', 'locked_in') %}
            https://surehub.io/assets/images/inside-icon.svg
          {% else %}
            https://surehub.io/assets/images/petdoor-left-menu.png
          {% endif %}
        icon_template: >-
          {% if is_state('sensor.pet_flap_pet_door', 'unlocked') %}
            mdi:lock-open-variant
          {% elif is_state('sensor.pet_flap_pet_door', 'locked_in') %}
            mdi:lock-outline
          {% endif %}

and here’s the status template:


sensor pet_door_status:
  - platform: template
    sensors:
      pet_door_status_template:
        friendly_name: "Pet Door Status"
        unique_id: 000004
        value_template: >-
          {% if is_state('sensor.pet_flap_pet_door', 'unlocked') %}
            Unlocked
          {% elif is_state('sensor.pet_flap_pet_door', 'locked_in') %}
            Locked In
          {% endif %}
        icon_template: >-
          {% if is_state('sensor.pet_flap_pet_door', 'unlocked') %}
            mdi:lock-open-variant
          {% elif is_state('sensor.pet_flap_pet_door', 'locked_in') %}
            mdi:lock-outline
          {% endif %}
        entity_picture_template: >-
          {% if is_state('sensor.pet_flap_pet_door', 'locked_in') %}
            https://surehub.io/assets/images/inside-icon.svg
          {% else %}
            https://surehub.io/assets/images/petdoor-left-menu.png
          {% endif %}    

OK, I think I have myself in a right mess. I have the original setup mixed up with the beta… I installed beta thru hacs and then tried to git the latest too into the custom folder. My config points to the non beta as that was the folder it updated to! Oops.
Can anyone help with how to remove and start again please? What do I need as a start first? The Git route or HACS?
At the moment, I have the entities for the flap and cat but the status is not reflecting the cat inside or out. I can see some logs for surepy in the logs but I am not sure if this is OK…

Sorry to be a pain.

Actually, after a bit of analysis, I can see that the presence sensor for the pet is changed only after a HA restart, it doesnt change if HA is left running. I can see the surepy firinig every 3 mins for a keep alive connection. But I dont see the status of the pet (in or out) change unless I restart HA.

This is a known issue with the core integration and one of the reasons I’ve held off from updating, suggesting that you are currently pointing at the core integration despite having tried to install the beta as a custom component.

I’m afraid I can’t advise on cleaning up as I’ve not bothered going to beta.

Thanks for the response though, it helps me to understand I may be pointing to the incorrect version!