{"id":15286912,"url":"https://github.com/benleb/surepy","last_synced_at":"2025-05-15T01:06:08.398Z","repository":{"id":36939263,"uuid":"176013546","full_name":"benleb/surepy","owner":"benleb","description":"🐾 Library \u0026 CLI to monitor and control the Pet Door \u0026 Cat Flap Connect 🚪 the Pet Feeder Connect 🍽 and the Felaqua 💦 sold by Sure Petcare","archived":false,"fork":false,"pushed_at":"2025-02-19T18:26:45.000Z","size":379,"stargazers_count":80,"open_issues_count":38,"forks_count":43,"subscribers_count":13,"default_branch":"dev","last_synced_at":"2025-04-13T22:39:36.572Z","etag":null,"topics":["appdaemon","cat","cat-lover-developer","catflap","cats","cli","flap","flaps","hacktoberfest","home-assistant","monitor","pet-door","pypi","python3","sureflap","surepet","surepetcare"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/surepy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benleb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"benleb"}},"created_at":"2019-03-16T19:07:09.000Z","updated_at":"2025-02-23T12:05:40.000Z","dependencies_parsed_at":"2024-12-20T07:02:54.081Z","dependency_job_id":"345f0e58-a0b8-4d27-b3ab-ef922a219845","html_url":"https://github.com/benleb/surepy","commit_stats":{"total_commits":176,"total_committers":14,"mean_commits":"12.571428571428571","dds":"0.17613636363636365","last_synced_commit":"ff1e396216295be6c172cdfd26d7dbac105dc3b8"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fsurepy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fsurepy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fsurepy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benleb%2Fsurepy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benleb","download_url":"https://codeload.github.com/benleb/surepy/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254254040,"owners_count":22039792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appdaemon","cat","cat-lover-developer","catflap","cats","cli","flap","flaps","hacktoberfest","home-assistant","monitor","pet-door","pypi","python3","sureflap","surepet","surepetcare"],"created_at":"2024-09-30T15:19:04.521Z","updated_at":"2025-05-15T01:06:08.375Z","avatar_url":"https://github.com/benleb.png","language":"Python","funding_links":["https://github.com/sponsors/benleb"],"categories":[],"sub_categories":[],"readme":"# [![surepy](https://socialify.git.ci/benleb/surepy/image?description=1\u0026descriptionEditable=Library%20%26%20CLI%20to%20interact%20with%20the%20Sure%20Petcare%20API%20to%20monitor%20and%20control%20the%20Sure%20Petcare%20Pet%20Door%2FCat%20Flap%20Connect%20%F0%9F%9A%AA%20and%20the%20Pet%20Feeder%20Connect%20%F0%9F%8D%BD\u0026font=KoHo\u0026forks=1\u0026language=1\u0026logo=https%3A%2F%2Femojipedia-us.s3.dualstack.us-west-1.amazonaws.com%2Fthumbs%2F240%2Fapple%2F237%2Fpaw-prints_1f43e.png\u0026pulls=1\u0026stargazers=1)](https://github.com/benleb/surepy)\n\nLibrary \u0026 CLI to interact with the Sure Petcare API. [**surepy**](https://github.com/benleb/surepy) lets you monitor and control the Pet Door/Cat Flap Connect 🚪 and the Pet Feeder Connect 🍽 by [Sure Petcare](https://www.surepetcare.com).\n\n---\n\n[**surepy**](https://github.com/benleb/surepy) features:\n\n🔑 **get an api token** with your account credentials  \n🚪 **lock/unlock** a door or flap  \n🐾 get the **location** of **pets** \u0026 **devices**  \n🐈 get the **state** and more attributes of **pets** \u0026 **devices**  \n🕰️ get **historic** data \u0026 events of pets \u0026 devices  \n📬 get a list of (past) **notifications**  \n\n\u003c!-- \u003e **ToC ·** [Getting Started](#getting-started) · [Usage](#usage)· [Used by](#used-by) · [Acknowledgements](#acknowledgements) **·** [Meta](#meta) --\u003e\n\n## Getting Started\n\n[**surepy**](https://github.com/benleb/surepy) is available via [pypi.org](https://pypi.org)\n\n```bash\npython3 -m pip install --upgrade surepy\n# or\npip install --upgrade surepy\n```\n\nthere is also a small cli available\n\n```bash\n$ surepy --help\nUsage: surepy [OPTIONS] COMMAND [ARGS]...\n\n  surepy cli 🐾\n\n  https://github.com/benleb/surepy\n\nOptions:\n  --version         show surepy version\n  -j, --json        enable json api response output\n  -t, --token TEXT  api token\n  --help            Show this message and exit.\n\nCommands:\n  devices       get devices\n  locking       lock control\n  notification  get notifications\n  pets          get pets\n  position      set pet position\n  report        get pet/household report\n  token         get a token\n```\n\n\u003e*the cli **is mainly intended for developing \u0026 debugging purposes** and probably has bugs - be careful* 🐾\n\n## Library example\n\n```python\nimport asyncio\n\nfrom os import environ\nfrom pprint import pprint\nfrom typing import Dict, List\n\nfrom surepy import Surepy\nfrom surepy.entities import SurepyEntity\nfrom surepy.entities.devices import SurepyDevice\nfrom surepy.entities.pet import Pet\n\n\nasync def main():\n\n    # # user/password authentication (gets a token in background)\n    # surepy = Surepy(email=user, password=password)\n\n    # token authentication (token supplied via SUREPY_TOKEN env var)\n    token = environ.get(\"SUREPY_TOKEN\")\n    surepy = Surepy(auth_token=token)\n\n    # list with all pets\n    pets: List[Pet] = await surepy.get_pets()\n    for pet in pets:\n        print(f\"\\n\\n{pet.name}: {pet.state} | {pet.location}\\n\")\n        pprint(pet.raw_data())\n\n    print(f\"\\n\\n - - - - - - - - - - - - - - - - - - - -\\n\\n\")\n\n    # all entities as id-indexed dict\n    entities: Dict[int, SurepyEntity] = await surepy.get_entities()\n\n    # list with alldevices\n    devices: List[SurepyDevice] = await surepy.get_devices()\n    for device in devices:\n        print(f\"{device.name = } | {device.serial = } | {device.battery_level = }\")\n        print(f\"{device.type = } | {device.unique_id = } | {device.id = }\")\n        print(f\"{entities[device.parent_id].full_name = } | {entities[device.parent_id] = }\\n\")\n\n\nasyncio.run(main())\n```\n\n---\n\n\n## Naming confusion for *surepetcarebeta* users 🐾 🤪 🤦\n\nSorry for the bad naming and resulting confusion and chaos 🙄 To \"fix\" this, I **renamed *surepetcarebeta* to *sureha***.\n\n| Name | Repo | Type | Description | Need Help?\n|---|---|---|---|---|\n| **[surepy](https://github.com/benleb/surepy) 🐾** | [github.com/benleb/surepy](https://github.com/benleb/surepy) | Python Library | Library to interact with the API of Sure Petcare. Also provides Classes for the various Sure Petcare Devicess. Use this if you write an own python tool/app and want to interact with the Sure Petcare API | [Issues](https://github.com/benleb/surepy/issues) |\n| **[surepetcare](https://www.home-assistant.io/integrations/surepetcare)** ![HA Favicon](https://www.home-assistant.io/images/favicon.ico) | [github.com/home-assistant/core](https://github.com/home-assistant/core) | [Home Assistant](https://github.com/home-assistant/core) Integration | **Official Home Assistant Integration** for the Sure Petcare Devices like Doors, Flaps, Feeders, ...  | [Issues](https://github.com/home-assistant/core/issues), [HA Forum](https://community.home-assistant.io) |\n| | | | | |\n| **[sureha](https://github.com/benleb/sureha)** ~~surepetcarebeta~~ ~~[benleb/surepetcare](https://github.com/benleb/sureha)~~ | [github.com/benleb/sureha](https://github.com/benleb/sureha) | [Home Assistant](https://github.com/home-assistant/core) Integration | Home Assistant Integration developed in my own repo without reviews from the HA Team. This can be installed via [HACS](https://hacs.xyz/) and is something like a preview integration **for advanced users**. Usually this provides more (experimental) features and faster fixes but lacks the code quality (reviews) and such from HA | [Issues](https://github.com/benleb/sureha/issues) |\n| | | | | |\n| **[pethublocal](https://github.com/plambrechtsen/pethublocal)** | [github.com/plambrechtsen/pethublocal](https://github.com/plambrechtsen/pethublocal) | [Home Assistant](https://github.com/home-assistant/core) Integration | Home Assistant Integration developed by [@plambrechtsen](https://github.com/plambrechtsen) which works **completely independent from Sure Petcare**. Check outs his repo for more information! | [Issues](https://github.com/plambrechtsen/pethublocal/issues), [HA Forum](https://community.home-assistant.io) |\n\n\n---\n\n## Used by\n\n* [Sure Petcare](https://www.home-assistant.io/integrations/surepetcare/) integration in [Home Assistant](https://www.home-assistant.io/)\n\nFeel free to add you project!\n\n## Acknowledgments\n\n* Thanks to all the people who provided information about devices I do not own myself, thanks!\n* Thanks to [@rcastberg](https://github.com/rcastberg) for hist previous work on the [Sure Petcare](https://www.surepetcare.com) API ([github.com/rcastberg/sure_petcare](https://github.com/rcastberg/sure_petcare))\n* Thanks to [@wei](https://github.com/wei) for the  header image generator ([github.com/wei/socialify](https://github.com/wei/socialify))\n\n## Meta\n\n**Ben Lebherz**: *cat lover 🐾 developer \u0026 maintainer* - [@benleb](https://github.com/benleb) | [@ben_leb](https://twitter.com/ben_leb)\n\n\u003c!-- See also the list of [contributors](CONTRIBUTORS) who participated in this project. --\u003e\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenleb%2Fsurepy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenleb%2Fsurepy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenleb%2Fsurepy/lists"}