LATEST VERSION 1.0 (04.05.2017)

Description

hue logoCurrent FLASH team research concerns developing new robot competencies and examining the possibility of establishing and maintaining relationships with humans during long-term interaction. Therefore, social robots must be ready to become a part of smart devices already installed in their homes.
 
Philips Hue is a line of color changing LED lamps and white ambiance bulbs created by Philips. It uses the Zigbee lighting protocol to communicate, and can be controlled via smartphone apps over Wi-Fi. he Philips Hue system can be easily integrated with other ZigBee-based systems for additional home automation. The heart of Philips Hue system is bridge that connects your smart device to your Philips Hue lights. You can add up to 50 Philips Hue lights and accessories to one bridge. Linked to Wi-Fi via your router, it also connects your system to the wider world via the Internet for out-of-home control and other smart features.
 
More information you can find here: http://www2.meethue.com/
and for developers, go there: https://developers.meethue.com 
 

Requirements

The hue bridge APIs has a RESTful interface over HTTP. The purpose of this web service interface is to give every light in your system a URL in your local network. You can also control every parameter of these lights via local URL. This means that controlling the lights is achieved by simply sending a new value to this local URL. Discovering what lights you have in your system and what they are doing is just as easy as we have a URL for this too. That’s the basic idea of a RESTful interface. All responses and new values are sent and returned in JSON (JavaScript Object Notation). UPhilipsHue module is utilizing cURL library for transferring data with URL syntax between robot and your hue bridge.

UPhilipsHue was compiled with all shared libraries (all included in uphilipshue1x.zip package). Copy them to the uobjects folder or set path in system environment variable (PATH).

  • libcurl.dll
  • libeay32.dll
  • ssleay32.dll
  • UPhilipsHue.dll

How to start?

