Sureflap Connect - Pet Door

I’m more or less familiar with Python and other programming languages. Happy to help, but will need to understand your integration. I will take the time to go throught your code :wink:

cool! :smiley:

preview the current state I plan to push in the next hours…

2 Likes

That looks ace!

Mine seems to be working now so ignore my issue I dunno what was up

Extracted the icons from the app to use in home assistant though looks nice and neat.

uh nice! could you share them with us? :smiley: but maybe I don’t can embed them in the integration itself due to copyright things…

Fabulous :wink:
I can start scripting that my neighbor is warned if one of my pets doesn’t have enough food anymore. And I can give my neighbor access to my house with a smart lock for a certain period :ok_hand:t3:

Yes I will I need to make some more for feeders and I don’t have cat flap so will have to get image from mates account.

I’m no expert on copyright but if the license mentions where there from and it’s for their stuff I don’t see it as a big issue not like your claiming it’s your image.

They are SVG format but as I don’t know how to give it a colour to SVG in HA, I set it to match my theme then saved as PNG to use in HA.

Hm I cant tell about where the icons are from visibly if I use them as entity picture which is shown in HA probably :smiley: and I do not make them angry in any way, they can make all our lives much harder :sweat_smile: but until now, they happily tolerated (but also nothing more) all our activities and nobody got ever banned or anything… at least afaik :smiley: thanks sure! :smiley:

regarding the svg, open it with your favorite code editor :wink:

honestly, do never tell the internet you have a smart lock and never never never do it in connection with your name…

1 Like

Think might have found an issue unfortunately

feeder code and maybe the felaqaua fix now online :slight_smile:

Will test it and come back ASAP.
Is there an easy way to implement the new code without entirely restart HA?

2021-05-10 21:03:28 ERROR (MainThread) [homeassistant.helpers.integration_platform] Unexpected error importing surepetcarebeta/group.py

Traceback (most recent call last):

File “/usr/src/homeassistant/homeassistant/helpers/integration_platform.py”, line 33, in _process

platform = integration.get_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 493, in get_platform

cache[full_name] = self._import_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 498, in _import_platform

return importlib.import_module(f"{self.pkg_path}.{platform_name}")

File “/usr/local/lib/python3.8/importlib/init.py”, line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File “”, line 1014, in _gcd_import

File “”, line 991, in _find_and_load

File “”, line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named ‘custom_components.surepetcare.group’

2021-05-10 21:03:28 ERROR (MainThread) [homeassistant.helpers.integration_platform] Unexpected error importing surepetcarebeta/logbook.py

Traceback (most recent call last):

File “/usr/src/homeassistant/homeassistant/helpers/integration_platform.py”, line 33, in _process

platform = integration.get_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 493, in get_platform

cache[full_name] = self._import_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 498, in _import_platform

return importlib.import_module(f"{self.pkg_path}.{platform_name}")

File “/usr/local/lib/python3.8/importlib/init.py”, line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File “”, line 1014, in _gcd_import

File “”, line 991, in _find_and_load

File “”, line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named ‘custom_components.surepetcare.logbook’

2021-05-10 21:03:28 ERROR (MainThread) [homeassistant.helpers.integration_platform] Unexpected error importing surepetcarebeta/system_health.py

Traceback (most recent call last):

File “/usr/src/homeassistant/homeassistant/helpers/integration_platform.py”, line 33, in _process

platform = integration.get_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 493, in get_platform

cache[full_name] = self._import_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 498, in _import_platform

return importlib.import_module(f"{self.pkg_path}.{platform_name}")

File “/usr/local/lib/python3.8/importlib/init.py”, line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File “”, line 1014, in _gcd_import

File “”, line 991, in _find_and_load

File “”, line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named ‘custom_components.surepetcare.system_health’

2021-05-10 21:03:28 ERROR (MainThread) [homeassistant.helpers.integration_platform] Unexpected error importing surepetcarebeta/media_source.py

Traceback (most recent call last):

File “/usr/src/homeassistant/homeassistant/helpers/integration_platform.py”, line 33, in _process

platform = integration.get_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 493, in get_platform

cache[full_name] = self._import_platform(platform_name)

File “/usr/src/homeassistant/homeassistant/loader.py”, line 498, in _import_platform

return importlib.import_module(f"{self.pkg_path}.{platform_name}")

File “/usr/local/lib/python3.8/importlib/init.py”, line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File “”, line 1014, in _gcd_import

File “”, line 991, in _find_and_load

File “”, line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named ‘custom_components.surepetcare.media_source’

2021-05-10 21:03:28 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform surepetcarebeta.sensor: Platform not found (cannot import name ‘FeederBowl’ from ‘surepy.entities.devices’ (/usr/local/lib/python3.8/site-packages/surepy/entities/devices.py)).

I think we need to update surpy too but not sure how we do that in HA

1 Like

sorry, forgot that :smiley: :v:

@benleb it’s working :ok_hand:t3::wink:
I have my notifications already automated so I can’t ignore that my cats are hungry.
About the smart lock. If a foreigner passed that door he/she will need to feed the dog or will he/she will be eaten :joy::joy:

just for completenes of your “completely different” code…

your code: home_assistant_petcare/petcare.py at c6812a4cee91460a13ebaf48395f7ddd395ff0e3 · Danielhiversen/home_assistant_petcare · GitHub

my so much older code:

btw., if you copy my code - no problem, feel free! :slight_smile: I also use code from others in many of my projects… but if you don’t mention where the code is from (in the copied code itself in best case) its a little annoying… and probably even against the law in most countries :stuck_out_tongue: :policewoman::point_up: :smiley:

3 Likes

It’s a shame people choose to plagiarise instead of contributing :frowning:

I’d love to help but don’t know how to code I can only offer testing feedback I’m afraid.

For anyone enabling the beta, note that as at b5d324e, the service call is renamed so you’ll need to update your automations and scripts and also the sensor that reports the lock state is missing the underscore and the second word has been capitalised so you’ll need to update those too to get everything working. For me, once I updated all the code, the beta is working a treat.

Service Call:
Was:
surepetcare.set_lock_state
Now:
surepetcarebeta.set_lock_state

Lock State:
Was:

condition:
  - condition: state
    entity_id: sensor.pet_flap_laundry_door
    state: 
      - Locked_all
      - Locked_in
      - Locked_out
action:
  - service: surepetcare.set_lock_state
    data_template:

Current Beta (b5d324e):

condition:
  - condition: state
    entity_id: sensor.pet_flap_laundry_door
    state: 
      - Locked All
      - Locked In
      - Locked Out
action:
  - service: surepetcare.set_lock_state
    data_template:

For those wanting to create an entity card like the one shown below, here is the updated code used to create the sensor.

image

sensor:
  - platform: template
    sensors:
      henry_status:
        friendly_name: "Henry Status"
        unique_id: 1234xxx
        value_template: "{{ state_attr('binary_sensor.pet_henry', 'where') }}"
      henry_last_state:
        friendly_name: "Henrys Last Status"
        unique_id: 5678xxx
        value_template: "{{ state_attr('binary_sensor.pet_henry', 'where') }} since {{as_timestamp(state_attr('binary_sensor.pet_henry', 'since')) | timestamp_custom('%H:%M')}}"  
1 Like

…and if you have a picture of your pet added in the sure petcare app, a card like above looks even better :grinning_face_with_smiling_eyes:

4 Likes