Skip to main content

Async Python client for the Homecast API

Project description

pyhomecast

Async Python client for the Homecast REST API.

Installation

pip install pyhomecast

Usage

import aiohttp
from pyhomecast import HomecastClient

async with aiohttp.ClientSession() as session:
    client = HomecastClient(session)
    client.authenticate("your_access_token")

    # Get all device state
    state = await client.get_state()
    for device in state.devices.values():
        print(f"{device.name} ({device.device_type}): {device.state}")

    # Control a device
    await client.set_state({
        "my_home_0bf8": {
            "living_room_a1b2": {
                "ceiling_light_c3d4": {"on": True, "brightness": 80}
            }
        }
    })

    # Run a scene
    await client.run_scene("my_home_0bf8", "Good Morning")

API

HomecastClient(session, api_url="https://api.homecast.cloud")

  • authenticate(token) - Set the Bearer token
  • get_state(home?, room?, device_type?, name?) - Fetch device state (returns HomecastState)
  • set_state(updates) - Control devices
  • run_scene(home, name) - Execute a scene

Models

  • HomecastState - Contains devices and homes dicts
  • HomecastDevice - Single device with state, settable, device_type
  • HomecastHome - Home with key and name

Exceptions

  • HomecastError - Base exception
  • HomecastAuthError - 401/403 errors
  • HomecastConnectionError - Network/server errors

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 Distribution

pyhomecast-0.2.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

pyhomecast-0.2.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pyhomecast-0.2.0.tar.gz.

File metadata

  • Download URL: pyhomecast-0.2.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyhomecast-0.2.0.tar.gz
Algorithm Hash digest
SHA256 72a9a3d57c06dcff6b66faf7d9948aea8bb22d455e41cb994b968423f939c20c
MD5 46d01e10ec6e372807247e64e5cafb7e
BLAKE2b-256 a37763d1a0d92f8291373a7ed327fd835a134fdfc5b9a9febddd7cc8a53ecebd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhomecast-0.2.0.tar.gz:

Publisher: python-package.yml on parob/pyhomecast

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

File details

Details for the file pyhomecast-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyhomecast-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyhomecast-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45d4d1549f7f71c5b989cc37056a6b89f2e52e31db467dd1b864e1bc8896683b
MD5 b1bdc249cd5d2c668b61c1270b705fbf
BLAKE2b-256 bb89be20d28fa777db03ccc5bc1b13b0a0da1c4dfd4f8c6297036ed69b4db4ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhomecast-0.2.0-py3-none-any.whl:

Publisher: python-package.yml on parob/pyhomecast

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