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

Add Color or Raw Info #327

Closed
zpriddy opened this issue Dec 25, 2016 · 31 comments
Closed

Add Color or Raw Info #327

zpriddy opened this issue Dec 25, 2016 · 31 comments
Assignees
Milestone

Comments

@zpriddy
Copy link

zpriddy commented Dec 25, 2016

I have been working on a home automation system and I am loving ha-bridge! However there is one thing that I am missing. Color info.

This shows when I am use a Google home and tell it to set the lights to green or any other color. Ideally I would like it to be Google home -> ha-bridge -> Firefly (my system) -> hue

Within firefly I have hue color support and would like to take advantage of that.. it would be nice if ha-bridge could support passing of that info or have a check box per device for 'raw request' -> this would be a nice way to get any info that is passed that can be used without much development overhead -> this could get appended to the body in JSON format.

Thanks

@bwssytems
Copy link
Owner

Can you treat your firefly like a philips hue bridge? When you use the hue passthru device option, the color is passed. Otherwise if the firefly does not use the hue api protocol we would have to build a connector.

@zpriddy
Copy link
Author

zpriddy commented Dec 27, 2016

I have already built a connector for it, at least from the firefly side, the issue that I am having it I also use firefly to pull the groups from the hue bridge as well as creating virtual groups..

Firefly doesn't use the hue api so the passthru doesn't work for that..

What I have done so far is ha-bridge runs not connected to hue, and firefly takes any device that is a switch or light and automatically adds those into ha-bride enabling voice control on them via ha-bridge.

@zpriddy
Copy link
Author

zpriddy commented Dec 27, 2016

This is the file that I am using for linking ha-bridge to firefly:
https://github.com/zpriddy/Firefly/blob/master/Firefly/core/api/ha_bridge.py

@bwssytems
Copy link
Owner

I would have to add new variables to be replaced, like how the brightness value is handled, to have this happen.

@zpriddy
Copy link
Author

zpriddy commented Dec 28, 2016

I feel like this would support many other projects as well.

I would be willing to take a look at it and what what I can do.. Its been a while since I have done Java but I should be fine.

Any chance you can point me at what files I would have to be working with?

@bwssytems
Copy link
Owner

This will be partly within the HueMulator class.

@bwssytems
Copy link
Owner

Take a look how ${intensity.percent} is handled.

@glyxkecks
Copy link

Also would like to see this feature.
I can send the color to my arduino controlling my LED stripe but I can't send a colour with HA Bridge. Only a fixed but it would be great if I can controll my LED as a RGB light.
Right now I send this command to switch it on:
udp:https://192.168.178.200:8888/0x040000FFFFFF

It would be great to do something like this:
udp:https://192.168.178.200:8888/0x040000${red.byte}${green.byte}${yellow.byte}

Thanks a lot!

@mysteryan
Copy link

I've been doing this for a while many versions ago. I simply just edited the default bulb type for HA-Bridge as a Extended Color Light instead of just a Dimmable Light. When a HA-Bridge device gets called, it polls the device state of the HA-Bridge "bulb" and I pass the values I need on through. There was a short time when HA-Bridge didnt save extended characteristics like color, but that has long since been resolved many versions ago.

I used simple curl and grep commands. Since it only polls as needed when device changes state, its instantaneos and seamless.

@glyxkecks
Copy link

That's great to hear! But where can I edit the default bulb type to Extended Color Light? Is it within the config files or on the GUI? Second question is how the variables are named to send the color to my RGB stripe within an udp call.

@mysteryan
Copy link

mysteryan commented Jan 4, 2017

Edit ha-bridge/src/main/java/com/bwssystems/HABridge/api/hue/DeviceResponse.java

Near the end, just change Dimmable light to Extended Color Light and change the bulb model from LWB004 to LCT004 (or any other bulb type depending on your project) right below it.

The rest just conforms to the hue api. Adjust the colors the same way. Pull the values using a scripts from http:https://ipaddress/api/username/lights/1
Then you just pass that value you just pulled into your call in any form you want. I think you can use curl for UDP calls too in your case.

This was referenced Mar 7, 2017
@bwssytems
Copy link
Owner

So, looking into RGB, the hue api uses CIE with just xy components don't have Z and don't have Y. Cannot get it to convert properly

@12christiaan
Copy link

12christiaan commented Apr 15, 2017

I love the HA bridge you made. looks really nice and lot of options. thanks. I was wondering how the color is going. can we expect the pull color out of the system soon?
If it is as easy as mentioned above (change Dimmable light to Extended Color Light) perhaps this can be added as a option in the device configuration. like adding a option to respond as a LWB004 or a LCT004.
Second step would be having the RGB value available as intensity currently is.

@digiltd
Copy link
Contributor

digiltd commented Apr 17, 2017

@bwssytems I was playing with a little custom Skill that allowed me to set colour by name. It isn't very polished but it does work as a concept.

Whilst the Skill itself won't be much use to you, it does contain the functions to convert HEX to RGB to XY. They are in javascript but the calculations would be the same in whatever the language.

@digiltd
Copy link
Contributor

digiltd commented Apr 17, 2017

It would help if I posted the link

https://github.com/digiltd/alexa-hue-colour-control

