otaviojr / node-red-contrib-smartthings

Allows you to control your devices and get their status using NodeRed
MIT License
32 stars 16 forks source link

Problem parsing color #88

Open palsbo opened 2 years ago

palsbo commented 2 years ago

I try to chage color on a RGB light bulb (color node). When reading from the node, it says "deviceType: 'color', value: array[3]. I try to inject msg.payload={"value":[200,0,0]} msg.topic = color but get an error "Error updating device" I can change the switch, the level and the temperature with no problem, but the color fails. Wat am I doing wrong?

dangruhn commented 3 weeks ago

I have the same problem. Bumping this to see if we can get a response

johnwalicki commented 3 days ago

I looked into why the node-red-contrib-smartthings Color Light node smartthings-color.js does not work correctly. I see that @otaviojr implemented a rgbToHsl() function that is incorrect. I updated the code to another implementation. That function returns the correct Hue, Saturation, Lightness values.

Unfortunately my LIFX color light bulb still doesn't work as expected through the SmartThings API calls.

I've been using the smartthings CLI to test and also implement it in the Node-RED node.js code.

I changed the smartthings-color.js from sending multiple SmartThings API commands with distinct calls. Here's the CLI commands:

smartthings devices:commands xxxx-xxxx-xxxx-xxxx 'main:colorControl:setHue(68)'
smartthings devices:commands xxxx-xxxx-xxxx-xxxx 'main:colorControl:setSaturation(81)'
smartthings devices:commands xxxx-xxxx-xxxx-xxxx 'main:switchLevel:setLevel(50)'

to single call to setColor()

smartthings devices:commands xxxx-xxxx-xxxx-xxxx 'main:colorControl:setColor({"saturation":81,"hue":68})'

which has no discernible affect.

I just don't think Third Party API connector calls are working as expect through the SmartThings integration. Some conversation here