Python library for controlling Vitrea Smart Home Controllers via TCP
Project description
vitrea-host
Python library for controlling Vitrea Smart Home Controllers via TCP.
This library provides an Async Python interface to communicate with Vitrea VBox controllers over TCP/IP, enabling control of lights, blinds, thermostats, fans, scenarios, and other smart home devices.
Features
- Asynchronous API: Built on
asynciofor efficient concurrent operations - Device Control: Control lights (dimmers), blinds, thermostats, fans, and more
- Database Reading: Read and parse the Vitrea controller's device database
- Status Updates: Real-time status updates via callbacks
- Connection Management: Automatic reconnection and health monitoring
- Multiple API Versions: Supports Vitrea Parameter API v1, v2, and v3
Installation
From PyPI
pip install vitrea-host
From Source
git clone https://github.com/vitrea-sh/py-vitrea-host.git
cd py-vitrea-host
pip install -e .
Requirements
- Python 3.8 or higher
- Network access to the Vitrea controller
Quick Start
import asyncio
from vitrea_host import VBoxController
async def main():
# Create a controller instance
controller = VBoxController(
ip="192.168.1.100",
port=5000,
status_update_callback=handle_status_update
)
# Connect and load database
await controller.connect()
# Access devices through the database
for floor in controller.database.floors:
for room in floor.rooms:
for key in room.keys:
print(f"Device: {key.name} in {room.name}")
# Close connection
await controller.close()
async def handle_status_update(update):
print(f"Status update: {update}")
asyncio.run(main())
Usage
Basic Connection
from vitrea_host import VBoxController, validate_controller_availability
# Validate controller is available
result = await validate_controller_availability("192.168.1.100", 5000)
if result["supported"]:
print(f"Controller version: {result['version']}")
# Create and connect
controller = VBoxController(ip="192.168.1.100", port=5000)
await controller.connect()
Status Updates
async def status_callback(update):
if update.get("type") == "node_status":
node_id = update.get("node_id")
key_id = update.get("key")
status = update.get("status")
print(f"Node {node_id}, Key {key_id}: {status}")
controller = VBoxController(
ip="192.168.1.100",
port=5000,
status_update_callback=status_callback
)
Home Assistant Integration
This library is used by the Home Assistant Vitrea Integration.
To use this library in your Home Assistant integration:
# In your Home Assistant integration
from vitrea_host import VBoxController
# The integration will handle the connection and device management
API Reference
Main Classes
VBoxController: Main controller class for managing connections and devicesVBoxConnection: Low-level TCP connection managementVitreaDatabaseModel: Database model containing floors, rooms, keys, and devices
Functions
authenticate_vitrea_device(host, port): Authenticate to a Vitrea controllervalidate_controller_availability(ip, port): Check if controller is available and supported
Development
Setup Development Environment
git clone https://github.com/vitrea-sh/py-vitrea-host.git
cd py-vitrea-host
pip install -e ".[dev]"
Running Tests
pytest
License
Apache-2.0 License. See LICENSE file for details.
Support
- Issues: GitHub Issues
- Home Assistant Integration: hass-vitrea
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
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 vitrea_host-0.2.0.tar.gz.
File metadata
- Download URL: vitrea_host-0.2.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23fc17a8bad0202f8f172684f645dbe54019e33002372300c1a6f11e6de3479f
|
|
| MD5 |
6cd34b8b723e8a46ee2e68afce96add3
|
|
| BLAKE2b-256 |
076229981d336958e53873e3e0da01d5a69ad239587e4f6ce97e6c545953f46d
|
File details
Details for the file vitrea_host-0.2.0-py3-none-any.whl.
File metadata
- Download URL: vitrea_host-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed24d843c400e29bdeb1403c92ec838acfdd67f3776bc21ac8c509fb2ddfb372
|
|
| MD5 |
b4131358bc880169dd298b9bf5bdbb32
|
|
| BLAKE2b-256 |
9cc8821a79ef9825c541c863e8a368f73ffb80b683a6e022fc86f1c675ee7c77
|