Skip to main content

aiomelcloudhome

GitHub Release Python Versions Project Stage Project Maintenance License

GitHub Activity PyPI Downloads GitHub Last Commit Open in Dev Containers

Build Status Typing Status Code Coverage

Asynchronous Python client for MELCloud Home.

About

aiomelcloudhome is an async client for the MELCloud Home API, focused on:

  • Fetching account context (buildings and devices)
  • Controlling Air-to-Air units
  • Controlling Air-to-Water units
  • Reading telemetry (energy and actual measurements)

The library is under active development and endpoint coverage will keep expanding.

Installation

pip install aiomelcloudhome

Usage

Authenticate with username and password

import asyncio

from aiohttp import ClientSession

from aiomelcloudhome import MELCloudHome


async def main() -> None:
    async with ClientSession() as session:
        async with MELCloudHome(
            username="your@email.com",
            password="your_password",
            session=session,
        ) as client:
            context = await client.get_context()

            for building in context.buildings:
                print(f"Building: {building.name}")

                for unit in building.air_to_air_units:
                    print(f"ATA: {unit.name} (room: {unit.room_temperature} C)")

                for unit in building.air_to_water_units:
                    print(f"ATW: {unit.name} (tank: {unit.tank_water_temperature} C)")


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

Authenticate with an existing access token

from aiomelcloudhome import MELCloudHome


client = MELCloudHome(access_token="YOUR_ACCESS_TOKEN")

Control an Air-to-Air unit

from aiomelcloudhome import ATAFanSpeed, ATAOperationMode, MELCloudHome


await client.control_ata_unit(
    "ata-unit-id",
    power=True,
    operation_mode=ATAOperationMode.HEAT,
    set_temperature=21.0,
    set_fan_speed=ATAFanSpeed.AUTO,
)

Control an Air-to-Water unit

from aiomelcloudhome import ATWZoneMode


await client.control_atw_unit(
    "atw-unit-id",
    power=True,
    operation_mode_zone1=ATWZoneMode.HEAT_ROOM_TEMPERATURE,
    set_temperature_zone1=21.0,
    set_tank_water_temperature=50.0,
)

Fetch telemetry

from datetime import UTC, datetime, timedelta


energy = await client.get_energy_telemetry(
    "unit-id",
    from_dt=datetime.now(UTC) - timedelta(days=1),
    to_dt=datetime.now(UTC),
)

outdoor = await client.get_outdoor_temperature("ata-unit-id")

Live updates over WebSocket

Instead of polling get_context(), you can opt in to a live update stream. stream_updates() connects to the MELCloud Home realtime WebSocket, reuses the client's existing authentication, reconnects transparently, and yields a typed UnitStateDelta whenever a unit changes. Control, telemetry and the initial state snapshot still use the REST API.

async for delta in client.stream_updates():
    print(delta.unit_id, delta.unit_type, delta.changes)
    # e.g. changes == {"SetTemperature": 21.0} or {"OperationMode": ATAOperationMode.COOL}

The stream raises MelCloudHomeWebSocketError if the realtime channel cannot be established, so you can fall back to polling.

For a long-lived listener that you need to start and stop (for example a Home Assistant coordinator), use client.websocket() to hold a handle, register your callbacks and await listen() in a task you own. It retries every failure except MelCloudHomeAuthenticationError and returns once you close() it. The connection callback tells you when live updates stop and start working, so you can poll in between:

ws = client.websocket()
ws.register_delta_callback(lambda delta: print(delta.unit_id, delta.changes))
ws.register_connection_callback(lambda connected: print("live" if connected else "lost"))
task = asyncio.create_task(ws.listen())

# on shutdown (e.g. async_unload_entry):
await ws.close()  # stops gracefully; listen() returns on its own
await task

Both register_* methods return a function that unregisters the callback.

More examples can be found in the examples directory.

Documentation

Project documentation and API reference: https://github.com/erwindouna/aiomelcloudhome

Contributing

Contributions are welcome. Please open an issue or pull request.

For local development:

uv sync --all-groups && uv run pre-commit install

Run checks:

uv run pre-commit run --all-files

Run tests:

uv run pytest

Update snapshot tests:

uv run pytest --snapshot-update

License

MIT License

Copyright (c) 2026 Erwin Douna

Metadata

Release files for aiomelcloudhome 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiomelcloudhome 0.3.2
File Size Uploaded Provenance Actions
aiomelcloudhome-0.3.2.tar.gz 21.0 kB With provenance Details for aiomelcloudhome-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiomelcloudhome 0.3.2
File Interpreter ABI Platform Actions
aiomelcloudhome-0.3.2-py3-none-any.whl Python 3 none any Details for aiomelcloudhome-0.3.2-py3-none-any.whl

Total release size: 46.8 kB

Release files / aiomelcloudhome-0.3.2.tar.gz

Download URL aiomelcloudhome-0.3.2.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f0fbc4ead5dac8bf04ba0cb82c671c10e36e13992e6047af68b946490da77a5d
BLAKE2b-256 checksum
How to use checksums
cf08b19de88d846604beb42261062e4bf13fb770c3217cb04aa62341dca1bd73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / aiomelcloudhome-0.3.2-py3-none-any.whl

Download URL aiomelcloudhome-0.3.2-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8c5b9f2737916589e40968809e2e2654ea36d42ba54385fdb40e25e37e8a0ad
BLAKE2b-256 checksum
How to use checksums
b0237f249c83edc4500219aab9db427eb1b932bd473cddb302b6259aa96d8565
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for aiomelcloudhome 0.3.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiomelcloudhome-0.3.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

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.

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