Skip to main content

Asyncio package to communicate with a Philips Hue Play HDMI Sync Box.

Project description

AIOHUESYNCBOX

Asyncio package to communicate with Philips Hue Play HDMI Sync Box. This package is aimed at basic control of the box. Initial setup and configuration is assumed to done with the official Hue Sync app.

Installation

python3 -m pip install aiohuesyncbox

Usage

Instantiate the HueSyncBox class and access the API.

For more details on the API see the official API documentation on https://developers.meethue.com

Examples

The examples below are available as a runnable script in the repository. There is also an example on using zeroconf for device discovery.

Registration

import time
from aiohuesyncbox import HueSyncBox, InvalidState

# host and id can be obtained through mDNS/zeroconf discovery
# (or for testing look them up in the official Hue Sync app)
# The ID is the number that looks like C43212345678
box = HueSyncBox(host, id)

print("Press the button on the box for 3 seconds until the light blinks green.")

registration_info = None
while not registration_info:
    try:
        registration_info = await box.register("Your application", "Your device")
    except InvalidState:
        # Indicates the button was not pressed
        pass
    time.sleep(1)

# Save registration_info somewhere and use the 'access_token' when instantiating HueSyncBox next time
print(registration_info)

# Unregister by registration ID.
# HueSyncBox needs to use the associated `access_token` to execute this request.
await box.unregister(registration_info['registration_id'])

Basic usage

from aiohuesyncbox import HueSyncBox

# host and id can be obtained through mDNS/zeroconf discovery
# (or for testing look them up in the official Hue Sync app)
box = HueSyncBox(host, id, access_token_from_registration_info)

# Call initialize before interacting with the box
await box.initialize()
print(box.device.name)
print(box.execution.sync_active)
print(box.execution.mode)

# Turn the box on, start syncing with video mode on input 4
await box.execution.set_state(sync_active=True, mode="video", hdmi_source="input4")

# Call update() to update with latest status from the box
await box.execution.update()
print(box.execution.sync_active)
print(box.execution.mode)

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

aiohuesyncbox-0.0.17.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

aiohuesyncbox-0.0.17-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file aiohuesyncbox-0.0.17.tar.gz.

File metadata

  • Download URL: aiohuesyncbox-0.0.17.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for aiohuesyncbox-0.0.17.tar.gz
Algorithm Hash digest
SHA256 deab7b9199db35cc7434b1a5038112f25a98509a5e40c22277314b08a1d57aec
MD5 f7ed979369e15247e49aa40bbbcada8d
BLAKE2b-256 19f3a31d1aab9d5ba560932781111d705d720929f08f671f95548b4f175f7090

See more details on using hashes here.

File details

Details for the file aiohuesyncbox-0.0.17-py3-none-any.whl.

File metadata

  • Download URL: aiohuesyncbox-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for aiohuesyncbox-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 c22e63626288aca90baa9e465b78663d7efbfb5e6b228668772b973b8a00de53
MD5 0fd67179d19c72007c8a118207703791
BLAKE2b-256 9e9b296567da9676b317bfc9b6f293a32f5dbec2008cad8a89500e38f881c199

See more details on using hashes here.

Supported by

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