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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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