Skip to main content

Home Connect Websocket API

Project description

Home Disconnect

Control Home Connect Appliances through a local Websocket connection.

Used by homeconnect_local_hass, the Home Assistant integration this library was extracted for.

Authentication and Device Description

To connect to an Appliance, you need its encryption keys and the description of its features and options. The Appliance uses either TLS PSK or AES encryption, AES requiring an additional Initialization Vector (IV). Both Key and IV are send to Home Connect cloud servers on setup. To get the keys and description from the cloud use the Home Connect Profile Downloader tool.

For each registered Appliance, the downloaded zip-file contains three files named with the Appliance serial number:

  • [serialNumber].json: Contains information about the Appliance including encryption keys. The connectionType field indicates if the Appliance uses PSK or AES encryption. When the connection type is "AES" the Appliance uses AES Encryption and requires the IV.
  • [serialNumber]_DeviceDescription.xml and [serialNumber]_FeatureMapping.xml: Contains the Device Description, see below

Parsing Device Description

import json
from pathlib import Path

from home_disconnect import parse_device_description

# Load Description from File
with Path("[serialNumber]_DeviceDescription.xml").open() as file:
    DeviceDescription = file.read()

with Path("[serialNumber]_FeatureMapping.xml").open() as file:
    FeatureMapping = file.read()

description = parse_device_description(DeviceDescription, FeatureMapping)

# Save Description to File for later use
with Path("DeviceDescription.json").open(mode='w') as file:
    json.dump(description, file)

Its best to save the parsed description as a json File to reuse later.

Connecting

import asyncio
import json

from home_disconnect import DeviceDescription, HomeAppliance


async def main(description: DeviceDescription) -> None:
    app_name = "Example App"  # Name of your App, can be anything
    app_id = "d50661eca7e45a"  # ID of your App, can be anything
    psk64 = "whZJhkPa3a1hkuDdI3twHdqi1qhTxjnKE8954_zyY_E="  # PSK Key
    # iv64 = "ofi7M1WB98sJeM2H1Ew3XA==" # IV for Appliances with AES Encryption

    appliance = HomeAppliance(
        description,
        "192.168.1.2",
        app_name,
        app_id,
        psk64=psk64,
        # iv64=iv64
    )
    # Connect to Appliances
    await appliance.connect()

    # Set PowerState to On
    await appliance.settings["BSH.Common.Setting.PowerState"].set_value("On")


if __name__ == "__main__":
    # Load DeviceDescription from File
    with open("DeviceDescription.json", "r") as f:
        description = json.load(f)

    asyncio.run(main(description))

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

home_disconnect-1.5.4.tar.gz (30.9 kB view details)

Uploaded Source

Built Distribution

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

home_disconnect-1.5.4-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file home_disconnect-1.5.4.tar.gz.

File metadata

  • Download URL: home_disconnect-1.5.4.tar.gz
  • Upload date:
  • Size: 30.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for home_disconnect-1.5.4.tar.gz
Algorithm Hash digest
SHA256 7098ba71694af0fd05734ce5cacaeb0c91e722cbf0f55028e301c8e268c8c035
MD5 ba8d010aa0ca4c913892c43d46f40465
BLAKE2b-256 1da674e02bbde4a895c6200e13300d898159370149a32552cfb1708702c74f9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for home_disconnect-1.5.4.tar.gz:

Publisher: publish.yml on vemboy200/home-disconnect

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

File details

Details for the file home_disconnect-1.5.4-py3-none-any.whl.

File metadata

  • Download URL: home_disconnect-1.5.4-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for home_disconnect-1.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9a5fe5014ae74bd2f962fe2a9e39ba07a0cd16301ea7f2d24a922716709de89b
MD5 b63fa0ee9c12807fa9dc07d49618bedd
BLAKE2b-256 b6f81bb768b6371ebdc44abdea4c88438c361932068ec0303ab237a1a9a84a09

See more details on using hashes here.

Provenance

The following attestation bundles were made for home_disconnect-1.5.4-py3-none-any.whl:

Publisher: publish.yml on vemboy200/home-disconnect

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

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