Python package to interact with the Watergate Local API.
Project description
Watergate Local API Client
A robust Python client for interacting with the Sonic Device Local API. This client provides easy access to manage device settings, monitor telemetry data, and handle event webhooks from the device.
Overview
The Watergate Local API Client simplifies interaction with the Sonic Device's local API, enabling developers to:
- Retrieve and update device state
- Access telemetry and networking data
- Configure auto shut-off settings and view reports
- Manage webhook configuration and receive real-time device events
Features
- Device State Management: Access comprehensive device state details, including valve state, power supply, firmware version, and uptime.
- Telemetry Access: Retrieve telemetry data such as flow rate, pressure, and temperature.
- Networking and Power Management: Configure networking settings and monitor power supply status.
- Event Webhook Support: Handle and parse webhook events including auto-shut-off, telemetry, valve state changes, power supply changes, and WiFi updates.
Installation
To install the Watergate Local API Client, clone the repository and install the package using pip:
git clone https://github.com/watergate-ai/watergate-local-api-python.git
cd watergate-local-api-python
pip install .
Usage
Basic Usage Example
This example demonstrates how to retrieve the device state and access telemetry data using the client.
from watergate_local_api import WatergateLocalApiClient
async def main():
async with WatergateLocalApiClient(base_url="http://testserver") as client:
# Get device state
device_state = await client.async_get_device_state()
print("Valve State:", device_state.valve_state)
# Access telemetry data
telemetry_data = await client.async_get_telemetry_data()
print("Flow Rate:", telemetry_data.flow)
Webhook Event Parsing
You can parse incoming webhook events to handle device notifications, such as telemetry updates or auto-shut-off reports.
from watergate_local_api.models import WebhookEvent
webhook_payload = {
"type": "telemetry",
"data": {
"flow": 6800,
"pressure": 2320,
"temperature": 23.5,
"event": {"volume": 16000, "duration": 90},
"errors": ["flow"]
}
}
# Parse webhook event
event = WebhookEvent.parse_webhook_event(webhook_payload)
print("Parsed Event:", event)
Development
To contribute to this project, follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature). - Make your changes and add tests where appropriate.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature/YourFeature). - Open a Pull Request.
We welcome all contributions that can improve the project! If you have any ideas or suggestions, feel free to open an issue or submit a pull request.
Running Tests
To run tests, use pytest:
pip install -r requirements-dev.txt
pytest
Make sure to add tests for any new features or functionality you contribute.
Contributing
We welcome contributions from the community to help improve the Watergate Local API Client. If you’re interested in contributing, please feel free to reach out by opening an issue or submitting a pull request.
Reporting Issues
If you find a bug or have a feature request, please create an issue using the template provided in the Issues section. This helps us track and address your feedback effectively.
License
This project is licensed under a GPL 3.0 - see the LICENSE file for details.
Acknowledgments
Special thanks to all contributors and the community for supporting and improving this project!
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 watergate_local_api-2025.1.0.tar.gz.
File metadata
- Download URL: watergate_local_api-2025.1.0.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
269fa29f1e5f53788052a71b6cc1f0ada4fdd5cb045118aca13b5e8a2fdb7a10
|
|
| MD5 |
33978672e0afdaf265c9c4345d76e84b
|
|
| BLAKE2b-256 |
7a3c7da0916b6ef2c9dd03ab6169d86dcab339f214240e5ed0137dd80ab82eaf
|
File details
Details for the file watergate_local_api-2025.1.0-py3-none-any.whl.
File metadata
- Download URL: watergate_local_api-2025.1.0-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0557066c935aa04570b13acc1ebe3cfd1d3e8f7a91ea8d88ad96de57d19dd99a
|
|
| MD5 |
ba3495931d99b9a65dab214458018d78
|
|
| BLAKE2b-256 |
3ec8d8a09a93f9c0bc010c7e6e13c877be3ff3cd7f0fa7801ef2aefd4cfc34c5
|