Control Philips hue Lights

    Introduction

    Before proceeding, be sure to review Interface Asset general concepts, including the video at the end of that article.

    This Interface Asset (IA) enables you to control Philips hue lights - both the bulb and the LightStrips - over a local network using any iPad or PC-based device. It is based on the REST protocol and uses the Philips hue official API. Documentation for this API can be found on this website.

    • To see the Philips hue interface asset in action, check out this video.
    • To try it yourself, download the Full HD and/or iPad-ready sample experiences located in the Composer and Player Experiences panel.
    • Interested in building your own REST-based interface assets and want to see how we did it for the Philips hue? Browse to:

      • C:\Program Files (x86)\IntuiLab\IntuiFace\Composer\Resources\Interface Assets\PhilipsHue for IntuiFace 32bits
      • C:\Program Files\IntuiLab\IntuiFace\Composer\Resources\Interface Assets\PhilipsHue for IntuiFace 64bits
    • Open the file PhilipsHue.ifd file in your favorite editor. Then reference this article in our Knowledge Base for insight into the use of REST to connect your experience to a Web API.

    philips-hue-image-01_1_.jpg

    With the Philips hue interface asset, you will be able to:

    • turn lights on/off
    • change their color/brightness/saturation
    • make them blink or enter a color loop mode

    As usual, all of these actions can be called from any trigger available in IntuiFace, everything from a simple button click to an inactivity timer.

    Many scenarios can be created using the hue connected object and there are many ways for you to enhance your users's experience. Here are a few examples:

    • When a person is detected by a motion sensor then turn on the lights
    • When I enter a new space in my experience then change the color of the light bulb to fit this space's ambiance (e.g. match main color of the background image)
    • When I click on a very important button then make the light bulb blink in red to warn me I'm about to do something dangerous (the "red button" syndrome)

    Feel free to share with us your scenarios and ideas in a new discussion on our forum.

    By the way, you could have created this REST-based Interface Asset yourself using Composer Enterprise. Because we think connected objects like these hue light bulbs are part of a new wave in user experiences, we decided to make this example available even in our Free Edition.

    How to use it?

    This interface asset comes pre-installed with IntuiFace Composer. You will find it in the Interface Asset panel.

    hue_IA.jpg

    Getting started

    In order to use the Philips hue interface asset, you need to get two things:

    • the IP Address of your bridge (or its name if you use a DNS on your network). For example: 192.168.1.102 or myphilipshue
    • an authorized username for use of the Philips API on your bridge.

    To acquire those two values, follow the Getting Started guide on the Philips website.

    Then you must register your new username with your bridge:

    1. Go to this URL: http://<bridge ip address>/debug/clip.html
    2. Type the following
      • URL: /api
      • Message body: {"devicetype":"<your user description> user","username":"<your username>"}
    3. Press the link button on your bridge
    4. Click the POST button on this webpage to send the command

    clip-api-debugger-newdeveloper_1_.png

    The bridge IP address and username are the main properties of the hue Interface Asset. With them you are able to interact with your light bulbs.

    Properties, Triggers & Actions

    Important Notice: Each Philips hue Interface Asset enables you to control one bulb or LightStrip. If you want to control several lights, you can either :

    • instantiate as many Philips hue interface assets as you have lights.
    • dynamically change the Light ID property of the Philips hue interface asset.

    Light IDs will be 1, 2 and 3 for the three bulbs you get with your starter kit. See Philips documentation for guidance about how to ID your light bulbs.

    Properties

    • User Name: the username you created in the Getting Started section above
    • Bridge IP address: the address of your bridge on your local network
    • Light ID: the ID of the light you will control with this instance of the Philips hue interface asset

    Philips_hue_Properties.jpg

    Triggers

    • Light can't be reached: raised when the light is physically switched off.
    • Light is now reachable: raised when the light is physically switched on.
    • Light turned off: raised when light has been turned off, by this application or another source (ex: mobile app)
    • Light turned on: raised when light has been turned on.

    This interface asset doesn't have any triggers. To be notified of light modification, call the Get bulb status action. For example, you can use a timer to call the **Get bulb status) action every x seconds.

    Actions

    • Light control
      • Brightness
        • Change brightness
      • Color
        • Change color (hexadecimal)
        • Change color (hue / saturation)
        • Change color (temperature)
        • Change hue
        • Change saturation
      • State
        • Turn light on
        • Turn light off
    • Light effects
      • Change alert mode: Alert mode is a temporary change to the bulb’s brightness. This action can have one of three values:
        • “None” – Alert mode stops if it is running.
        • “Alert Once” – The light performs one cycle of increasing then decreasing brightness.
        • “Alert Multiple” – The light performs the increase/decrease brightness cycle for 30 seconds or until the Change alert mode action is called with the None parameter - whichever occurs first.
      • Change effect mode: The dynamic effect of the light. Currently “None” and “Color Loop” are supported. Setting the effect to Color Loop will cause the light to cycle through all hues using the current brightness and saturation settings.


    Philips_hue_Actions.jpg

    References

    To simplify use, we constrain the Hue parameter to a range of 0 to 360, representing the value in degrees on the HSL color wheel.

    Here is the standard HSL color wheel for reference. Click the image to enlarge it.


    Troubleshooting

    If you're having trouble establishing a connection between IntuiFace and your Philips hue bulb, use the Philips hue "Getting Started" guide to attempt interaction with your bulb via a Web browser. Failure to work with a Web browser means the problems are unrelated to your use of IntuiFace. If it does work in a Web browser but you continue to have problems using IntuiFace, let Support know.