@bwssytems
Copy link
Owner

@digiltd Thanks, I'll take a look

@scargill
Copy link

I only have the .JAR file for Ha-Bridge in my installation - (Raspberry Pi) - is there any way to make use of colour commands without somehow getting the source and somehow compiling it?

@bwssytems
Copy link
Owner

Nope, you will have to wait until it is implemented. The link above is an example for me to do implement the color conversion calculation.

@scargill
Copy link

scargill commented Jun 26, 2017 via email

@mysteryan
Copy link

I don't understand why you guys don't pull the lights state value for color. After changing bulb type with one with color values, you can simply pull the state which includes the hue value (documented in hue api). Use that value and translate however you want and have it executing along your other commands you use it for.

@bwssytems
Copy link
Owner

So, suing the CIE color space uses we can do one for one as that is easy. If it needs to be translated, say to RGB, then that is different. Also, this is for fun and I am one person....

@scargill
Copy link

scargill commented Jun 27, 2017 via email

@mysteryan
Copy link

I thought color intents were available via skill only. Hence why its available to Hue bridge v2 that has a skills and why the round Hue bridge v1 that doesnt have a skill can't do color requests.

I know it bypasses the perks of local HA-Bridge, but a private skills that returns setColor, and setColorTemperature as available actions under discovery that pipes into your mqtt broker would satisfy your needs

@FloFoer
Copy link
Contributor

FloFoer commented Jul 17, 2017

I changed the bulb type, model id and everything. My Echo now displays my HA-Bridge devices as color lights, like real Philips Hue color lights.
However, if i try to set the color through a voice command like with real hue bulbs, alexa is telling me that my device doesn't support that.
Do you have an idea why that is? Do i have to change more than the stuff in DeviceResponse.java?
My device has just udp stuff in on/off/dim at this time, no hue passthroughs, if that's relevant.
The information i get from ha-bridge/api/.../lights/... is similar to the info from my real bulbs, except for name and uniqueid of course, and zeros in the color properties.

@bwssytems
Copy link
Owner

I have not implemented a way to get the color info to pass on yet.

@neil1111
Copy link

@FloFoer would you please post the changes you made to at least get to the point you are at?

I've also struggled with how Alexa is supposed to support colors (including such as warm white, cool white, etc.) natively now.
Thanks!
Neil

@FloFoer
Copy link
Contributor

FloFoer commented Jul 18, 2017

I did the thing mysteryan said above: changed the information in DeviceResponse.java like so:

response.setManufacturername("Philips"); 
response.setType("Extended color light");  
response.setModelid("LCT010");  
response.setSwversion("1.15.2_r19181");  
response.setSwconfigid("F921C859");  
response.setProductid("Philips-LCT010-1-A19ECLv4");  

Took the information from my real hue color bulbs. Now after a echo discovery the ha-bridge devices are color lights. But no color voice commands possible. Even if i proxy one of my real bulbs with ha-bridge.

@bwssytems I saw that you started implementing a CIE <> RGB conversion. So i thought you maybe already know why my echo keeps telling me color is not supported, because without the possibility to issue a color command to ha-bridge devices in the first place, the conversion would be very less useful.

I started playing around a little with the code, i implemented a rudimentary "colorUrl" additional to on/off/dim in editdevice and adjusted the huemulator/app.js accordingly. When i now try to change the color with the hue app my colorUrl gets executed. For that the conversion would be very useful. So it would work with the hue app but not with alexa.

Can it be that the echo still needs the hue skill for color commands and the ha-bridge doesn't work with the official skill?
I find it difficult to gather information about what must be there in order for alexa to allow color commands. She seems to decide during device discovery phase that my devices don't support color commands despite being tagged as color lights.

@bwssytems
Copy link
Owner

Sicne I have yet to really delve into this, I do not have any ideas on why Alexa will not communicate color yet. The ha-bridge does not have any interaction as a skill. It is based off of the Echo's ability to communicate locally with the hue bridge.

@FloFoer
Copy link
Contributor

FloFoer commented Jul 19, 2017

@bwssytems I have exams currently, but afterwards i will definitely look deeper into the whole color and milight/limitless thing myself, and some other stuff i'm not 100% satisfied with.

If i'll accomplish something interesting for others i would contribute it if wanted.

@FloFoer
Copy link
Contributor

FloFoer commented Jul 19, 2017

Got a statement from the hue developer support:

"Alexa commands (e.g. on&off, dimming) are natively integrated into Echo device and users can issue commands out-of-box. For other advanced commands (e.g. changing colors and control scenes), users need to enable Alexa Hue skill for the commands to work."

Also here was said that it will not get implemented natively. So going that route color would unfortunately only be possible with alexa if we could connect the ha-bridge to a hue account like a real bridge which is unlikely i guess. Same goes for scenes.
So color with HA-Bridge only via hue app, or the old one device per color way.

@bwssytems
Copy link
Owner

Thanks for looking into that. I am still going to implement it as the apps can change the color and if there is any custom use of the api.

@bwssytems bwssytems added this to the V5.0.0 milestone Aug 1, 2017
@bwssytems bwssytems self-assigned this Nov 15, 2017
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

9 participants