1. First make sure you have your hue kit connected and installed. For help with this please visit the getting started page (http://www2.meethue.com/en-gb/about-hue. Then, test that the smartphone app can control the lights on the same network.

2.Load module into the URBI engine and create new instance:

loadModule("UPhilipsHue");
var Global.Hue = UPhilipsHue.new();

3.Try to access bridge with FindBridge() function:

Global.Hue.FindBridge();

4. If you have never paired your bridge with your system you will see the press link button request. You have 30s for press.

uphilips4

uphilips2

uphilips3

5. Get your hue system state:

Global.Hue.GetState();

6. Observe your system status:

echo(Global.Hue.configName);
echo(Global.Hue.lightsName);

uphilips1

 

Module functions

Main slots

UPhilipsHue.new(); - create new instance,
bool = UPhilipsHue.FindBridge(); - find bridge in your local network and get access,
bool = UPhilipsHue.GetState(); - get bridge state (config, lights, groups, scenes),

Light slots

["name1",..., "nameN"] = UPhilipsHue.lightsName; - vector of strings of light names,
["type1",..., "typeN"] = UPhilipsHue.lightsType; - vector of strings of light types:

"On/off light" - supports groups, scenes and on/off control,
"Dimmable light" - supports groups, scenes, on/off and dimming,
"Color temperature light" - supports groups, scenes, on/off, dimming, and setting of a
color temperature,
"Color light" - supports groups, scenes, on/off, dimming and color control
(hue/saturation, enhanced hue, color loop and XY),
"Extended Color light" - same as Color light, but which supports additional setting of color temperature,

[bool1,..., boolN] = UPhilipsHue.lightsStateReachable; - vector of available bulbs (powered), indicates if a light can be reached by the bridge,
[bool1,..., boolN] = UPhilipsHue.lightsStateOn; - vector of enabled bulbs, On=true, Off=false,
[brightness1,..., brightnessN] = UPhilipsHue.lightsStateBri; - vector of bulb brightness values, this is a scale from the minimum brightness the light is capable of, 1, to the maximum capable brightness, 254.
[hue1,..., hueN] = UPhilipsHue.lightsStateHue; - vector of bulb hue values, this is a wrapping value between 0 and 65535. Both 0 and 65535 are red, 25500 is green and 46920 is blue.
[saturation1,..., saturationN] = UPhilipsHue.lightsStateSat; - vector of hue values, 254 is the most saturated (colored) and 0 is the least saturated (white).
[colorTemp1,..., colorTempN] = UPhilipsHue.lightsStateCt; - vector of color temperature values, this is the Mired Color temperature of the light, capable of 153 (6500K) to 500 (2000K)

bool = UPhilipsHue.SetLight(light_number, On, bri, hue, sat, ct, tT); - control single bulb, where:

light_number - number of bulb, 1...N,
On - bulb ON/OFF, On=true, Off=false,
bri - brightness value, 1...254, set -1 to leave unchanged,
hue - hue value, 0...65535, set -1 to leave unchanged,
sat - saturation value, 0...254, set -1 to leave unchanged,
ct - saturation value, 153...500, set -1 to leave unchanged,
tT - the duration of the transition from the light’s current state to the new state,
this is given as a multiple of 100ms, tT = 10 will make the transition last 1 second.

Group slots

["name1",..., "nameN"] = UPhilipsHue.groupsName; - vector of strings of group names,
["type1",..., "typeN"] = UPhilipsHue.groupsType; - vector of strings of group types, can be "LightGroup", "Room" or either "Luminaire" or "LightSource", read Philips hue SDK spec.
["class1",..., "classN"] = UPhilipsHue.groupsClass; - vector of strings of group types, can be "Living room", "Kitchen Dining ", "Bedroom", "Kids bedroom, "Bathroom", "Nursery", "Recreation", "Office", "Gym Hallway", "Toilet", "Front door", "Garage", "Terrace", "Garden", "Driveway", "Carport", "Other",
UPhilips["1...N",..., "1...N"] = UPhilipsHue.groupsLights; - arrays of light IDs of the lights that are in the group,
[bool1,..., boolN] = UPhilipsHue.groupsStateAllOn; - vector of group light states, “false” if all lamps are off, “true” if at least one lamp is on
[bool1,..., boolN] = UPhilipsHue.groupsStateAnyOn; - vector of group light states, “false” if at least one lamp is off, “true” if all lamps are on

bool = Global.Hue.SetGroup(1,true,20,-1,-1,-1,10); - control group, where:

light_number - number of group, 1...N, 0 - all available lights in every groups,
On - ON/OFF, On=true, Off=false,
bri - brightness value, 1...254, set -1 to leave unchanged,
hue - hue value, 0...65535, set -1 to leave unchanged,
sat - saturation value, 0...254, set -1 to leave unchanged,
ct - saturation value, 153...500, set -1 to leave unchanged,
tT - the duration of the transition from the light’s current state to the new state,
this is given as a multiple of 100ms, tT = 10 will make the transition last 1 second.

Scene slots

["ID1",..., "IDN"] = UPhilipsHue.scenesID; - vector of strings of scenes unique IDs,
["name1",..., "nameN"] = UPhilipsHue.scenesName; - vector of strings of scene names,
UPhilips["1...N",..., "1...N"] = UPhilipsHue.scenesLights; - arrays of light IDs of the lights that are in the scene,

bool = UPhilipsHue.RecallScene(group, scenesID); - recall scene in the group, where:

group - number of group, 1...N, 0 - all available lights in every groups,
scenesID - scene ID (UPhilipsHue.scenesID slot can be used).

Urbiscript example

loadModule("UPhilipsHue");
var Global.Hue = UPhilipsHue.new();
Global.Hue.FindBridge();
Global.Hue.GetState();
 
echo(Global.Hue.configName);
 
echo(Global.Hue.lightsName);
 
echo(Global.Hue.groupsName);
 
echo(Global.Hue.scenesName);
 
sleep(2);
Global.Hue.SetLight(3,true,40,-1,-1,-1,10);
 
sleep(2);
Global.Hue.SetGroup(1,true,20,-1,-1,-1,10);
 
sleep(2);
Global.Hue.RecallScene(0, Global.Hue.scenesID[0]);

Download

LINK

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 0.9.1, 15.05.2017

FLASH Documentation