Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Set LIFX colour to 2700K
Set LIFX colour to 2700K
Hi,
I'm using this plugin and it works great:
https://github.com/marcushultman/eventghost-lifx
Does anybody know how to set the colour to 2700K. So I will have a natural light colour?
I'm using this plugin and it works great:
https://github.com/marcushultman/eventghost-lifx
Does anybody know how to set the colour to 2700K. So I will have a natural light colour?
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Set LIFX colour to 2700K
I have edited the plugin to allow for the computation from kelvin to RGB.
the place where this is set is in the Set State action. so basically when you are turning it on then you can set the kelvin to a desired color
when doing this it will automatically change the color chooser to that color, and when deselected the color chooser will revert back to the original color it was set to
file is attached to this post
Have Fun
K
the place where this is set is in the Set State action. so basically when you are turning it on then you can set the kelvin to a desired color
when doing this it will automatically change the color chooser to that color, and when deselected the color chooser will revert back to the original color it was set to
file is attached to this post
Have Fun
K
Re: Set LIFX colour to 2700K
Thanks for helping.kgschlosser wrote:I have edited the plugin to allow for the computation from kelvin to RGB.
the place where this is set is in the Set State action. so basically when you are turning it on then you can set the kelvin to a desired color
when doing this it will automatically change the color chooser to that color, and when deselected the color chooser will revert back to the original color it was set to
file is attached to this post
Have Fun
K
The calculation from kelvin to colour seems to be working. Unfortunately the plugin doesn't communicate with the lights anymore. So I can't switch it on or off, set colour etc.
Can you look at the code?
Thank you
Re: Set LIFX colour to 2700K
Also found this:
https://api.developer.lifx.com/v1/docs/colors
I use these with a tasker plugin. And this works great. Maybe this can be implemented?
https://api.developer.lifx.com/v1/docs/colors
I use these with a tasker plugin. And this works great. Maybe this can be implemented?
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Set LIFX colour to 2700K
i don't have the LIFX lights at all, but i did notice my error last night when i was looking at the code and i happened to notice where my error was. i believe i have fixed it. i have not tested this code to see if it even will load in EG. so let me check that and see how it goes to make sure it compiles properly. and then i will post it up for you.CypherMK wrote:
Thanks for helping.
The calculation from kelvin to colour seems to be working. Unfortunately the plugin doesn't communicate with the lights anymore. So I can't switch it on or off, set colour etc.
Can you look at the code?
Thank you
CypherMK wrote:Also found this:
https://api.developer.lifx.com/v1/docs/colors
I use these with a tasker plugin. And this works great. Maybe this can be implemented?
i will take a look see after i make sure the first is all set. one thing at a time to get working properly
K
Re: Set LIFX colour to 2700K
Thank you for being so helpful!kgschlosser wrote:i don't have the LIFX lights at all, but i did notice my error last night when i was looking at the code and i happened to notice where my error was. i believe i have fixed it. i have not tested this code to see if it even will load in EG. so let me check that and see how it goes to make sure it compiles properly. and then i will post it up for you.CypherMK wrote:
Thanks for helping.
The calculation from kelvin to colour seems to be working. Unfortunately the plugin doesn't communicate with the lights anymore. So I can't switch it on or off, set colour etc.
Can you look at the code?
Thank you
CypherMK wrote:Also found this:
https://api.developer.lifx.com/v1/docs/colors
I use these with a tasker plugin. And this works great. Maybe this can be implemented?
i will take a look see after i make sure the first is all set. one thing at a time to get working properly
K
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Set LIFX colour to 2700K
Hey no worries, this is a learning thing for me so it's a lot of fun.CypherMK wrote: Thank you for being so helpful!
I redid the config panels for each of the actions, and i added the kelvin calculation to every possible color selection point.
i modified how the config panels were calling the color chooser in order to make the check boxes work properly and reduce the amount of code needed to work
i have them all sharing common code as not to repeat or as little as possible anyways
but if the check box for the color is grayed out that means that it is a required item
and i also have it gray out the kelvin entry field if the color is selected.
sorry this has taken a little bit but i was reading up on color conversions. and there is no way to convert RGB to kelvin because the kelvin spectrum doesn't contain but a small fiew of the color spectrum. and to generate a list of the ones that are the list would be huge 25,300 items
it could be done through computation but it would have to systematically go through each of the different items and see if it matches the one RGB that you have selected. I am curious to know how ling that would take to do. the list would only have to be compiled at dialog creation.
i might tinker around with it
but attached is the updated code. let me know if it works or if you get an error
if an error
select the line just before the error
hold down the left shift
select the line after the error
release the shift
press and hold the ctrl key
tap c
that will copy the log items
then just paste them into a forum post.
or a screen shot.
have EventGost as the foremost window (in focus)
press and hold alt and then tap the print screen button
then go into you favorite image editor and paste the contents of the clipboard
save the file
and attach it into the post
place it inline to the forum post please
(sorry if you already know the information above, I have had people ask how they do those things above so it's just easier and skips a couple of extra posts if i just come out with it.)
have fun and let me know if it works
K
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Set LIFX colour to 2700K
ok here goes, it will now also do a reverse lookup
if the color selected is not kelvin it will put a 0 in the kelvin field and highlight it red indicating an improper number
now this is a lot of computing to do but doesn't make a sizeable impact on ram. in noticeable at all. it's only 4 bits of data per color so do the math, it's less than 7 k of memory usage
but.....
there is always a kicker
it has to iterate through all 25,300 possible choices.
this takes about 300 milliseconds on my machine so there is an ever so slight pause.
i didn't like this pause when loading the dialogs so i decided to plop it into the start of the plugin. so depending on the ago of the machine there will be a pause upon loading EventGhost
this will only happen if the plugin is installed
but i thought it a nice enough feature to have it take the split second to do this.
if not wanted, use the version posted above
K
if the color selected is not kelvin it will put a 0 in the kelvin field and highlight it red indicating an improper number
now this is a lot of computing to do but doesn't make a sizeable impact on ram. in noticeable at all. it's only 4 bits of data per color so do the math, it's less than 7 k of memory usage
but.....
there is always a kicker
it has to iterate through all 25,300 possible choices.
this takes about 300 milliseconds on my machine so there is an ever so slight pause.
i didn't like this pause when loading the dialogs so i decided to plop it into the start of the plugin. so depending on the ago of the machine there will be a pause upon loading EventGhost
this will only happen if the plugin is installed
but i thought it a nice enough feature to have it take the split second to do this.
if not wanted, use the version posted above
K
- Attachments
-
- __init__.py
- (15.01 KiB) Downloaded 147 times
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Set LIFX colour to 2700K
well reading that documentation on the hue and saturation thing made me realize the plugin currently made is not the best way.
it uses the http api from lifx. and from what i have read could be slow in doing things.
and there is also a whole lot more things that can be added.
but in order to make this thing a ful plugin for eventghost is going to require me having to go and get a couple of these bulbs. and at 60 beans a piece that's kinda steep for me at the moment.
for instance. i now know that i can set the kelvin directly instead of doing an RGB conversion like i altered that plugin to do.
and the plugin is very cryptic. and hard to follow. and rewriting the thing i feel would be simpler. but that being said rewriting it in the http api would be simpler but you would lose a lot of features. maybe in the future and i am not doing so many things on my own home i will pick up a couple of bulbs and play around and get a plugin going that uses the lan protocol. but trying to write one without having the device here is not something i want to try to do. i would lose track of where i am waiting for forum responses
there are quite a few python libraries for the lifx bulbs might be able to use one with eventghost but they all do alot of importing of other libraries and i would have to check and see what is already built into the core of eventghost and if not is there something i could substitute it for without having to modify the library in huge amounts. but then it comes down to the ability to test.
i would love to help but wife would kill me if i spent more money one this home automation thing and really flip if i spent 60 on a single light bulb
K
it uses the http api from lifx. and from what i have read could be slow in doing things.
and there is also a whole lot more things that can be added.
but in order to make this thing a ful plugin for eventghost is going to require me having to go and get a couple of these bulbs. and at 60 beans a piece that's kinda steep for me at the moment.
for instance. i now know that i can set the kelvin directly instead of doing an RGB conversion like i altered that plugin to do.
and the plugin is very cryptic. and hard to follow. and rewriting the thing i feel would be simpler. but that being said rewriting it in the http api would be simpler but you would lose a lot of features. maybe in the future and i am not doing so many things on my own home i will pick up a couple of bulbs and play around and get a plugin going that uses the lan protocol. but trying to write one without having the device here is not something i want to try to do. i would lose track of where i am waiting for forum responses
there are quite a few python libraries for the lifx bulbs might be able to use one with eventghost but they all do alot of importing of other libraries and i would have to check and see what is already built into the core of eventghost and if not is there something i could substitute it for without having to modify the library in huge amounts. but then it comes down to the ability to test.
i would love to help but wife would kill me if i spent more money one this home automation thing and really flip if i spent 60 on a single light bulb
K
Re: Set LIFX colour to 2700K
That was a lot of text
I got my bulb for only Ôé¼30 +Ôé¼6 shipping. It was a steal. Not available anymore unfortunately.
I will try the scripts this evening (if the wife let's me). I will let you know.
And maybe I can write a small python script with this info:
https://api.developer.lifx.com/v1/docs/colors
Never to old to learn python. I only need my lamp to be at 2700 kelvin at 50% brightness.
I got my bulb for only Ôé¼30 +Ôé¼6 shipping. It was a steal. Not available anymore unfortunately.
I will try the scripts this evening (if the wife let's me). I will let you know.
And maybe I can write a small python script with this info:
https://api.developer.lifx.com/v1/docs/colors
Never to old to learn python. I only need my lamp to be at 2700 kelvin at 50% brightness.
Re: Set LIFX colour to 2700K
I checked the script above, but it doesn't work. The lights aren't responding when I press test. Eventghost doesn't give any error, only that the event is being executed.
Re: Set LIFX colour to 2700K
Found my solution. With the help of the lifx site.
If anyone wants to use this, you have to edit the attached file and put in a token which can be made on this site: https://cloud.lifx.com/
You have to sign in and create a token by clicking on your email, and then settings.
And on this page :https://api.developer.lifx.com/v1/docs/colors, you can use various settings.
If anyone wants to use this, you have to edit the attached file and put in a token which can be made on this site: https://cloud.lifx.com/
You have to sign in and create a token by clicking on your email, and then settings.
And on this page :https://api.developer.lifx.com/v1/docs/colors, you can use various settings.
- Attachments
-
- lifx eventghost.py
- (297 Bytes) Downloaded 112 times
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Set LIFX colour to 2700K
sorry about that boss. gave it a shot. i might still tinker with the plugin if you are still willing to test. now that i know how to send the HTTP command for kelvin without having to do a conversion. i am thinking about making that thing easier to understand like the one you just posted for sending the kelvin. the other goes through all that mess to do the same exact command. why the original programmer didn't use a python dictionary is beyond me because that is exactly how the http api for the lifx is. to the T.
this is a python dictionary
the http api uses JSON and it's so similar to a python dict.
it was done in such an odd way with wrapping a class in a class in a class instead of just making singular actions there is technically only one action in that plugin and they all dump into it and because of how eg is coded to base64 encode the plugin data into an xml file it can't use dictionary arguments as storage and save it to the xml. so the coder used a list with formatting a payload to index the list. it's just goofy
the coder should have just made all singular actions and had the actions call a central place in the plugin to fire off the command. well that's what i would have done.
and from my understanding there are responses from the http api i would also like to add into the plugin that way you can trigger other actions to take place from those events. but i do not know if the connection can remain open or if it's just a response and that's it. i will have to do more reading.
this is a python dictionary
Code: Select all
{
'key1': 'message',
'key2': 12345
}
it was done in such an odd way with wrapping a class in a class in a class instead of just making singular actions there is technically only one action in that plugin and they all dump into it and because of how eg is coded to base64 encode the plugin data into an xml file it can't use dictionary arguments as storage and save it to the xml. so the coder used a list with formatting a payload to index the list. it's just goofy
the coder should have just made all singular actions and had the actions call a central place in the plugin to fire off the command. well that's what i would have done.
and from my understanding there are responses from the http api i would also like to add into the plugin that way you can trigger other actions to take place from those events. but i do not know if the connection can remain open or if it's just a response and that's it. i will have to do more reading.
Re: Set LIFX colour to 2700K
I am willing to test, if you make a new plugin. Let me know.
