Project Home‎ > ‎Documentation‎ > ‎Interfaces‎ > ‎

Phillips HUE

Phillips HUE is a smart Hub/Bridge connected by standard ethernet.  It has a RESTful interface over HTTP.
The bridge talks to various types of LED light bulbs including some that have a range of colors and intensities.

Lights are connected to the bridge via an open standards protocol called ZigBee Light Link.  Each bulb participates in a mesh network allowing lights to pass on messages to the next extending the range and making everything more robust.

Right now special settings beyond brightness must be set as in the list below.  This may change in the future but the docs will be updated to inform you.  Please note minimum and maximum values for each attribute.

brightness : level = (int)        - int is from 0 to 100 (mapped to 255)
hue        : level = ('hue:int')  - int is from 0 to 65535
saturation : level = ('sat:int')  - int is from 0 to 255   
ct         : level = ('ct:int')   - int is from 153 to 500
rgb        : level = ('rgb:hex')  - hex is from 000000 to ffffff
transition : level = ('tr:int')   - int is from 0 to 3000 in tenths of seconds
effect     : level = ('eft:colorloop|none') put bulb in colour loop


Not all RGB colours will produce a colour in the HUE lamps.
ct values are translated kelvin temperature values from 2000K to 6500K
2000K maps to 500 and 6500K maps to 153


Note (huecmdr.py):

We have included a Linux console, python utility, called "huecmdr.py".  You can use it to test various aspects
of the HUE system.  It runs great in any X terminal as well, such as Gnome Terminal.

It has the following features:
  • Authenticate your computer with the bridge
  • Ask the bridge to search for newly purchased bulbs
  • List all the bulbs known to the bridge
  • Select a bulb for testing
  • Test various values of
    • RGB colours
    • Colour temperature
    • Hue and Saturation
    • Brightness
This utility is a great way of selecting a value to use in your Pytomation Instance file.


Addressing bulbs and Groups

The Phillips HUE Bridge can have address single bulbs and groups of bulbs.

To use a single bulb address it with the bulb number and the letter 'L' to address a group
that has been defined in the Bridge address it with 'G'.

Examples:
    Bulb number 4    ->  'L4'
    Group number 3 ->  'G3'

The examples below all use bulb number 3.

Using in an Instance

# Set up the interface with IP address and poll time in seconds
hue = PhillipsHue(address='199.60.63.6', poll=30)

# Using in a light
l_sofa = Light(address='L3', devices=(hue), name="Sofa Light",



Setting Brightness
test = Light(address='L3',
                devices=(hue,buttons),
                mapped=({
                    Attribute.COMMAND: Command.ON,
                    Attribute.MAPPED:  (Command.LEVEL, 45),
                    Attribute.SOURCE:  buttons,
                },
                name='Test'
            )


Setting Hue
test = Light(address='L3',
                devices=(hue,buttons),
                mapped={
                    Attribute.COMMAND: Command.ON,
                    Attribute.MAPPED:  (Command.LEVEL, ('hue:23300')),
                    Attribute.SOURCE:  buttons,
                },
                name='Test'
            )

# Set brightness and hue and saturation
test = Light(address='L3',
                devices=(hue,buttons),
                mapped={
                    Attribute.COMMAND: Command.ON,
                    Attribute.MAPPED:  (Command.LEVEL, (80,'hue:23300','sat:153')),
                    Attribute.SOURCE:  buttons,
                },
                name='Test'
            )



Setting RGB Colour
test = Light(address='L3',
                devices=(hue,buttons),
                mapped={
                    Attribute.COMMAND: Command.ON,
                    Attribute.MAPPED:  (Command.LEVEL, ('rgb:2c00ff')),
                    Attribute.SOURCE:  buttons,
                },
                name='Test'
            )


Setting Temperature
test = Light(address='L3',
                devices=(hue,buttons),
                mapped={
                    Attribute.COMMAND: Command.ON,
                    Attribute.MAPPED:  (Command.LEVEL, ('ct:500')),
                    Attribute.SOURCE:  buttons,
                },
                name='Test'
            )

Setting Transition Time
test = Light(address='L3',
                devices=(hue,buttons),
                mapped={
                    Attribute.COMMAND: Command.ON,
                    Attribute.MAPPED:  (Command.LEVEL, ('tr:153')),
                    Attribute.SOURCE:  buttons,
                },
                name='Test'
            )

Setting Effect
test = Light(address='L3',
                devices=(hue,buttons),
                mapped=({
                    Attribute.COMMAND: Command.ON,
                    Attribute.MAPPED:  (Command.LEVEL, ('eft:colorloop')),
                    Attribute.SOURCE:  buttons,
                },{
                    Attribute.COMMAND: Command.OFF,
                    Attribute.MAPPED:  (Command.LEVEL, ('eft:none')),
                    Attribute.SOURCE:  buttons,
                                    },),
                name='Test'
            )

Comments