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:
-
Remove from configuration.yaml
-
Clone the beta repo to config\custom_components\surepetcare
-
Restart HA
-
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.
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!
Nope. I tried removing from HAC. Deleting Sureflap & sureflapbeta folders in Custom_components.
Restart HA.
Then git clone GitHub - benleb/surepetcare: dev branch of the Home Assistant surepetcare integration (this makes a surepetcare folder)
Then add
surepetcarebeta:
username: redacted
password: redacted
logger:
default: info
logs:
surepy: debug
custom_components.surepetcarebeta: debug
custom_components.surepetcarebeta.binary_sensor: debug
custom_components.surepetcarebeta.sensor: debug
Restart HA
The cat flap and cat presence entities are unknown. The logs show 2021-05-18 17:40:24 ERROR (MainThread) [homeassistant.helpers.integration_platfo - Pastebin.com
To install the beta, DO NOT put any config into configuration.yaml. Clear that out, restart HA, then go to Integrations - Add Integration - search for sureptecarebeta. (this assumes you have already cloned the repo to your custom components, which it appears you have done)
You will be prompted for username/password (although the prompt has no descriptions).
Once that’s done your devices and entities etc will appear
Thank you so much. All sorted now. Working like a charm.
I’ve tried to follow this, but something still isn’t right.
- Removed config lines for surepetcare from my configuration.yaml.
- Restarted HA (the old entities are still there after the restart, but are disconnected)
- Cloned the beta repo into my custom_components folder.
- Restarted HA again
- Tried to add the beta via the integration GUI. It’s not listed in either the “Integrations” or “HACS” lists and cant be found via search either.
- Stuck. #headscratching
Is the component folder called “surepetcare” ?
Nope. it’s called “surepetcarebeta”
Which is what HACS installed once I’d manually added the repository to HACS and installed it from there.
Try a manual install of the beta. Clone (or download) the repository (find benleb’s link above). It should be placed in / create a folder called surepetcare (not beta) as per my picture. I am not certain that the HACS plugin gets the latest beta.