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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pypetkitapi
3
- Version: 0.5.3
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](https://img.shields.io/pypi/v/pypetkitapi.svg)][pypi_]
23
- [![Python Version](https://img.shields.io/pypi/pyversions/pypetkitapi)][python version]
23
+ [![Python Version](https://img.shields.io/pypi/pyversions/pypetkitapi)][python version] [![Actions status](https://github.com/Jezza34000/py-petkit-api/workflows/CI/badge.svg)](https://github.com/Jezza34000/py-petkit-api/actions)
24
+
25
+ ---
26
+
27
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
28
+
29
+ [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
30
+ [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
31
+ [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
24
32
 
25
33
  [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]
26
34
  [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
27
35
  [![mypy](https://img.shields.io/badge/mypy-checked-blue)](https://mypy.readthedocs.io/en/stable/)
28
36
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
29
- [![Actions status](https://github.com/Jezza34000/py-petkit-api/workflows/CI/badge.svg)](https://github.com/Jezza34000/py-petkit-api/actions)
30
37
 
31
38
  ---
32
39
 
33
- [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
34
- [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=coverage)](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 asyncio
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
- client = PetKitClient(
71
- username="username", # Your PetKit account username or id
72
- password="password", # Your PetKit account password
73
- region="France", # Your region or country code (e.g. FR, US, etc.)
74
- timezone="Europe/Paris", # Your timezone
75
- )
76
-
77
- # To get the account and devices data attached to the account
78
- await client.get_devices_data()
79
-
80
- # Read the account data
81
- print(client.account_data)
82
-
83
- # Read the devices data
84
- print(client.device_list)
85
-
86
- # Send command to the devices
87
- ### Example 1 : Turn on the indicator light
88
- ### Device_ID, Command, Payload
89
- await client.send_api_request(012346789, DeviceCommand.UPDATE_SETTING, {"lightMode": 1})
90
-
91
- ### Example 2 : Feed the pet
92
- ### Device_ID, Command, Payload
93
- await client.send_api_request(0123467, FeederCommand.MANUAL_FEED, {"amount": 1})
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](https://img.shields.io/pypi/v/pypetkitapi.svg)][pypi_]
6
+ [![Python Version](https://img.shields.io/pypi/pyversions/pypetkitapi)][python version] [![Actions status](https://github.com/Jezza34000/py-petkit-api/workflows/CI/badge.svg)](https://github.com/Jezza34000/py-petkit-api/actions)
7
+
8
+ ---
9
+
10
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
11
+
12
+ [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
13
+ [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
14
+ [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Jezza34000_py-petkit-api&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=Jezza34000_py-petkit-api)
15
+
16
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)][pre-commit]
17
+ [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
18
+ [![mypy](https://img.shields.io/badge/mypy-checked-blue)](https://mypy.readthedocs.io/en/stable/)
19
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](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.