Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RGB <-> HSL conversion for lightbulb service #78

Closed
hobbyquaker opened this issue Feb 12, 2018 · 4 comments
Closed

RGB <-> HSL conversion for lightbulb service #78

hobbyquaker opened this issue Feb 12, 2018 · 4 comments

Comments

@hobbyquaker
Copy link
Owner

No description provided.

@kevinshane
Copy link

Hi sir, could u please explain what's the correct payloads for the statusRGB and setRGB topic? Does it reads a hex color code like #EBD7B8 or just a array of rgb(0-255)value? I try to filled in EBD7B8FF for the statusRGB topic, it appears obviously not work.

also please consider converting the hex8 value (eg. EBD7B8FF=RRGGBBWW) inside homekit2mqtt cuz this is what tasmota prefer, and somehow many of us are using sonoff devices with tasmota.

Currently it still needs extra work in node-red to convert the mqtt topic payload to make homekit2mqtt happy.

Thanks sir

@hobbyquaker hobbyquaker reopened this Feb 27, 2018
@hobbyquaker
Copy link
Owner Author

hobbyquaker commented Mar 6, 2018

Currently it should work with a string containing a 6 digit hex value for RGB (no #) prefixed with #. This works in my tests. I must admit that I don't know what to do with your 4th tuple ("WW") as RGB already contains the Brightness information (e.g. #FFFFFF is white at full brightness and #777777 is white at 50% brightness). Will do some more testing as soon as I find time.

@pottenmak
Copy link

I thing is better to include the # in the value, otherwise typeGuess will do a parseFloat for a hex value without letters (ex. 001180 -> float 1180) resulting in a TypeError

TypeError: val.substr is not a function
at val (/sites/homekit2mqtt/services/Lightbulb.js:31:40)
at mqttCallbacks.(anonymous function).forEach.obj (/sites/homekit2mqtt/index.js:286:21)
at Array.forEach ()
at MqttClient.mqtt.on (/sites/homekit2mqtt/index.js:282:34)
at emitThree (events.js:136:13)
at MqttClient.emit (events.js:217:7)
at MqttClient._handlePublish (/sites/homekit2mqtt/node_modules/mqtt/lib/client.js:935:12)
at MqttClient._handlePacket (/sites/homekit2mqtt/node_modules/mqtt/lib/client.js:305:12)
at work (/sites/homekit2mqtt/node_modules/mqtt/lib/client.js:261:12)
at _combinedTickCallback (internal/process/next_tick.js:131:7)

@hobbyquaker
Copy link
Owner Author

Oh yes, thanks for pointing that out. Added the '#'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants