DucoPy
DucoPy is a Python library and CLI tool that allows for full control of a DucoBox ventilation unit equipped with a DucoBox Connectivity Board. Using DucoPy, you can retrieve information, control settings, and monitor logs of your DucoBox system directly from your Python environment or command line.
Features
- Retrieve API information from the DucoBox system
- Get details about available modules, nodes, actions, and logs
- Interact with specific nodes and configure them
- Control actions available on the DucoBox unit
- Output information in a structured or JSON format
Installation
The easiest way to install DucoPy is through pip:
pip install ducopy
Alternatively, you can clone the repository and install manually:
git clone https://github.com/sikerdebaard/ducopy.git
cd ducopy
pip install .
Additional Requirements
This project uses Typer for the CLI, Loguru for logging, Rich for pretty-printing, and Pydantic for data validation. These will be installed automatically with the above command.
Using the DucoPy Facade in Python
The DucoPy Python class provides a simple interface for interacting with the DucoBox API. Below is an example of how to use it:
Example
from ducopy.ducopy import DucoPy
from pydantic import HttpUrl
# Initialize the DucoPy client with the base URL of your DucoBox
base_url = "https://your-ducobox-ip" # Replace with the actual IP
ducopy = DucoPy(base_url=base_url)
# Retrieve API information
api_info = ducopy.get_api_info()
print(api_info)
# Get nodes
nodes = ducopy.get_nodes()
print(nodes.model_dump(mode='json'))
# Retrieve information for a specific node
node_id = 1
node_info = ducopy.get_node_info(node_id=node_id)
print(node_info.model_dump(mode='json'))
# Close the DucoPy client connection when done
ducopy.close()
Available Methods
Here is a list of the main methods available in the DucoPy facade:
get_api_info() -> dict: Retrieve general API information.get_info(module: str | None = None, submodule: str | None = None, parameter: str | None = None) -> dict: Retrieve information about modules and parameters.get_nodes() -> NodesResponse: Retrieve a list of all nodes in the DucoBox system.get_node_info(node_id: int) -> NodeInfo: Get details about a specific node by its ID.get_config_node(node_id: int) -> ConfigNodeResponse: Get configuration settings for a specific node.get_action(action: str | None = None) -> dict: Retrieve information about a specific action.get_actions_node(node_id: int, action: str | None = None) -> ActionsResponse: Retrieve available actions for a specific node.get_logs() -> dict: Retrieve the system logs from the DucoBox.
All methods return a dictionary or a Pydantic model instance. Use .model_dump(mode='json') on Pydantic models to get JSON-serializable output if needed.
Using the CLI Client
DucoPy also provides a command-line interface (CLI) for interacting with your DucoBox system.
CLI Commands
After installing DucoPy, you can access the CLI using the ducopy command:
ducopy --help
This will display a list of available commands.
Example Commands
-
Retrieve API information
ducopy get-api-info --base-url https://your-ducobox-ip
-
Get details about nodes
ducopy get-nodes --base-url https://your-ducobox-ip
-
Get information for a specific node
ducopy get-node-info --base-url https://your-ducobox-ip --node-id 1
-
Get actions available for a node
ducopy get-actions-node --base-url https://your-ducobox-ip --node-id 1
-
Retrieve system logs
ducopy get-logs --base-url https://your-ducobox-ip
Output Formatting
All commands support an optional --output-format argument to specify the output format (pretty or json):
ducopy get-nodes --base-url https://your-ducobox-ip --output-format json
pretty(default): Formats the output in a structured, readable style.json: Outputs raw JSON data, which can be useful for further processing or debugging.
Logging Level
To set the logging level, use the --logging-level option, which accepts values like DEBUG, INFO, WARNING, ERROR, or CRITICAL.
ducopy --logging-level DEBUG get-nodes --base-url https://your-ducobox-ip
Contributing
We welcome contributions! Please open issues or submit pull requests on GitHub to improve DucoPy.
License
DucoPy is licensed under the MIT License. See LICENSE for more information.
With DucoPy, you have a powerful tool at your fingertips to manage and control your DucoBox ventilation unit. Whether you're using the Python API or the CLI, DucoPy provides flexible, straightforward access to your system.
Metadata
Release files for ducopy 12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ducopy-12.tar.gz | 21.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ducopy-12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.6 kB
Release files / ducopy-12.tar.gz
| Download URL | ducopy-12.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1439c52f7a8b71e7c2246ea98f06a7a72bd8b54a8980632006aada9ac6692fde
|
|
BLAKE2b-256 checksum How to use checksums |
aca3ff7f5f8ae87eac571f16dfaecf534153bdb6a7e4c40469ae431d1f41e88b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / ducopy-12-py3-none-any.whl
| Download URL | ducopy-12-py3-none-any.whl |
|---|---|
| Size | 18.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec33aa8a90e7d3d30a9861d5e6268e1a824f95d042ba7582fe1471c1665c22d7
|
|
BLAKE2b-256 checksum How to use checksums |
b3e597e83e5ee1fdff0de531af0eb05efc775656691aa56dd2b57d24bb98f645
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for ducopy 12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.