API is easier, because you get a list of the 3 variables for each bulb at once. But I am looking for a better alternative, because both of them are pretty painful.
I added āCustom colorā to the color selections. Then you input the hex for the color and a saturation value; level is already there also. Please check this out and let me know if it works right. It appears to work. @Sticks18?
Github for Rule: https://github.com/bravenel/Rule-Trigger/blob/master/smartapps/bravenel/rule.src/rule.groovy
Iām at work so canāt test, but I think the color value should just be 0-100 like saturation since you pass it into the hue field of the color map.
The hex color value that you get from the color wheel combines hue and saturation into one by using 6 digits like #RRGGBB where RR is a two digit hex representation of the red concentration (0-255), same with GG for green and BB for blue. That could give you hexToInt conversions well over 100.
For individual hue and sat values, the wheel passes a value from 0-100 that gets converted by the individual deviceTypes based on what range the device accepts. For instance, the Hue bulbs do a 0-100 to 0-255 conversion for hue and saturation, then passes those values through the Hue API.
OK, I didnāt understand how this works. I will blow off the hex input, and just make the color a number.
Thanks!
I donāt know if this is useful information or not, but from the SmartThings Activity Feed, it looks like it can poll for 5 different types of value, but it doesnāt often poll for all 5.
They are:
Switch
Level
Hue
Saturation
Color
Yup, Bruceās SmartApp Family can do the first 4 with the latest enhancement, which is all you need to set a scene. Switch and Level are basic on/off and dim functions that non-color dimmers have and are handled in a different option of his app, but are available for color bulbs. Hue and saturation determine the bulb color, which is what he added for custom user input.
Color field is unnecessary for every color device Iāve seen so far. The main thing Color is used for is setting the position of the dot in the color wheel selection tile in the ST app. You can change the color of a bulb without this field and most SmartApps do. The only thing is youāll notice the next time you go into the color picker that the dot is in the center and not at the position of the current color of the bulb. Not a big deal.
Hey Bruce, thanks for adding the ācustomā color to the Rule. It works perfectly for what I wanted. You rock my friend! If you keep adding functions, my SmartApps tab will soon look like the āoldā new dashboard, one entry with a whole lot of white space around itā¦
@bravenel Another useful feature would be to have the app remember the last color and state the light was set to prior to the change. I have a few other lighting apps I use to do this currently. After an action set it back to the original color and state. I have a family member who is hard of hearing and I use light color as indicators throughout the house.
I just wanted to share the link here for a solution that has worked perfectly for me, since others may stumble upon my post here if they are facing a similar circumstance.