Skip to main content

A library for the Philips Hue API

Project description

hue_snek

A python Library for the Philips Hue API

About

hue_snek is a python library for the Philips Hue API, that allows for easy API integration into other projects. The goal of this library is to provide the basic functions needed to interact with the Hue API, without unecessary functions.

I will add more documentation and progress reports in the following days.

Features

  • connect to bridge
  • get light information (name, state, modelname, etc.)
  • set light parameters (on/off, brightness, hue, etc.)
  • get group information (name, on/off, colormode, etc.)
  • set group parameters (on/off, brightness, hue, etc.)
  • get scene information (name, assigned group(s), etc.)
  • set scene for group (via scene name)
  • get bridge information (name, mac, api-version, etc.)

WIP

  • Documentation

Example

Basic usage of this library:

from hue_snek import Hue, Light

#setup bridge
h = Hue('your.ip.here', 'generic-username')

#to check the connection to the bridge use:
h.checkup()                     #returns 0 if connection and username OK

#to get Light information use either the Light or Hue class

#Light
Light(1, h).name                #(light id, bridge)
Light(1, h).brightness          #properties: name, brightness, hue, saturation, state

#Hue
h.get_light(2, 'name')          #parameters: see hue api
h.get_lights('id')              #modes: obj (default, id, name, modelid

h.get_group(1, 'name')          #parameters: see hue api
h.get_groups('name')            #modes: all (default), name, type


#to set lights or groups use either the Light or Hue Class

#Light
Light(2, h).set('bri', '124')

#Hue
h.set_light(1, 'on', 'true')

h.set_group(1, 'on', 'true')

#scenes can be accessed and set like this:

h.get_scenes('name')            #modes: all (default), name, group
h.set_scene(1, 'Chill')         #(group id, scene name)

info = h.get_bridge_info()

for param, value in info.items():
    print(param, value)

Notes

This project was inspired by Phue. Check it out :)

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

hue-snek-channel42-0.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

hue_snek_channel42-0.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file hue-snek-channel42-0.3.tar.gz.

File metadata

  • Download URL: hue-snek-channel42-0.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.0 CPython/3.8.2

File hashes

Hashes for hue-snek-channel42-0.3.tar.gz
Algorithm Hash digest
SHA256 a7a9c42fde46c2775f7126bd85f055dbcab532e173b227d0d63ae82e51aeafd8
MD5 23a26de759dd4805446d7533ff26a6ef
BLAKE2b-256 3caed5ac524caa6b25bd34973201048294c4735098d17f15674ef7b13f6edfc2

See more details on using hashes here.

File details

Details for the file hue_snek_channel42-0.3-py3-none-any.whl.

File metadata

  • Download URL: hue_snek_channel42-0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.0 CPython/3.8.2

File hashes

Hashes for hue_snek_channel42-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 787f7ff63ab007c204a4fc8dff70c66f716a6c0ab0753cbd475834bd8760dedf
MD5 e40708a12c2a835debc8f332e0b55825
BLAKE2b-256 4561963413cb08e7e9611ad04ec65530287fbbff60265140cb7e6060f87f4814

See more details on using hashes here.

Supported by

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