[UPDATED as of March 24, 2016] Hue Lights & Groups & Scenes (OH MY!)

by: infofiend & claytonnj

UPDATED as of May 4th: new abilities include

1. Creation, Modification, and Deletion of Hue Hub Groups and Scenes - directly from SmartThings
– These features will appear on the Groups page and the Scenes page in the HLGS service manager (after inital installation).

As of March 26th: new abilities include

  1. Color Temperature Slider Control from Bulbs or Groups

  2. Transition Time Slider Control from Bulbs or Groups

  3. Ability to update Scene settings directly from Scene device

  4. Scene devices can retrieve & display Hue Hub sceneID

  5. Group devices can retrieve & display Hue Hub groupID

  6. Bulbs and Groups have colorloop effect


Claytonnj and I have created a Hue Service Manager that finds and installs (1) individual Hue Lights, (2) Hue Groups, and (3) Hue Scenes.

Installation Instructions

  1. If you already have an existing Hue Service Manager and Hue Lights in your SmartThings system, completely remove the app and all lights.
  2. Install and publish the service manager SmartApp into your IDE. You can find the code here
  3. Install and publish the 5 device type handlers into your IDE. You can find the code for each here
  4. In the SmartThings App, go to the “My Apps” section of the SmartApps Marketplace, and install the “Hue Lights and Groups and Scenes (OH MY)” SmartApp.
  5. In that app, find and authorize your Hue Hub. Once that is done, there is a separate page for finding and selecting Hub Bulbs, Hue Groups, and Hue Scenes.

Use

  1. The Lights work as normal.
  2. The Groups work just like the lights do.
  3. The Scenes are set up as Momentary Switches. Just press the button and all the lights in the scene are adjusted all at once (and very fast)!
  4. The Scenes have a “setScene” function that can be used via other SmartApps. The parameter for the setScene() function is “groupID” - which is the number that your Hue Hub assigned to that group. Use 0 for all lights. So, if you wanted to apply a scene you set up called “Movies” and only have it applied to the group you set up with id of 1 (maybe named “Living Room”), then you would call Movies.setScene(1). If you wanted that scene’s settings to apply to all lights in the scene, then you would call Movies.setScene(0).

Known Issue

  1. Due to the 20 second limit for routines, you need to limit the number of devices (meaning lights, groups, and scenes) that you install at a single time. Typically less than 20 works for me. This does not mean that you cannot have more than 20 total, just that IF you receive an error upon installation, then try installing 20 or less devices and then install more by opening up the “Hue Lights and Groups and Scenes (OH MY)” SmartApp again.

Thanks to zpriddy for his work on Hue Groups (Connect)!

14 Likes

I’ve installed your smartapp, which does what it says on the tin… But it’s not picking up any new scenes or any scenes ive renamed? Any suggestions

Cheers

I should add a note here… I am about to release an update for my hue groups! I now have better control of the groups updating the lights and vise-versa not to mention a TON of code cleanup! I have been working to standardize all of the code to make it more friendly to work with.

:slight_smile:

I am also working on a section of the code to allow you to read from the hue dimmer switch :slight_smile:

I like the idea of the scenes and I will have to dig into the code later!

I would also be down for merging the two into a new GitHub repo. Feel free to message me

2 Likes

ROfu-

When you say that its not picking up any new scenes - do you mean scenes that you created via the Hue hub after installing my SmartApp? Just making sure, as I see such new scenes here.

Tony

Hey infofiend,

It has picked up newly created scenes from the hub (I just hadn’t given it enough time) the Change in names for scenes on the other hand, which i believe just creates another scene - they didn’t show up no matter how long i waited.
I’m going to factory reset my bridge tonight, just to make it all clean again. And see what happens

Cheers for the response.

Sign me up for testing help, if you like - I have a couple of Hue Beyonds which show up in the Hue app as groups :smiley:

1 Like

Hi, thanks for creating such a great Smartapp. I am having a problem getting it installed, however. As I go through the installation process, everything goes smoothly until the end when the app asks me to select Scenes. Regardless of whether I check off any scenes or leave it blank, when I click Done, I get a red error message which states: “Failed to save page: Scene Discovery.”

What’s especially weird is that I went into the Hue API and deleted all of my scenes thinking that might fix the problem. I then started over with the SmartApp’s installation process, but it still finds three scenes for my Hue Beyond (Hue Beyond Down 1, Hue Beyond Up and Hue Beyond 1). The app identifies these as Scenes, but the API shows them as Groups (which I cannot uninstall for some reason). I rechecked the API and confirmed that there are no Scenes in the Bridge. I also uninstalled and reinstalled the SmartApp and all devices, but I still got the same error message.

Any advice?

Rob

Just wanted to say thank you so much for the app and all your hard work!

I do have one small issue that I searched forums and here for, but couldn’t find anyone having this issue. (I’m a 1 week old Smartthings user, so please take it easy on me) ;0)

Everything is working as stated and all my scenes / lights and groups made it but I seem to have an issue with the color wheel for any given light.

When you change color with color wheel, it shuts hue bulb off, then you have to use slider to bring the bulb back on and then the color changes.

I can pull logs or whatever you might need, but I might honestly have to have a little handholding when it even comes to that. Very new to all this but have some code background so hopefully won’t be too painful.

Thank you again for all your work!!!

1 Like

Rob-

Can you go to the IDE log and tell me what specific error occurs when the “Failed to save page: Scene Discovery.” message appears on your device?

Thanks,
Tony

4loveofpunk-

That’s very weird. I am unable to replicate that problem on my device. Logs would be very helpful.

In general, open the IDE logs on a computer while you are using the device. Try to identify the errors (if any) and/or the events that show up when you are using the color wheel. Let me know what you find. Also - are you using iOS or Android?

Thanks,
Tony

Hi Tony. I will get you that information tonight. I will need to uninstall the current Hue Connect app I am using and all devices and reinstall your Smartapp and devices. Anything else I should do to reinstall on a clean slate?

I have the exact same issue as 4loveofpunk.

I use an iPhone (iOS 9.2.1) in case that matters. Also, I am using a first gen Hue bridge and second gen ST.

I don’t know where to find the logs to share though. Here is the list of events and event details of changing the color, if that is what you need.

Date Source Type Name Value User Displayed Text Changed
2016-02-23 12:06:17.275 PM EST moments ago COMMAND off off command was sent to Al’s Room true
2016-02-23 12:06:17.237 PM EST moments ago DEVICE switch off Al’s Room switch is off true
2016-02-23 12:06:10.412 PM EST moments ago COMMAND setLevel setLevel(44) command was sent to Al’s Room true
2016-02-23 12:06:10.379 PM EST moments ago DEVICE level 44 Al’s Room level is 44 true
2016-02-23 12:05:45.688 PM EST moments ago COMMAND setAdjustedColor setAdjustedColor({“red”:255,“level”:100,“hex”:"#ff4901",“blue”:1,“saturation”:99.6078431372549,“hue”:4.724409448818897,“green”… true
2016-02-23 12:05:45.614 PM EST moments ago DEVICE color #ff4901 Al’s Room color is #ff4901 true
2016-02-23 12:05:36.107 PM EST moments ago COMMAND on on command was sent to Al’s Room true

Name Value
archivable true
commandId 519504
date 2016-02-23 12:05:45.688 PM EST (2016-02-23T17:05:45.688Z)
description setAdjustedColor({“red”:255,“level”:100,“hex”:"#ff4901",“blue”:1,“saturation”:99.6078431372549,“hue”:4.724409448818897,“green”:73,“alpha”:1}) command was sent to Al’s Room
deviceId a11811b3-4e36-40ce-ad5f-5d87bd7f1fec
displayed false
eventSource COMMAND
groupId 8b40afd5-56c7-4703-b247-c2dbf62ca8ed
hubId dbf2c784-9ce4-487e-ad45-870d00fe8624
id adbe7580-da4f-11e5-8e2d-22000b4e0638
isStateChange true
isVirtualHub false
linkText setAdjustedColor({“red”:255,“level”:100,“hex”:"#ff4901",“blue”:1,“saturation”:99.6078431372549,“hue”:4.724409448818897,“green”:73,“alpha”:1})
locationId 7d6f5bd9-6d97-4d74-8be5-0bd421d1511b
rawDescription setAdjustedColor
translatable false
unixTime 1456247145688
value setAdjustedColor
viewed false

Rob-

It sounds like you might have identified the problem - you need to install all of the device types used by the smartapp (and remove the original Hue Connect app). Let me know how it goes.

Tony

Hello @infofiend and thank you for quick response. Here’s my info below and same with @jcarrano I am on IOS 9.2.1

LOGS:

10:46:18 PM: trace NON-HUE EVENT devicetype:04, mac:90724005C331, networkAddress:0A000103, deviceAddress:0050, stringCount:04, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788216132::upnp:rootdevice, ssdpTerm:, ssdpNTS:ssdp:alive 2a4e1127-e2c2-4401-aa20-f1f467665a7b 10:46:18 PM: info LOCATION HANDLER: devicetype:04, mac:90724005C331, networkAddress:0A000103, deviceAddress:0050, stringCount:04, ssdpPath:/description.xml, ssdpUSN:uuid:2f402f80-da50-11e1-9b23-001788216132::upnp:rootdevice, ssdpTerm:, ssdpNTS:ssdp:alive d773df05-8e2a-4d9c-b847-88a6fb19d9b4 10:45:49 PM: error groovy.json.JsonException: Expected a value on line: 1, column: 2. But got an unterminated array. @ line 773 ce634b41-660b-4129-afd4-e2192364a51a 10:45:48 PM: debug Executing 'setLevel' d773df05-8e2a-4d9c-b847-88a6fb19d9b4 10:45:45 PM: error groovy.json.JsonException: Expected a value on line: 1, column: 2. But got an unterminated array. @ line 773 d773df05-8e2a-4d9c-b847-88a6fb19d9b4 10:45:45 PM: trace HUE BRIDGE, OTHER ce634b41-660b-4129-afd4-e2192364a51a 10:45:45 PM: debug setColor: [red:255, level:null, hex:#ff793c, blue:60, saturation:76.47058823529412, hue:5.213675213675212, green:121, alpha:1] ce634b41-660b-4129-afd4-e2192364a51a 10:45:45 PM: info percent: 5.213675213675212, adjusted: 5.213675213675212 ce634b41-660b-4129-afd4-e2192364a51a 10:45:45 PM: debug setAdjustedColor: [red:255, level:100, hex:#ff793c, blue:60, saturation:76.47058823529412, hue:5.213675213675212, green:121, alpha:1] 17da3074-a63f-40c1-938a-38e84fd8ed5b 10:45:34 PM: debug getChildDevices(true), children=1

Json Exception popped up twice. Let me know if this helps or have any advice.

J

Okay, I started from scratch last night and deleted/reinstalled the app and the various device types. I am still getting the same error message at the end of the installation process – “Failed to save page: Scene Discovery.”

I checked the logs in IDE and the only error message I see (multiple times) is:

0c51f42f-b5a7-4f66-bdb7-f9ba6c45b4c9 8:02:01 AM: error java.lang.StringIndexOutOfBoundsException: String index out of range: 248 @ line 771

On another failed attempt to install the app, I saw the following error message:

8901d2fc-7b53-4b6b-8374-e4197d648024 7:59:35 AM: error java.lang.ArrayIndexOutOfBoundsException

By the way, I deleted all scenes from the bridge just in case one the scenes was causing a problem.

Any thoughts?

Thanks,
Rob

Is anyone using this with Friends of Hue products (i.e. Lightstrips, Hue Go, etc.)? With the standard SmartThings device type, the colors of the Friends of Hue products don’t match the colors of the regular hue bulbs when set with the same HSB using setColor. Just wondering if this has the same issue before I spend the time removing everything and switching it over. Thanks!

1 Like

It will have the same problem because they will use the same devicetype. It’s not an easy problem to solve because the regular bulbs can’t reproduce the same gamut of colors as the Friends of Hue products; but the first step would be a different devicetype for regular bulbs and other Hue products that use the wider color gamut.

Hue gets around this by mainly using the x,y coordinates for sending color to the bulbs, so they will always match unless the selection is outside the range that the bulbs can produce and in that case the x,y automatically selects the closest match.

The hue/saturation combo that ST uses is much easier to implement across multiple products and particularly when a color wheel selector isn’t available; but it relies on calibration at the devicetype level and there isn’t a reference for that calibration.

2 Likes

@claytonjn I’m just personally using the standard 3 pack hue color bulbs that came in the hub deal, so nothing really extravagant yet. Most of my devices are just zwave at this point so the “branching out” is all brand new :wink:

I’m also having the exact same problem. I get the “Scene Discover” error message. I tried uninstalling the SmartApp and Device Handlers and then reinstalling, but still got the same error. I’m wondering if we have to hard reset the Hue Hub. I don’t really want to do this though because it will delete all of the scenes and I’ll have an angry wife if I do this (it took months to get Hue to an acceptable WAF and I’m finally there).

1 Like