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 custom effect for lights #331

Open
Yuke-hd opened this issue Jan 20, 2021 · 9 comments
Open

Add custom effect for lights #331

Yuke-hd opened this issue Jan 20, 2021 · 9 comments

Comments

@Yuke-hd
Copy link

Yuke-hd commented Jan 20, 2021

In light.py I found

SCENE_LIST_RGBW_1000 = {
    "Night": "000e0d0000000000000000c80000",
    "Read": "010e0d0000000000000003e801f4",
    "Meeting": "020e0d0000000000000003e803e8",
    "Leasure": "030e0d0000000000000001f401f4",
    "Soft": "04464602007803e803e800000000464602007803e8000a00000000",
    "Rainbow": "05464601000003e803e800000000464601007803e803e80000000046460100f003e803"
    + "e800000000",
    "Shine": "06464601000003e803e800000000464601007803e803e80000000046460100f003e803e8"
    + "00000000",
    "Beautiful": "07464602000003e803e800000000464602007803e803e80000000046460200f003e8"
    + "03e800000000464602003d03e803e80000000046460200ae03e803e800000000464602011303e80"
    + "3e800000000",
}

After playing with it for a while I found:

"Shine": "06464601000003e803e800000000464601007803e803e80000000046460100f003e803e8"
    + "00000000",

A  B    C  D    E    F    G
06 4646 01 0000 03e0 03e8 00000000

A = No. of entry in the APP aka "scene_num"
B = "unit_switch_duration" and "unit_gradient_duration"
C = "unit_change_mode" [“static”,“jump”,“gradient”] (01-02)
D = four bytes of hue (0-0168)
E = four bytes of saturation (0-03e8)
F = four bytes of brightness (0-03e8)
G= padding (not sure)

I was able to manually add my on effect:

"Alert": "06606001016803e803e80000000060600100f003e803e800000000",

It's just flash red and blue

Can someone confirm if the data schema is correct and is there a way to add custom effect via config-flow?

@Yuke-hd
Copy link
Author

Yuke-hd commented Jan 20, 2021

Is there a tutorial on HA config-flow? I'm interested in implementing this feature myself, at least give it a try

@KTibow
Copy link

KTibow commented Apr 19, 2021

@bongzyx
Copy link

bongzyx commented Apr 26, 2021

I made a little Python script to decode or create new effect set. It is interactive and hope can be added to a GUI

localtuyaDecoder.py.zip

@KTibow
Copy link

KTibow commented Apr 28, 2021

@brandonongzy Nice! Small suggestion: Format it with Black. Also consider uploading it as a GitHub gist/repo.

@bongzyx
Copy link

bongzyx commented Apr 29, 2021

@brandonongzy Nice! Small suggestion: Format it with Black. Also consider uploading it as a GitHub gist/repo.

Thanks for the suggestion, I have published to a repo here https://github.com/brandonongzy/LocalTuyaDecoder :)

@acs-lux
Copy link

acs-lux commented Nov 4, 2021

Hi,

I finally figured out the dps for my led strip that didn't match the example. Now i can go crazy colours for party time locally.

Its great but my question is...

Is transition supported in localtuya? For me it has no affect on the speed of changes.

This is still worth all the effort since the official tuya is still cloud based and is the best thing i found for HA so far imho.

@KTibow
Copy link

KTibow commented Nov 6, 2021

@acs-lux I don't think that Tuya on its own supports transition, and localtuya doesn't add that. Effects (part of Tuya on its own) might be used to add that, though.

@acs-lux
Copy link

acs-lux commented Nov 6, 2021

Ah ok thanks

@ThomasCr
Copy link

I will also be Interested on this, because I also miss some scenes.
#659

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

5 participants