mycroft-hue icon indicating copy to clipboard operation
mycroft-hue copied to clipboard

Does not react to requests to set colors

Open dvpfig opened this issue 6 years ago • 6 comments

Hi,

The skill works like a charm to turn lights on and off. And dim up and down. Also setting scenes work but not to setting colors. Is there a way to set the color e.g. to red or green or blue via a command?

dvpfig avatar May 26 '18 23:05 dvpfig

Hey @dvpfig,

This has not been implemented yet, however, there's no reason it can't be added. There are a few other things I need to implement first, but, I'll add this to the list, and see if I can get it knocked out (note that if you're a developer, you should feel free to make a pull request at any time).

Best,

Chris

ChristopherRogers1991 avatar May 26 '18 23:05 ChristopherRogers1991

thanks for the prompt reply. have been ages from my last proper program, so I will take some time to understand how this is done and how the skills work. I will give it a look but don't wait for it. this was a question on whether the function was in the skill. Now I know it is in the To Do List :)

Well done.

Daniel

dvpfig avatar May 27 '18 00:05 dvpfig

Going to reopen this, so I've got a place to track the feature request.

For what it's worth, the hard part of this is not the code, but rather getting a list of color names and the hue/saturation (or CIE x/y) values necessary to produce the color (see the "Color gets more complicated" section of https://developers.meethue.com/documentation/core-concepts). If there's any chance you can produce a list of those (or at least a starter set, that contains some of the colors you'd like to have, which could be expanded over time), that would go a long way.

Either way, the lists on Wikipedia (e.g. https://en.wikipedia.org/wiki/List_of_colors:_A%E2%80%93F) may be a good starting point. I think the hue/saturation degrees and percentages they provide could be converted into the values needed by the Hue lights, and assuming that is correct, the task largely becomes finding appropriate colors from that list. If left to me, I expect that's where I'll start.

Best,

Chris

ChristopherRogers1991 avatar Jun 09 '18 13:06 ChristopherRogers1991

There's some functions here to turn hex codes and rgb values into hue approximations (I think it actually varies slightly by bulb type but don't nec need to go that far.)

https://github.com/bjohnso5/hue-hacking/blob/master/src/colors.js

There's a bunch of dicts online that have named colors and their hex values and/or rgb values, could just load that in and do the conversion

estiens avatar Jun 11 '18 02:06 estiens

Hi,

I experimented a bit to allow color changes of the lights (https://github.com/alueck/mycroft-hue/commit/5d5ecaca4c5453141fad8f6da374bb3fa54b05dc). I ran into some issues, that I would like to discuss:

  1. Done in https://github.com/alueck/mycroft-hue/commit/4580bf6af2904f094ae36a17a10345c29c835d74 ~~I added a field "color_mappings" to the settings for which a JSON string like "{ "red": [255,0,0], "green": [0,255,0] }" is expected. I would rather have this in a separate file, because it would be easier to read and you could support multiple languages by creating multipe files. I did try it with a separate file in the directory, where the __init__.py is located, but the file was not found on the read attempt.~~

  2. ~~The change_color_intent is currently missing the line .require("Color") and the handler currently does a hardcoded change to red (must exist in the "color_mappings" string in the settings.json). I register the colors similarily to the scenes and groups, but if I add the .require("Color"), the intent is not found if I, for example, send "light color red" in the Mycroft CLI. If I leave this line out and just send "light color" to the Mycroft CLI, the intent is recognized and the hardcoded change to red is done.~~

I would appreciate some help with this issues @ChristopherRogers1991 and any other people that might have some more knowledge about Mycroft or Python.

alueck avatar Aug 23 '18 17:08 alueck

I got it actually working now on my branch https://github.com/alueck/mycroft-hue/tree/feature/change-color

Now I just need more color definitions and I would like to reduce the redundancy in having to define the rgb values for each language. Gonna work a little bit on it and then probably open a pull request.

alueck avatar Aug 24 '18 08:08 alueck