Skip to main content

UNKNOWN

Project description

https://img.shields.io/pypi/v/python-hue-client.svg https://img.shields.io/pypi/dm/python-hue-client.svg https://img.shields.io/github/license/adamcharnock/python-hue-client.svg

A full-featured Python client for the Philips Hue lighting system.

Installation

Installation using pip (recommended):

pip install python-hue-client

Installation using easy_install:

easy_install python-hue-client

Documentation

Documentation can be found at http://python-hue-client.readthedocs.org

Quick Start

This library is modelled roughly on concepts borrowed from Django’s ORM. There are some examples available in GitHub, but let’s dive in with an example that list all the available lights:

from pprint import pprint
from hueclient.api import hue_api
from hueclient.models.light import Light

if __name__ == '__main__':
    hue_api.authenticate_interactive(app_name='List Lights Example')

    for light in Light.objects.all():
        print(
            "Light {id} is named '{name}' and is {onoff} (brightness: {brightness})".format(
                id=light.id,
                name=light.name,
                onoff='on' if light.state.on else 'off',
                brightness=light.state.brightness,
            )
        )

Here is an example which blinks a specific light:

from time import sleep
from hueclient.api import hue_api
from hueclient.models.light import Light

# examples/blink_light.py
if __name__ == '__main__':
    # Make sure we are authenticated with the hue bridge.
    # You will be prompted if no username is found in ~/.python_hue
    hue_api.authenticate_interactive(app_name='Blink Light Example')

    # Get light ID 1
    light = Light.objects.get(id=1)

    # Loop forever
    while True:
        # Flip the on state from on -> off / off -> on
        light.state.on = not light.state.on

        # Save the state back to the bridge
        # (Note: required in order for your changes to take effect)

        light.state.save()

        # Pause here for a couple of seconds to create a slow blink
        # (Note: It is important to sleep here at least a little to
        # avoid overloading the bridge with API requests)
        sleep(2)

For more information see the full documentation.

Credits

Developed by Adam Charnock, contributions very welcome!

python-hue-client is packaged using seed.

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

python-hue-client-0.1.0.tar.gz (917.0 kB view details)

Uploaded Source

Built Distribution

python_hue_client-0.1.0-cp27-none-macosx_10_10_x86_64.whl (4.6 kB view details)

Uploaded CPython 2.7 macOS 10.10+ x86-64

File details

Details for the file python-hue-client-0.1.0.tar.gz.

File metadata

File hashes

Hashes for python-hue-client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 16d7de2fe0ca1594d56bb06f06eed3a5f627eb6f45dcfdb19e7422a6af0a7e1b
MD5 ed4c545e6ce01935e00b23919ba13502
BLAKE2b-256 be9a1e6438910cbba3f0a320b475eff74d28aa738eb49887cab006f20764605b

See more details on using hashes here.

File details

Details for the file python_hue_client-0.1.0-cp27-none-macosx_10_10_x86_64.whl.

File metadata

File hashes

Hashes for python_hue_client-0.1.0-cp27-none-macosx_10_10_x86_64.whl
Algorithm Hash digest
SHA256 0aa4ed069ad61864e4e5cd33a4e1dc0af9e347fdbe9f57394f6e982df88734f5
MD5 cc78bd01bd2a8fdffa8f599a1dad7340
BLAKE2b-256 a0e2e838bee8de038456d5377e7cc9c739e5d509b9e28458f833df63278eb902

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