Sureflap Connect - Pet Door

Since I’m running 3.8, is it possible to just download the changed files and manually add them to my HA?

Yeah, thats what I’m doing so I can use the code I’ve written. Should just be a case of downloading all the files from https://github.com/insertjokehere/home-assistant/tree/surepet_lock_state_service/homeassistant/components/surepetcare

1 Like

Looks like that worked! I just added all of it to custom_components. Now I just need to remember to remove it from custom components when everything gets updated.

edit: And is there any documentation on what the ‘learn_mode’ attribute is for the flap lock?

answer: Learn mode is what gets enabled to scan for your pet’s chip.

Is there a way to manually call the integration to refresh all the sensors then?

An update:

  • The lock state service stuff has been merged - not sure if it happened in time to make it into v2021.1.0, might end up being v2021.2.0
  • I think I’ve got a way to make the update_entity service work with the integration, but its a fair bit of work. I’ll try and find the time to implement it, but no promises as to when that’ll be
2 Likes

Thank you so much for this! My cats and I really appreciate it. What is the best way to know its been updated in core so that I can remove the custom_component?

Also, is it possible to be able to update the animal status from HA?

1 Like

+1 its really helpful!

has been done (if so, which release) about feeder information at all?
eg. all the metrics and info on how much food was added, when and how much was eaten?

goals:

  • notify if cat not eating the “normal” amount each day and so potential health problems
  • notify if feeder is empty
  • notify if feeder has not had food added and someone forgot to add food by mistake that day
    etc…

Hey, I can implement a function in the lib to refresh the data, shouldnt be much effort in the lib…

If you need other things from the lib or anything, tell me :smiley: and thanks for your work on the integration!

endless story… I do not think that sure petcare will ever open its api…

While developing I send much more requests than used in the integration, but just for minutes/hours and not 24/7. I think it should be okay to lower the interval to 180, 120 or even 60s but I am not sure if this should be broadly used (= set as the default). A few users with a lower interval do not make a difference in the overall traffic (= cost) but if enough users multiply the requests they send 24/7, it may increase the overall requests to their api to a level they do not like…

In my case, I plan to refresh every 5-10 minutes, then have HA call a refresh when it sees an alert from Surepet on my phone. While not perfect, it will shit up their servers less. :wink:

Whenever I try and set this up it never seems to work properly. The cats are detected coming in/out but the other settings like connection, battery level, etc always hit an issue…

Error adding entities for domain binary_sensor with platform surepetcare
Error while setting up surepetcare platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state
    attr.update(self.device_state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/surepetcare/binary_sensor.py", line 240, in device_state_attributes
    "device_rssi": f'{self._state["signal"]["device_rssi"]:.2f}',
KeyError: 'signal'

Do you have both flaps and pets set in your YAML? IIRC, when I first did this, I wrongly used the ID listed for Home (I think it was called) and not the actual flap.

1 Like

Thanks for that. I was pretty sure I was using the correct ID but having another look, it turns out I wasn’t.

I used the yellow underlined ID but actually needed the green underlined ID which is a child of the parent device.

1 Like

You can recognize this by the product_id also shown. 1 is your Hub, 6 is a Cat Flap :slight_smile: See here for all IDs :slight_smile: You can get an easy overview about your devices/pets/IDs with the surepy cli tool from the repo linked.

2 Likes

Not sure if you saw my post, but would it be possible to add the ability to set pet status from surepy?

Can you share your automation for this please?

Unfortunately, I don’t have it done yet, because there’s no way to force a refresh right now. But basically, I’d use the Last Notification sensor on my phone to trigger the Sureflap refresh.

I’m not sure why you need an ‘instant’ notification. A 2-3 minute refresh is ok for most things. Just curious.

I mean, why wouldn’t you want instant notifications about mundane, useless stuff? Isn’t that why we’re all here? :smiley:

Imagine how hard it would be to create automations if all your sensors simply updated once every minute or two…

Will probably be implemented in the lib this weekend :slight_smile:

as well as this :v: