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

I had the same problems that i saw everyone had in the thread above and fixed them. Here is what you need to do. If you can not get your lights to respond after installing then change code at line 1106 so that it looks like this:

/** def bodyJSON = new groovy.json.JsonBuilder(body).toString()
def length = bodyJSON.getBytes().size().toString()
/
log.debug "PUT: $uri"
log.debug “BODY: ${body}”
/
* log.debug “BODY: ${bodyJSON}”

sendHubCommand(new physicalgraph.device.HubAction("""PUT $uri HTTP/1.1

HOST: ${selectedHue}
Content-Length: ${length}
${bodyJSON}
""", physicalgraph.device.Protocol.LAN, “${selectedHue}”))
*/

sendHubCommand(new physicalgraph.device.HubAction([
method: “PUT”,
path: uri,
headers: [
HOST: selectedHue
],
body: body], “${selectedHue}”))

If you are having problems with the scene discover error it is because line 485 should look like this:

			d = addChildDevice("info_fiend", "AP Hue Group", dni, newHueGroup?.value.hub, ["label":newHueGroup?.value.name, "groupID":newHueGroup?.value.id])

The reason it works for other people is because they installed the zpriddy device handlers in the past so it would be picking up his device handler and not the one we just installed.

1 Like

I was sure hopeful this would be the fix for me, but unfortunately, still same issue. Changed line (close to 485) and I definitely had the old code there, but updated, published “for me” and still same result. When changing color on any hue bulb, turns it off, then I have to use dimmer slider to bring it back. I’m still hopeful though.

Is it possible maybe I should use different device handlers? Not sure why that occurred to me, but doesn’t smartthings already have their hue handlers?

They do, and it is very reliable, but it doesn’t provide access to scenes.

Well, I sure do love the scenes and I guess if I create a scene with the colors I want, there’s not a whole lot of use for the color wheel, except maybe to show your guests “hey, look what I can do!” So in all reality, this isn’t a huge issue to me. The hard work on implementing the scenes make this completely worth while so I’ll just stick with this for sure :wink:

All -

Sorry for the delay in addressing this. I’ve made an update in the GitHub repo to the device types and to the Connect Smartapp.

This update fixes the color wheel issues (you need to update the device types) and should fix any lingering problems with the installation process.

Also - I’ve added the a new command called “setToGroup()” - for use with Rule Machine. This command has a single parameter (a number) that corresponds with group numbers. So if you set a scene for the entire house, but only want to apply that scene to group #2, then create a custom command in rule machine for the switch [name of scene] using parameter [name of group].

Let me know if you guys have any other problems.

-Tony

1 Like

In addition to the “setToGroup” function, there is also an “updateScene” function. You can use it to update your existing scenes.

It’s currently accessible via Rule Machine or programmably - I will add it to the Scene device type soon.

I have the solution that is perfect for me now. It wouldn’t have worked for me without Smartthings.

It’s super fast and doesn’t even drop lights in the Hue Scene changes. I have changed the direct calling interface to all connected devices to Simple Control. It controls my Hue Scenes that include 38 hue lights. Also my 11 Lutron switches and lamp dimmers which are not supported by smart things. It also controls all my electronics. Blasters allow me to turn off and on the 2 TVs and 1 receiver that doesn’t support IP toggle on. Simple Control interface to Echo doesn’t work properly and requires way too many words because it’s supported as a skill that keeps crashing on me. So Smartthings fixes not only that problem but adds tons of rule based home automation.

Here’s what it looks like for voice activated scene changes:

Amazon Alexa talks to Smart Things Switch, Simple Control trigger runs when the ST switch is turned on to call Simple control scene that calls Hue and Lutron lights at the same time.

I setup 1 virtual switch setup per scene in Smartthings. I have 1 rule running in rule engine that looks for a switch to be triggered and turns them all off so I can call them back to back without issues.

I have setup smartthings virtual presence sensors that require one of many to be present in order to trigger mode changes on entry. Mode changes on entry calls Simple control scenes depending on rules in Smartthings.

My system so far has:

SmartThings Hub - 2 outlets, 1 GE fan control, 3 Open Close Sensors(1 for Rubix Cube app that changes colors for all hue lights, 2 motion detectors
Hue Bridge - 38 connected Hue lights
Lutron Caseta Bridge - 4 in wall dimmer switches, 7 Dimmers
Simple Control - 2 Televisions, 2 Apple TVs, 2 Receivers, Cable Box, iPad acts as always on remote watching for iPhone sensor (can trigger presence via toggle switch)
Nest, Nest Camera
Amazon Echo (With 2 dots on the way) I feel like Alexa is my new wife and I have two children on the way…lol. No time for dating when setting all this up.
Apple Watch

On my computer required applications:
Airfoil - in order to get the receivers linked via my computer and input sources. It supported synced streaming either through Airplay to receivers or connecting to apple TVs directly.
Simple Sync - for the Simple Controls. It links my remotes and saves my configurations.
Chroma - for computer interface for Hue lights (I tested all the apps and this is the best one)
ObyThing Music - So that SmartThings can call my computer and play messages through my receivers.

iPhone Applications that are necessary:
SmartThings
Simple Control
HueMote
LumiFi
Hue
IF
Lutron
BeaconThings (For my future Beacons coming in the mail)

Necessary SmartThings Apps:
Hue Lights and groups and Scenes (Oh My!) Of course. I just use it for the groups though and a few individual lights.
Echo (Maybe Alexa Helper- I haven’t had to use it yet)
Change Nest Mode
Everyone’s Presence
Hello Home Cube (It lets me call a routine per side and just control all lights rather than figuring out the color saturation also I can call voice messages through ObyThing which is cool)
ObyThing Music Apps
Pollster
Rule
Rule Machine (A necessity)
Simple Sync Connect
Simple Sync Trigger

Really the hardest part of the entire process was setting up hue scenes with 38 lights. I used the iPhone app lumifi to connect to all my hue lights and it gives examples for 9 different really good scenes that it setups up for you out of the box. I really used it as an idea generator for scenes. Then I needed to change the lights based on Groups which isn’t supported in lumifi. You have to be able to match the light color of the similar strips, etc and you can’t due that by just looking at one screen and moving into the next light. They have to be controlled together. I used Huemote on the iPhone or Chroma on the Mac to make changes to grouped lights. Both support groups really well and allow for fast editing of the lights. (Hue app doesn’t support groups and if you try to use hue groups in the app in your scenes to make changes you will pull your hair out. They aren’t labeled and lights just randomly pop in an out of the groups). After I was happy with the changes. Then I opened the Hue app and navigated to Lights Then in the top right clicked create and saved it as a scene.

Then here’s where it gets a little messy. Hue doesn’t delete Scenes. So if you aren’t perfect in the first try on your scene creation and make a change in the hue app and save the scene again it will show up in the scenes list twice. After you delete it in the hue app it isn’t deleted on the bridge. This is really terrible programming on Hue’s part. But they have finally opened it up in the api and you can delete it through the API to keep everything clean for you really really easily. Here’s how:

Get an User ID for the Hue API Debug tool. http://www.developers.meethue.com/documentation/getting-started
Once you have followed the directions above to get a userid connected to the hue bridge:

In the URL put:
/api/(Your Username here from above)/scenes/

Call Get command.
Look for the scene you want to delete. The ID is the first entry.
In the URL put:
/api/(Your Username here from above)/scenes/(ID from the scene you want to delete)
Click delete.

You are all set and you’ve cleaned up your scenes.

3 Likes

Can this be setup for Github updates for easier updates?

Thank you!

FAQ: Github Integration How to Add and Update from Repositories:

It is already on github. Just follow the instructions in your post.

I get error “GitHub repository infofiend/SmartThingsPublic not found” when trying to add it.

Wow, really impressed with this. I don’t know if I’m missing something but the idea of Groups is brand new to me - pretty sure the Android Hue app doesn’t support Groups, or if it does it’s really well hidden (not surprising given the carcrash nature of that app’s UX…). So I installed Hue Pro which was really easy to use to set up Groups.

So I took the big brave step of unhooking all my Hue lights (which is only 8, peanuts compared to some of the setups on here) from SmartThings and RuleMachine, and adding again via this app. Perfect! Groups makes a lot of my rules much easier, for example I’ve got three GU10s in a single fitting in my kitchen and it just reads better to turn “kitchen group” on rather than three individual lights. So thanks for making it work so well, first time.

One question - transition time. I see that in my bulb devices in ST, each of them has a transition time. And using bulbs set up through Oh My!, when I turn off a lamp it fades out, which is new. Using the Hue device types they used to fade really quickly, almost just on/off. However for some of my lamps it’s a bit slow - I’ve got a motion sensor on the stairs, so when I’ve got an early start the downstairs lights come on if I’m out on the landing. Except I can be most of the way down the stairs in the 4s it takes my stairs lights to fade up, kind of defeating the point.

So, is the transition time something Hue Pro has set up, or is it somewhere in this smartapp/devicetype?
Because I set up both almost at the same time, I don’t know which component introduced this feature.

The AP Hue Bulb and AP Hue Groups device types have the ability to make any change with or without a user-defined transition time. If not provided, the default transition time is 3 seconds.

If you wish to adjust this default transition time – and are using Rule Machine – you can create a custom command for the group / light for which you wish to adjust the default time. The parameters for the following commands are as follows:

on (transition time)
off (transition time)
setLevel (level, transition time)
setHue (hue, transition time)
setSaturation (saturation, transition time)

Important:

  1. Note that all of the above parameters should have a parameter type of “number”.
  2. The transition time parameter controls the number of seconds in which the change should occur. If you want immediate change, just set the transition time to 0.
  3. The level, hue, and saturation parameters can only be 1-100.
  4. The device will retain the transition time you set. So once you have the transition time the way you want it, you no longer need to use the custom command for that device (and can simply use RM’s stock actions).

Finally, with regard to

This function has actually been available in all Philips Hue lights for some time - if not from the beginning. All my code does is provide more access to the Philips Hue API than the default Hue (Connect) smartapp provides.

1 Like

I seem to be having a strange issue with linking my Hue bridge with this app. I have all five device handlers installed and published as well as the latest SmartApp but no matter what I get an Upgrade Needed error when I try to install this SmartApp. both my Hue bridge and my SmartThings hub are up to date. I can add my bridge and control my individual lights just fine with the stock Hue Connect SmartApp. I was having this issue previously as were many others in the thread linked below but ST pushed a code change and fixed that issue a few weeks back.

Hmm. That error should have been fixed by the update SmartThings pushed through about 2 weeks ago.

There’s a simple workaround - near the very end of the smartapp, replace the line:

return hasAllHubsOver(“000.011.00603”)

With:

return true

Also - the “failed to save scene” Error was probably caused by you installing more than 20 devices (bulbs & groups & scenes) at once. Try installing fewer when installing and then add the rest after installed.

Thanks! That modification got me up and running. Quick question regarding scenes if you don’t mind. I have quite a few that show up in the search lots of what is possibly duplicates? At least they are not in ,my Hue app. I have 19 scenes in my Hue app but I have over 40 in this SmartApp. Multiple that start with the same scene name and state either off or and followed by a long string of numbers. Any suggestions?

Thanks again!

I couldn’t find any other appropriate place for this so this hopefully will work. Any chance a color temperature slider could be added to the Hue Bulb device handler UI? I’ve found that color temperature seems to be similar for LIFX and Hue but colors (hue/saturation/etc) much less so. Thanks.

I’ll look into it. 20 characters.

Since you’re remarkably open to feedback, would you also consider making the transitiontime setting an editable preference of each light? Building it into the device’s preferences is a lot easier and straightforward way of changing transitiontime than using expert features of rule machine to change it.

Quick question, does anyone know if it’s normal for the AP Hue Bridge device to flood the activity feed? First day I left for work and came home that evening my feed is flooded with dozens, possibly hundreds of messages every few minutes regarding scene and bulb lists.

Looks like color temperature on the Hue bulbs will be a PITA. I didn’t realize it wasn’t implemented like on the LIFX. I tried all variations of the Hue device handlers (yours, another similiar project, the zigbee Hue bulb, and the stock one) and none of them have color temperature capability. Mapping the temperatures into hue/saturation/value could be a project for a PhD student! I think I will have to select the temperatures I like with a LIFX, place a Hue beside it and match the color with the color wheel as best as I can and take note of the HSV. I will then have a custom SmartApp set the colour temperatures based on a schedule. No easy way of doing it with Rule Machine that won’t require literally hundreds of rules as I have over ten 7 button scene controllers in my house.