BobRak / OpenHAB-Smartthings

53 stars 54 forks source link

Can't figure out how to set color with colorControl #66

Closed adobito closed 5 years ago

adobito commented 5 years ago

I'm trying to set color using color control. I looked at the code for [OpenHabAppV2.groovy method actionColor](https://github.com/BobRak/OpenHAB- Smartthings/blob/e04bd4648dde8fcc8244a17169a4003638b0e547/org.openhab.binding.smartthings/src/main/smartthings/SmartApps/OpenHabAppV2.groovy#L789-L802) and it seems to take an array of hue first value and saturation second value. Below is my configuration to try and do this and get it to Red (I looked up the Hue and Saturation for Red online but it might be wrong).

Thing:

Thing colorControl SengledColor01ColorControl  [ smartthingsName="Sengled Element Color Plus 01"]

Item:

String SengledColor01ColorControl "Bedroom Lights 01 Color Control" <colorpicker>  { channel="smartthings:colorControl:Home:SengledColor01ColorControl:color" }

Sitemap:

Switch item=SengledColor01ColorControl mappings=["[50,100]"="Red"]

When I press the button on the sitemap I get this in the logs:

2019-03-16 00:52:43.484 [ome.event.ItemCommandEvent] - Item 'SengledColor01ColorControl' received command [50,100]

2019-03-16 00:52:43.494 [nt.ItemStatePredictedEvent] - SengledColor01ColorControl predicted to become [50,100]

Usually when the command is invalid it will just say it predicts it to go to NULL, so I think this might be a valid command but not sure why it isn't working.

Any help in figuring this out would be greatly appreciated.

BobRak commented 5 years ago

Jesus @jluzonpr I'm trying to work up a good sample for a color bulb. I'll let you know when I have something. It has been a while since I played with this so it has been slow going. Bob

BobRak commented 5 years ago

Hi Jesus @jluzonpr I just deployed a new set of files to my repo that includes updated handling of the RGB bulb. I recently discovered the Smartthings defines the hue as a 0-0100 range but openHAB uses the industry standard range of 0-360. I also bought a Sengled bulb to test with. You will need to download a new org.openhab.binding.smartthings-2.5.0-SNAPSHOT.jar and the Smartthings code file. The Smartthings files have moved. Please be sure to read the updated installation instructions. Also the README.md now includes sample configuration entries for the RGB bulb.

adobito commented 5 years ago

Thanks! I got 2 more bulbs and I'll do the check once I install them and report back.