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

Help Needed! How to convert Lightbulb setHue payload? #65

Closed
kevinshane opened this issue Feb 5, 2018 · 8 comments
Closed

Help Needed! How to convert Lightbulb setHue payload? #65

kevinshane opened this issue Feb 5, 2018 · 8 comments

Comments

@kevinshane
Copy link

Hi, I have an ailight smart lightbulb already setup and working, however the ailight is using tasmota and the color for mqtt payload is set to RRGGBBWW(string)
{"POWER":"ON","Dimmer":100,"Color":"FF9D30FF"
So how to convert this FF9D30FF string to let homekit2mqtt setHue topic to understand the current color?
Also could u please explain what exactly does the identify topic does? What do I need to put which topic to this one? Does it means just a device identify or a device with health info?
Also could u please enable current brightness payload and others like color paylaod? Right now it always go to topic, I have to "convert" the topic somehow using node-red to create a complete new topic with current brightness level payload.
Thanks man, again very awesome job!
Shane

@hjltu
Copy link

hjltu commented Feb 10, 2018

Hi, i made white color and rgb in separate groups
maybe this will help:
https://gist.github.com/hjltu/ba0d5e3eac36bcfc704328f406d7ea86

@hobbyquaker
Copy link
Owner

identify is just a little helper to identify an accessory when adding it in the home app. For e.g. a lamp it makes sense to let it blink a few times, so you know which lamp you are currently adding.

About converting RGB to HSL - there is a little bit of math necessary, see e.g. https://stackoverflow.com/questions/39118528/rgb-to-hsl-conversion

@hobbyquaker
Copy link
Owner

Hmm could you try to explain further what you mean with "enable current brightness payload and others like color payload"? You can already configure separate topics for Brightness, Hue, Saturation. You can also set factors to convert them to other value ranges.

@kevinshane
Copy link
Author

hey @hjltu thank you for providing the script, but I am totally a noob here, so how to run this? I am running homekit2mqtt inside a docker container, does it means I need to go inside the container and install python stuff to run this script?

@kevinshane
Copy link
Author

Hi @hobbyquaker, let me try to explain(as a noob of view)
Currently the sonoff tasmota is installed into the rgb light bulb, and tasmota is publishing mqtt msg as a json format when changing light state, such as turn on/off light and color changing. When I change color, it publish a msg like this(a single topic that contains several payloads(json objects) such as POWER, Dimmer)
{"POWER":"ON","Dimmer":100,"Color":"FF9D30FF"}
So as you can see that, a single topic will contains the current light info.

However homekit2mqtt is expecting seperated topic for those info(does it?)
setBrightness statusBrightness setHue statusHue setSaturation statusSaturation
So each topic will be several topic seperated and publish to mqtt server and expecting a single value for the payload(does it? or maybe I totally wrong?) such as statusBrightness is 100(in this case is the Dimmer value)

So in this case, I have to find a way to seperate the topic and make homekit2mqtt happy(understandable), because I think it can't understand{"POWER":"ON","Dimmer":100,"Color":"FF9D30FF"}(again I maybe totally wrong for this, please correct me)

So, I use node-red to get the mqtt topic from lightbulb and seperate those info and then re-publish as several new topics(each topic contains a single payload such as ON, 100, FF9D30FF), like this:
cmnd/ailight/POWER gets a ON(string)
cmnd/ailight/Dimmer gets a 100(number)
tele/ailight/HSB gets a FF9D30FF(string)

So, I would like to request a feature that homekit2mqtt can at least understand a single topic with json objects, or maybe somehow, I don't know how, can read RRGGBBWW value(FF9D30FF) from json object. or, let statusBrightness understand the Dimmer:100 is the current br-level, because the sonoff tasmota always publish a long topic contains many info.

and so sorry for the noob-kind-of-explain. I hope you understand what I trying to get. Thanks!

@hobbyquaker
Copy link
Owner

hobbyquaker commented Feb 12, 2018

However homekit2mqtt is expecting seperated topic for those info(does it?)

Yes, that's right.

So, I use node-red to get the mqtt topic from lightbulb and seperate those info and then re-publish as several new topics

Until now this is a needed workaround...

So, I would like to request a feature that homekit2mqtt can at least understand a single topic with json objects, or maybe somehow, I don't know how, can read RRGGBBWW value(FF9D30FF) from json object.

That is already on my todo :-) (#67, #78)

@hobbyquaker
Copy link
Owner

Will close this issue now, you can follow the above mentioned issues to keep an eye on the progress.

@hobbyquaker
Copy link
Owner

I Implemented RGB topics for LightBulb in v0.9.3
Let me know if that suites your needs.

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