Skip to main content

Python library for controlling specific Saleryd HRV system models - Erik, Tage, Emil and Carl

Project description

pysaleryd-tage

Python asyncio library for controlling Saleryd HRV units (Erik, Tage, Emil, Carl) over their local WebSocket API.

Installation

pip install pysaleryd-tage

Usage

Connect and read state

import asyncio
from pysaleryd_tage.client import connected_device

async def main():
    async with connected_device("192.168.1.100") as (device, disconnected):
        print(device.info)   # DeviceInfo: model, MAC, firmware versions
        print(device.state)  # DeviceState: mode, temps, pressure, alarms, ...

        # subscribe to state changes
        device.subscribe(lambda state: print(state.mode, state.temp_in, state.pressure))

        # wait until disconnected or timeout
        await asyncio.wait_for(disconnected.wait(), timeout=60)

asyncio.run(main())

connected_device(host, port=3001) is an async context manager. It waits (up to 5 s) for the device to send its initial state before yielding. disconnected is an asyncio.Event set when the WebSocket closes.

Send commands

from pysaleryd_tage.device.command import (
    ActiveModeCommand,
    ComposedCommand,
    PacModeSettingsCommand,
    PercentModeSettingsCommand,
    PowerCommand,
    PressureModeSettingsCommand,
)

async with connected_device("192.168.1.100") as (device, _):
    # power on/off
    await device.send_command(PowerCommand.on())

    # ComposedCommand bundles multiple commands into one send.
    # Use += to build it incrementally:
    cmd = ComposedCommand()
    cmd += ActiveModeCommand.percent() # change the current mode
    cmd += PercentModeSettingsCommand(normal=60, away=30, airing=80) # setup 
    await device.send_command(cmd)

    # or construct inline
    await device.send_command(
        ComposedCommand([
            ActiveModeCommand.pressure(),
            PressureModeSettingsCommand(pressure=50),
        ])
    )

    # PAC (temperature-driven pressure) mode
    await device.send_command(
        ComposedCommand([
            ActiveModeCommand.pac(),
            PacModeSettingsCommand(cold_temp=0.0, cold_pressure=20,
                                   hot_temp=20.0, hot_pressure=60),
        ])
    )

Disclaimer

This project is not affiliated with, endorsed by, or associated with the manufacturer in any way. Use at your own risk.

License

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

pysaleryd_tage-0.0.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file pysaleryd_tage-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pysaleryd_tage-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pysaleryd_tage-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb67e846f5afeefae590b1f2f451b86385372330aa17787b2a1cbd0417d5bc16
MD5 82582f69815acf49deaae2ce08795d00
BLAKE2b-256 b3aaf6bfbab3d2a562fa8993ce5b71e55d3be29fc3267e5fb8364315e67ff68c

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