Skip to main content

Async API client for Prana heat recovery ventilator.

Project description

prana-local-api-client

An asynchronous Python client for the local HTTP API of Prana devices.

This library provides a small, well-documented async client to read the device state and control Prana recuperators over a local network using HTTP.

Quick links

  • Installation: see the Installation section
  • Quick start: see Quick example (async)
  • API reference: see API / Methods

Requirements

  • Python 3.10+
  • aiohttp

Firmware compatibility

⚠️ This client works only with Prana recuperators running firmware 47+.

To check firmware: open the Prana Online 2.0 app → press and hold the device card → About Device.

Table of contents

  • Features
  • Installation
  • Quick example (async)
  • API / Methods
  • Data models
  • Exceptions
  • License

Features

  • Fetch device information (get_device_info).
  • Retrieve structured device state (get_state) as PranaState / FanState.
  • Control fan speed, toggles, and brightness (set_speed, set_switch, set_brightness).
  • Fully asynchronous (asyncio + aiohttp).
  • Helpful model parsing (e.g., temperature reported in tenths of °C is normalized).

Installation

Install from PyPI:

pip install prana-local-api-client

From a local checkout (editable, with dev extras):

pip install -e .[dev]

Quick example (async)

import asyncio
from prana_local_api_client.prana_local_api_client import PranaLocalApiClient
from prana_local_api_client.models.prana_fan_type import PranaFanType
from prana_local_api_client.models.prana_switch_type import PranaSwitchType


async def main():
    # Device IP and optional port
    async with PranaLocalApiClient("192.168.1.100", port=80) as client:
        info = await client.get_device_info()
        print("Device:", info.to_dict())

        state = await client.get_state()
        print("State:", state.to_dict())

        # NOTE: the device expects speed values scaled by 10. For example,
        # to set speed '1' pass 10, for speed '3' pass 30.
        await client.set_speed(30, fan_type=PranaFanType.EXTRACT.value)

        # Enable a switch (e.g. BOOST)
        await client.set_switch(PranaSwitchType.BOOST.value, True)

        # Set backlight brightness (0-100)
        await client.set_brightness(50)

asyncio.run(main())

API / Methods

Top-level client: PranaLocalApiClient (module: prana_local_api_client.prana_local_api_client).

  • PranaLocalApiClient(host: str, port: int = 80) — create client instance.
  • async with PranaLocalApiClient(...) as client: — context manager that opens/closes an aiohttp.ClientSession.
  • get_device_info() -> PranaDeviceInfo — returns device info as a PranaDeviceInfo.
  • get_state() -> PranaState — returns the current device state as a PranaState.
  • set_speed(speed: int, fan_type: str) — set fan speed; fan_type is one of: supply, extract, bounded (10, 20, 30 ... 100).
  • set_switch(switch_type: PranaSwitchType, value: bool) — toggle a switch; use PranaSwitchType values.
  • set_brightness(brightness: int) — set panel/backlight brightness (0, 1, 2, 4, 8, 16, 32).
  • set_speed_is_on(speed_is_on: bool, fan_type: str) — enable/disable speed for a fan type.

Data models

Models are defined in prana_local_api_client.models and provide from_dict helpers:

  • PranaDeviceInfo — fields: manufactureId, isValid, fwVersion, pranaModel, label.
  • PranaState — contains extract, supply, bounded (FanState) plus flags and optional sensor fields (inside_temperature, outside_temperature, humidity, co2, etc.).
  • FanStatespeed, is_on, max_speed.

Notes on parsing

  • Temperatures are often reported by the device in tenths of °C; PranaState.from_dict converts these to °C floats.
  • PranaDeviceInfo.from_dict handles numeric strings and byte values for firmware/model fields.

Exceptions

Defined in prana_local_api_client.models.exceptions:

  • PranaApiClientException — base exception class.
  • PranaApiCommunicationError — network/timeout related errors.
  • PranaApiUpdateFailed — HTTP error returned by device (status != 200).
  • UpdateFailed — wrapper for higher-level update failures.
  • ValueError — invalid values encountered.

Wrap client calls in try/except and handle these exceptions depending on your application needs.

Project details


Download files

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

Source Distribution

prana_api_client-0.12.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

prana_api_client-0.12.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file prana_api_client-0.12.0.tar.gz.

File metadata

  • Download URL: prana_api_client-0.12.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for prana_api_client-0.12.0.tar.gz
Algorithm Hash digest
SHA256 c281116341fdb3c3facf7ef96b1ccfcf69395566f4c5126d59c02e5ad2c5b495
MD5 611beadd7bc92fe65e3304518db1cfda
BLAKE2b-256 2e3958aa530dbada3d38aed642d9beccfcfa7d7eb2f00d8e41285e22706cab58

See more details on using hashes here.

File details

Details for the file prana_api_client-0.12.0-py3-none-any.whl.

File metadata

File hashes

Hashes for prana_api_client-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de7e4809fb7f99d476d5bfb77a16aa5ca33b3ba9324804e9da1bdb0f193fb780
MD5 870afc1f95ec66e61c8ed99911c3cb37
BLAKE2b-256 d80a3b855ac81e17246ed6974bef72b584dc79f968889f608c5a05f6b86faa48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page