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

Color format #1

Open
pkastner opened this issue Dec 26, 2015 · 5 comments
Open

Color format #1

pkastner opened this issue Dec 26, 2015 · 5 comments

Comments

@pkastner
Copy link

Hi @Marmelatze,

first thanks for putting this on GitHub!
Did you find out how exactly the color is encoded. For example what does 35:e8:03:0a:00:94:00:a2:30:ff:2f:00:10 stand for exactly?

@Marmelatze
Copy link
Owner

I'm still trying to figure this out. As you see the example code is increasing one byte and sends it to the lamp. But the color is totally random.

Examples for some shades of green:

35:14:00:0a:00:98:00:d5:30:ff:2f:00:10
35:14:00:0a:00:9b:00:ee:30:ff:2f:00:10
35:14:00:0a:00:9d:00:07:31:ff:2f:00:10
35:14:00:0a:00:9f:00:20:31:ff:2f:00:10
35:14:00:0a:00:a1:00:39:31:ff:2f:00:10
35:14:00:0a:00:a9:00:9e:31:ff:2f:00:10
35:14:00:0a:00:ab:00:b7:31:ff:2f:00:10
35:14:00:0a:00:ad:00:d0:31:ff:2f:00:10
35:14:00:0a:00:b0:00:e9:31:ff:2f:00:10 

35:e8:03:0a:00:94:00:a2:30:ff:2f:00:10 is also green. I got these values from bluetooth le sniffing.

Some other code I found for controlling avea: https://github.com/guh/guh/blob/master/plugins/deviceplugins/elgato/aveabulb.cpp

Help would be much appreciated.

@Marmelatze
Copy link
Owner

This is how its done:

There are 4 color variables: white, red, green, blue (each from 1-4096)

To compute the command I use to following function:

rgbToAvea (white, r, g, b)
    {
        const j = 500;
        let color = new Buffer(8);
        color.writeUInt16BE(white * 16, 0);
        color.writeUInt16BE(r * 16, 2);
        color.writeUInt16BE(g * 16, 4);
        color.writeUInt16BE(b * 16, 6);
        return new Buffer([
            0x35,
            j & 0xFF,
            j >> 8 & 0xff,
            10,
            0,
            color[1],
            color[0] | 0x80,
            color[3],
            color[2] | 0x30,
            color[5],
            color[4] | 0x20,
            color[7],
            color[6] | 0x10,
        ]);
    }

j seem to be the time for fading to the specific color (default 500?)

@digitalhoax
Copy link

Just poked around the code only to find this issue where everything is already solved. Thanks a lot for putting it up, maybe put this info in the readme or add the actual code to the project?

@Marmelatze
Copy link
Owner

Here you go. Had some problems figuring out decoding the received color codes.

@digitalhoax
Copy link

Awesome. Great update on the Readme, thanks a lot! Now I need to add this to Fhem and Homebridge so I can control the bulbs via Siri.

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

No branches or pull requests

3 participants