pypetkitapi 0.5.3__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/PKG-INFO +41 -33
- pypetkitapi-1.0.0/README.md +97 -0
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/client.py +187 -140
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/command.py +19 -97
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/const.py +11 -4
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/containers.py +3 -2
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/feeder_container.py +49 -8
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/litter_container.py +65 -6
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/water_fountain_container.py +42 -5
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pyproject.toml +2 -2
- pypetkitapi-0.5.3/README.md +0 -89
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/LICENSE +0 -0
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/__init__.py +0 -0
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/exceptions.py +0 -0
- {pypetkitapi-0.5.3 → pypetkitapi-1.0.0}/pypetkitapi/py.typed +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pypetkitapi
|
3
|
-
Version: 0.
|
3
|
+
Version: 1.0.0
|
4
4
|
Summary: Python client for PetKit API
|
5
5
|
Home-page: https://github.com/Jezza34000/pypetkit
|
6
6
|
License: MIT
|
@@ -20,19 +20,23 @@ Description-Content-Type: text/markdown
|
|
20
20
|
---
|
21
21
|
|
22
22
|
[][pypi_]
|
23
|
-
[][python version]
|
23
|
+
[][python version] [](https://github.com/Jezza34000/py-petkit-api/actions)
|
24
|
+
|
25
|
+
---
|
26
|
+
|
27
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api) [](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
28
|
+
|
29
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
30
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
31
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
24
32
|
|
25
33
|
[][pre-commit]
|
26
34
|
[][black]
|
27
35
|
[](https://mypy.readthedocs.io/en/stable/)
|
28
36
|
[](https://github.com/astral-sh/ruff)
|
29
|
-
[](https://github.com/Jezza34000/py-petkit-api/actions)
|
30
37
|
|
31
38
|
---
|
32
39
|
|
33
|
-
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
34
|
-
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
35
|
-
|
36
40
|
[pypi_]: https://pypi.org/project/pypetkitapi/
|
37
41
|
[python version]: https://pypi.org/project/pypetkitapi
|
38
42
|
[pre-commit]: https://github.com/pre-commit/pre-commit
|
@@ -59,38 +63,42 @@ pip install pypetkitapi
|
|
59
63
|
## Usage Example:
|
60
64
|
|
61
65
|
```python
|
62
|
-
import
|
63
|
-
import logging
|
66
|
+
import aiohttp
|
64
67
|
from pypetkitapi.client import PetKitClient
|
68
|
+
from pypetkitapi.command import DeviceCommand, FeederCommand, LBCommand, LBAction, LitterCommand
|
65
69
|
|
66
70
|
logging.basicConfig(level=logging.DEBUG)
|
67
71
|
|
68
|
-
|
69
72
|
async def main():
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
73
|
+
async with aiohttp.ClientSession() as session:
|
74
|
+
client = PetKitClient(
|
75
|
+
username="username", # Your PetKit account username or id
|
76
|
+
password="password", # Your PetKit account password
|
77
|
+
region="FR", # Your region or country code (e.g. FR, US, etc.)
|
78
|
+
timezone="Europe/Paris", # Your timezone
|
79
|
+
session=session,
|
80
|
+
)
|
81
|
+
|
82
|
+
await client.get_devices_data()
|
83
|
+
|
84
|
+
# Read the account data
|
85
|
+
print(client.account_data)
|
86
|
+
|
87
|
+
# Read the devices data
|
88
|
+
print(client.petkit_entities)
|
89
|
+
|
90
|
+
# Send command to the devices
|
91
|
+
### Example 1 : Turn on the indicator light
|
92
|
+
### Device_ID, Command, Payload
|
93
|
+
await client.send_api_request(123456789, DeviceCommand.UPDATE_SETTING, {"lightMode": 1})
|
94
|
+
|
95
|
+
### Example 2 : Feed the pet
|
96
|
+
### Device_ID, Command, Payload
|
97
|
+
await client.send_api_request(123456789, FeederCommand.MANUAL_FEED, {"amount": 1})
|
98
|
+
|
99
|
+
### Example 3 : Start the cleaning process
|
100
|
+
### Device_ID, Command, Payload
|
101
|
+
await client.send_api_request(123456789, LitterCommand.CONTROL_DEVICE, {LBAction.START: LBCommand.CLEANING})
|
94
102
|
|
95
103
|
|
96
104
|
if __name__ == "__main__":
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Petkit API Client
|
2
|
+
|
3
|
+
---
|
4
|
+
|
5
|
+
[][pypi_]
|
6
|
+
[][python version] [](https://github.com/Jezza34000/py-petkit-api/actions)
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api) [](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
11
|
+
|
12
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
13
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
14
|
+
[](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
|
15
|
+
|
16
|
+
[][pre-commit]
|
17
|
+
[][black]
|
18
|
+
[](https://mypy.readthedocs.io/en/stable/)
|
19
|
+
[](https://github.com/astral-sh/ruff)
|
20
|
+
|
21
|
+
---
|
22
|
+
|
23
|
+
[pypi_]: https://pypi.org/project/pypetkitapi/
|
24
|
+
[python version]: https://pypi.org/project/pypetkitapi
|
25
|
+
[pre-commit]: https://github.com/pre-commit/pre-commit
|
26
|
+
[black]: https://github.com/psf/black
|
27
|
+
|
28
|
+
## Overview
|
29
|
+
|
30
|
+
PetKit Client is a Python library for interacting with the PetKit API. It allows you to manage your PetKit devices, retrieve account data, and control devices through the API.
|
31
|
+
|
32
|
+
## Features
|
33
|
+
|
34
|
+
Login and session management
|
35
|
+
Fetch account and device data
|
36
|
+
Control PetKit devices (Feeder, Litter Box, Water Fountain)
|
37
|
+
|
38
|
+
## Installation
|
39
|
+
|
40
|
+
Install the library using pip:
|
41
|
+
|
42
|
+
```bash
|
43
|
+
pip install pypetkitapi
|
44
|
+
```
|
45
|
+
|
46
|
+
## Usage Example:
|
47
|
+
|
48
|
+
```python
|
49
|
+
import aiohttp
|
50
|
+
from pypetkitapi.client import PetKitClient
|
51
|
+
from pypetkitapi.command import DeviceCommand, FeederCommand, LBCommand, LBAction, LitterCommand
|
52
|
+
|
53
|
+
logging.basicConfig(level=logging.DEBUG)
|
54
|
+
|
55
|
+
async def main():
|
56
|
+
async with aiohttp.ClientSession() as session:
|
57
|
+
client = PetKitClient(
|
58
|
+
username="username", # Your PetKit account username or id
|
59
|
+
password="password", # Your PetKit account password
|
60
|
+
region="FR", # Your region or country code (e.g. FR, US, etc.)
|
61
|
+
timezone="Europe/Paris", # Your timezone
|
62
|
+
session=session,
|
63
|
+
)
|
64
|
+
|
65
|
+
await client.get_devices_data()
|
66
|
+
|
67
|
+
# Read the account data
|
68
|
+
print(client.account_data)
|
69
|
+
|
70
|
+
# Read the devices data
|
71
|
+
print(client.petkit_entities)
|
72
|
+
|
73
|
+
# Send command to the devices
|
74
|
+
### Example 1 : Turn on the indicator light
|
75
|
+
### Device_ID, Command, Payload
|
76
|
+
await client.send_api_request(123456789, DeviceCommand.UPDATE_SETTING, {"lightMode": 1})
|
77
|
+
|
78
|
+
### Example 2 : Feed the pet
|
79
|
+
### Device_ID, Command, Payload
|
80
|
+
await client.send_api_request(123456789, FeederCommand.MANUAL_FEED, {"amount": 1})
|
81
|
+
|
82
|
+
### Example 3 : Start the cleaning process
|
83
|
+
### Device_ID, Command, Payload
|
84
|
+
await client.send_api_request(123456789, LitterCommand.CONTROL_DEVICE, {LBAction.START: LBCommand.CLEANING})
|
85
|
+
|
86
|
+
|
87
|
+
if __name__ == "__main__":
|
88
|
+
asyncio.run(main())
|
89
|
+
```
|
90
|
+
|
91
|
+
## Contributing
|
92
|
+
|
93
|
+
Contributions are welcome! Please open an issue or submit a pull request.
|
94
|
+
|
95
|
+
## License
|
96
|
+
|
97
|
+
This project is licensed under the MIT License. See the LICENSE file for details.
|