Skip to main content

FLOW-IT-API

A Python API library client for FlowIt VMC (Ventilazione Meccanica Controllata) machines.

This library provides a simple, asynchronous interface to interact with FlowIt VMC devices over a local network, supporting both REST API for commands/status and WebSockets for real-time updates.

Context

FlowIt VMC devices use two fans to control airflow (Inflow and Outflow) and are equipped with multiple sensors (Temperature, Humidity, Pressure, IAQ). While these devices connect to FlowIt cloud services, they also expose a local LAN API for direct control.

Installation

Prerequisites

  • Python 3.11 or higher

Setup Virtual Environment

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e .

For development:

pip install -e .[dev]
# Install pre-commit hooks
pre-commit install

Usage

The library uses httpx for asynchronous HTTP requests and websockets for real-time updates.

Basic Example

import asyncio
import logging
from flow_it_api.client import FlowItVMCMachine
from flow_it_api.const import Speed

# Setup logging to see the library version and actions
logging.basicConfig(level=logging.INFO)

async def main():
    host = "http://192.168.1.50"
    # You can retrieve your API password from the device's menu using the on-board display
    password = "your_api_password"

    async with FlowItVMCMachine(host, password) as vmc:
        # Get device info (Model, FW version, etc.)
        info = await vmc.get_info()
        print(f"Device: {info.model}, FW: {info.fw_ver}")

        # Fetch initial state
        state = await vmc.refresh_state()
        print(f"Current Speed: {state.mode.speed}")
        print(f"Temperature: {state.mode.temperatureIn_celsius}°C")

        # Send a command
        await vmc.send_command(Speed.LEVEL_3, flow_in=True, flow_out=True)

if __name__ == "__main__":
    asyncio.run(main())

Real-time Updates (WebSocket)

The library can listen for real-time updates pushed by the device:

async def on_data(data):
    print(f"Update received! New IAQ: {data.mode.iaq}")

# Initialize machine and websocket
async with FlowItVMCMachine(host, password) as vmc:
    vmc.websocket._on_data = on_data
    vmc.websocket.start()
    # Keep the loop running to receive events
    await asyncio.sleep(60)

Library Architecture

Key Components

  • FlowItVMCMachine: The primary entry point. Manages authentication, connection state, and coordination between REST and WebSocket clients.
  • Authenticator: Handles JWT token acquisition and automatic renewal.
  • FlowItWebSocket: Manages the persistent WebSocket connection and reconnection logic.
  • Models: Pydantic models providing type-safe access to machine data, including automatic Kelvin-to-Celsius conversions.

Features

  • Asynchronous: Built on asyncio.
  • Automatic Auth: Handles login and token refreshing transparently via decorators.
  • Type Safety: Full Pydantic v2 model support.
  • Temperature Conversion: Access temperatures in both Kelvin (raw) and Celsius (processed).
  • Comprehensive Logging: Detailed internal logging for debugging, including version tracking at load time.
  • Dynamic Versioning: Versioning is automatically managed via Git tags (VCS).

Development

The project structure:

  • src/flow_it_api/: Library source code (src layout).
  • tests/: Unit tests (using pytest).
  • specs/: OpenAPI/YAML specifications for the device API.
  • example.py: A comprehensive CLI test client.

Quality Control

This project uses several tools to ensure code quality:

  • Linting & Formatting: black, isort, and mypy for type checking.
  • Git Hooks: pre-commit is used to run all checks locally before every commit.
  • CI/CD: GitHub Actions runs the full test suite across multiple Python versions and handles automated releases to PyPI.

To run tests locally:

pytest --cov=src --cov-report=term-missing

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flow_it_api-0.0.1.1.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flow_it_api-0.0.1.1-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file flow_it_api-0.0.1.1.tar.gz.

File metadata

  • Download URL: flow_it_api-0.0.1.1.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for flow_it_api-0.0.1.1.tar.gz
Algorithm Hash digest
SHA256 4bbb58e032d72305d2f8e8b4afbd722b4570cf2751245234d866d6aa343dcacc
MD5 982c24290bb4b8fb1b758bfa5b539505
BLAKE2b-256 ab0b7af2b7b981bac6c81d6f2f5e499f6e860d413558be47e327cf83e534735e

See more details on using hashes here.

Provenance

The following attestation bundles were made for flow_it_api-0.0.1.1.tar.gz:

Publisher: publish.yml on albertogeniola/flow-it-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flow_it_api-0.0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flow_it_api-0.0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for flow_it_api-0.0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 130d00c80a8f481cd8bb4442eb5d1facdd200b1f67e7a3f00a573b55b8c8ddfc
MD5 45b5ada7fb9908dbeb8bb09cdfa32b78
BLAKE2b-256 2c4e8da852519c48b88e170807767ab55e8efed94ff0d9627f68e38cdee77354

See more details on using hashes here.

Provenance

The following attestation bundles were made for flow_it_api-0.0.1.1-py3-none-any.whl:

Publisher: publish.yml on albertogeniola/flow-it-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.1.1 This release

2 files

0.0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page