Library to interact with the flaps & doors from Sure Petcare.
Project description
Library & CLI to interact with the Sure Petcare API. surepy lets you monitor and control the Pet Door/Cat Flap Connect 🚪 and the Pet Feeder Connect 🍽 by Sure Petcare.
surepy features:
🔑 get an api token with your account credentials
🚪 lock/unlock a door or flap
🐾 get the location of pets & devices
🐈 get the state and more attributes of pets & devices
🕰️ get historic data & events of pets & devices
📬 get a list of (past) notifications
Getting Started
surepy is available via pypi.org
python3 -m pip install --upgrade surepy
# or
pip install --upgrade surepy
there is also a small cli available
$ surepy --help
Usage: surepy [OPTIONS] COMMAND [ARGS]...
surepy cli 🐾
https://github.com/benleb/surepy
Options:
--version show surepy version
-j, --json enable json api response output
-t, --token TEXT api token
--help Show this message and exit.
Commands:
devices get devices
locking lock control
notification get notifications
pets get pets
position set pet position
report get pet/household report
token get a token
the cli is mainly intended for developing & debugging purposes and probably has bugs - be careful 🐾
Library example
import asyncio
from os import environ
from pprint import pprint
from typing import Dict, List
from surepy import Surepy
from surepy.entities import SurepyEntity
from surepy.entities.devices import SurepyDevice
from surepy.entities.pet import Pet
async def main():
# # user/password authentication (gets a token in background)
# surepy = Surepy(email=user, password=password)
# token authentication (token supplied via SUREPY_TOKEN env var)
token = environ.get("SUREPY_TOKEN")
surepy = Surepy(auth_token=token)
# list with all pets
pets: List[Pet] = await surepy.get_pets()
for pet in pets:
print(f"\n\n{pet.name}: {pet.state} | {pet.location}\n")
pprint(pet.raw_data())
print(f"\n\n - - - - - - - - - - - - - - - - - - - -\n\n")
# all entities as id-indexed dict
entities: Dict[int, SurepyEntity] = await surepy.get_entities()
# list with alldevices
devices: List[SurepyDevice] = await surepy.get_devices()
for device in devices:
print(f"{device.name = } | {device.serial = } | {device.battery_level = }")
print(f"{device.type = } | {device.unique_id = } | {device.id = }")
print(f"{entities[device.parent_id].full_name = } | {entities[device.parent_id] = }\n")
asyncio.run(main())
Naming confusion for surepetcarebeta users 🐾 🤪 🤦
Sorry for the bad naming and resulting confusion and chaos 🙄 To "fix" this, I renamed surepetcarebeta to sureha.
Name | Repo | Type | Description | Need Help? |
---|---|---|---|---|
surepy 🐾 | 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 |
surepetcare | github.com/home-assistant/core | Home Assistant Integration | Official Home Assistant Integration for the Sure Petcare Devices like Doors, Flaps, Feeders, ... | Issues, HA Forum |
sureha |
github.com/benleb/sureha | Home Assistant Integration | Home Assistant Integration developed in my own repo without reviews from the HA Team. This can be installed via HACS 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 |
pethublocal | github.com/plambrechtsen/pethublocal | Home Assistant Integration | Home Assistant Integration developed by @plambrechtsen which works completely independent from Sure Petcare. Check outs his repo for more information! | Issues, HA Forum |
Used by
- Sure Petcare integration in Home Assistant
Feel free to add you project!
Acknowledgments
- Thanks to all the people who provided information about devices I do not own myself, thanks!
- Thanks to @rcastberg for hist previous work on the Sure Petcare API (github.com/rcastberg/sure_petcare)
- Thanks to @wei for the header image generator (github.com/wei/socialify)
Meta
Ben Lebherz: cat lover 🐾 developer & maintainer - @benleb | @ben_leb
This project is licensed under the MIT License - see the LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file surepy-0.9.0.tar.gz
.
File metadata
- Download URL: surepy-0.9.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d357c4d58b4436364c207d2ff23d01a3ccce2d58940120cdd7e2f11b5e8619f |
|
MD5 | 001a7131b19202482731ae306d8f95ab |
|
BLAKE2b-256 | 8e4abcd329399d7288fe2fd12dfc0c1905afcc64d80ed99419fca04f5fe0c723 |
File details
Details for the file surepy-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: surepy-0.9.0-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/23.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19fb93a9a125d926bbf22c3800f4bcd44286b5b8bca0158791ad9c9b389619ef |
|
MD5 | 9a4677a9b3bc3d970bbf012d6838dea9 |
|
BLAKE2b-256 | 6163e6c8366304480534a2bbb6495058ddec1261d7f0373c3cd772bf7efb3f9f |