A Python package to interact with the Redgtech API
Project description
Redgtech API
A Python package to interact with the Redgtech API.
Installation
You can install the package using pip:
pip install redgtech-api
Usage
Here is an example of how to use the package:
import asyncio
from redgtech_api import RedgtechAPI
asyncdefmain():
api = RedgtechAPI("your_access_token")
data = await api.get_data()
print(data)
await api.close()
asyncio.run(main())
API Methods
get_data()
Fetches data from the Redgtech API.
Example
data = await api.get_data()
print(data)
set_switch_state(endpoint_id, state)
Sets the state of a switch.
Parameters
endpoint_id(str): The ID of the switch endpoint.state(bool): The desired state of the switch (True for on, False for off).
Example
success = await api.set_switch_state("endpoint_id", True)
print(success)
set_light_brightness(endpoint_id, brightness)
Sets the brightness of a light.
Parameters
endpoint_id(str): The ID of the light endpoint.brightness(int): The desired brightness level (0-255).
Example
success = await api.set_light_brightness("endpoint_id", 128)
print(success)
License
This project is licensed under the MIT License.
Project Structure
Ensure your project structure is correct:
redgtech-api/ ├── redgtech_api/ │ ├── init.py │ ├── api.py ├── tests/ │ ├── init.py │ ├── test_api.py ├── setup.py ├── README.md ├── LICENSE ├── venv/
Package Implementation
from .api import RedgtechAPI
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redgtech_api-0.1.9.tar.gz.
File metadata
- Download URL: redgtech_api-0.1.9.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b4adb906ec7f202b69953fc6eb875e12aad42dcf6497fcb32b1232c1c39d8e4
|
|
| MD5 |
7dedbcf6963279c1881a51ca8e71b79a
|
|
| BLAKE2b-256 |
269ea535e722e170580336e14d25fba05371cde006b7e0989cccdfa0137ce06f
|
File details
Details for the file redgtech_api-0.1.9-py3-none-any.whl.
File metadata
- Download URL: redgtech_api-0.1.9-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
238920fdde1dd0a136737d48ebac9b3473bfb8c900b8c484d833b703b3143503
|
|
| MD5 |
c60fefa7f2c261c64b8fd2dbff1ce5f6
|
|
| BLAKE2b-256 |
56156aa22698c2f8fd05fb3d17d18eb8f47fbd16df698950a3b2223f0ed39355
|