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

Scene mode #131

Closed
SmartM-ui opened this issue Nov 2, 2020 · 26 comments
Closed

Scene mode #131

SmartM-ui opened this issue Nov 2, 2020 · 26 comments
Labels
enhancement New feature or request

Comments

@SmartM-ui
Copy link

@rospogrigio @postlund @ultratoto14

Hi,
I remember that by setting the value to 63 of the bulb supported features (in local tuya I see the value 19) the "effect" menu was displayed, as happens in the original Smart Life app.

In the other custom component (Tuya Custom) even though the scene menu was displayed, it was still empty.

Could you bring the scenes from the Smart Life app back to Local tuya?

It is not an indispensable function, but it would be an added value.

homeassistant:
customize:
light.xxxx: #entity name
supported_features: 63

86342278-ab47af80-bc57-11ea-8d49-0b363e9b2159

86342270-a7b42880-bc57-11ea-96ec-eefaef86fed7

@postlund
Copy link
Collaborator

postlund commented Nov 2, 2020

Anyone know how effects work? I have no idea. Maybe we need DPS dumps when different effects are activated?

@SmartM-ui
Copy link
Author

Anyone know how effects work? I have no idea. Maybe we need DPS dumps when different effects are activated?

Hi!
These are the effects of the smartlife app

20201102_184529

@postlund
Copy link
Collaborator

postlund commented Nov 2, 2020

Question is how we translate this into something we can send to the bulb .

@postlund postlund added the enhancement New feature or request label Nov 2, 2020
@postlund
Copy link
Collaborator

postlund commented Nov 2, 2020

Ok, so scenes are manged by DP 25 according to:

light_dps

Maybe we can just try to set 25 to Night or night (or any of the others) and see what happens?

@ultratoto14
Copy link
Collaborator

Here is what dps 25 is set on my RGBW Led strip:

"25": 07464602000003e803e800000000464602007803e803e80000000046460200f003e803e800000000464602003d03e803e80000000046460200ae03e803e800000000464602011303e803e800000000

Night or night will not work i must admit.
Also, i have multiple bulbs, they all have different scenes.

"21" is set to scene and
Colored scene:
"25": 05464601000003e803e800000000464601007803e803e80000000046460100f003e803e800000000
Night scene:
"25": 000e0d0000000000000000c80000

Available scenes in this one: Night, Reading, Work, Soft, Colored, 3 others (do not know how to translate in English ;-))

@postlund
Copy link
Collaborator

postlund commented Nov 2, 2020

Right, so the scenes are probably encoding of various changes to colors, brightness and temperatures. So we could probably build our own scenes if we figure out the format. I noticed 03e8 (1000 in decimal) which is likely maximum brightness. Wouldn't be surprised if we found HSV or RGB encoded colors in there...

@ultratoto14
Copy link
Collaborator

ultratoto14 commented Nov 3, 2020

I dug a little bit into the scenes and here are my findings about simple scenes, white only

Night:
000e0d0000000000000000c80000
Work:
020e0d0000000000000003e803e8
Read:
010e0d0000000000000003e801f4
Loisir:
030e0d0000000000000001f401f4
Loisir brightness 100%
030d0d0000000000000003e801f4
Loisir brightness 100% colortemp 100%
030d0d0000000000000003e803e8
03 0d 0d00000000000000 03e8 03e8
two first, index of the scene
two next, 0e if default, 0d if modified
last 4 color_temp
the 4 before brightness

edit:
Loisir brightness 50% color Red Sat 100%
030d0d00016803e801f400000000
Loisir brightness 100% color Red Sat 100%
030d0d00016803e803e800000000
Loisir brightness 100% color Red Sat 50%
030d0d00016801f403e800000000
030d0d00 0168 01f4 03e8 00000000
HSV (360, 500, 1000)

Continue digging.

@SmartM-ui
Copy link
Author

Here is what dps 25 is set on my RGBW Led strip:

"25": 07464602000003e803e800000000464602007803e803e80000000046460200f003e803e800000000464602003d03e803e80000000046460200ae03e803e800000000464602011303e803e800000000

Night or night will not work i must admit.
Also, i have multiple bulbs, they all have different scenes.

"21" is set to scene and
Colored scene:
"25": 05464601000003e803e800000000464601007803e803e80000000046460100f003e803e800000000
Night scene:
"25": 000e0d0000000000000000c80000

Available scenes in this one: Night, Reading, Work, Soft, Colored, 3 others (do not know how to translate in English ;-))

Hi @ultratoto14 @postlund
I'm back. I saw that you worked during my absence!

I try to carry out some tests too, re-enabling debugging.
Is there a possibility to enable debugging for only one light bulb?
Between the switches and the other bulbs, the log is difficult to read.

My scenes are as follows:
night, read, meeting, leisure, soft, rainbow, shine, beautiful

Thanks!

@ultratoto14
Copy link
Collaborator

What you can do is just a grep on the log as the logs contains the bulb id =>

tail -f home-assistant.log | grep yourid

@SmartM-ui
Copy link
Author

What you can do is just a grep on the log as the logs contains the bulb id =>

I wanted to avoid generating too heavy a log. OK, I'll use debugging only when needed for the various tests.

@ultratoto14
Copy link
Collaborator

I use a sensor to debug the DP 25, look this #135 and the fix #138

@SmartM-ui
Copy link
Author

I use a sensor to debug the DP 25, look this #135 and the fix #138

The fix #138 has also been implemented here: #129

Which one should I try tonight?

@ultratoto14
Copy link
Collaborator

They are not linked, #129 is for white home assistant scenes and #138 may help you debug the tuya scenes ;-)

@SmartM-ui
Copy link
Author

Hi @ultratoto14
pull 138 is about "string sensor" (https://github.com/ultratoto14/localtuya/tree/string_sensor) and you can download the code to try (localtuya-string_sensor.zip) and not debug for tuya scenes.

This is why I was asking which .zip to install to perform the tests:
localtuya-string_sensor.zip or localtuya-light_scene_fix.zip
Confusion :-)

@pergolafabio
Copy link

I bought an rgb led strip yesterday, I can also turn on music modes and stuff like that, will this also be contrable with this PR?

@ultratoto14
Copy link
Collaborator

There is no PR yet, the music mode is using the mic of the phone, so it will not be available with HA for the moment

@pergolafabio
Copy link

Hmm, quite sure that's it's not using the mic of my phone :-)

I think the wifi controller of the led strip has a mic... When I clap my hands , I see the rgb strip flashing, ist cool for kids :+)

@ultratoto14
Copy link
Collaborator

I also have one, i'll try ;-)

@ultratoto14
Copy link
Collaborator

For my led strip, it is linked to the phone, if you can confirm that yours is using only the led strip
(i tested with my phone in the fridge ;-))

@pergolafabio
Copy link

yes, my phone was 1 floor down, closed all doors

i have this RGB strip :https://nl.aliexpress.com/item/4000103478758.html?spm=a2g0s.9042311.0.0.4b0f4c4dXqJrSP

@ultratoto14
Copy link
Collaborator

@SmartM-ui , @pergolafabio you may try this PR: #146

@pergolafabio
Copy link

@ultratoto14

will do, but i removed localtuya for now
i have an RGB led strip, when it drops the wifi, its not coming back to HA

in the HA log, i see every 5 mins disconnect warning, but it doesnt reconnect
i have to restart HA to make it work again...
strange, because i can still ping it, also the IP are static (dhcp MAC reservation)

with tuya cloud , its stays working

@SmartM-ui
Copy link
Author

@SmartM-ui , @pergolafabio you may try this PR: #146

@ultratoto14
Hello, my friend!
I'm away for work and I'm coming home on Friday night.
As soon as I can I try your new PR and it will get feedback.
See you soon and don't have fun without me :-)

@ultratoto14
Copy link
Collaborator

PR is merged, you can check on your side and close the issue if it is satisfying.
@SmartM-ui I initiated a wiki page for known working devices, if you can give the specifications of yours, i can then add them to the list.

@SmartM-ui
Copy link
Author

Perfect, it seems to work!

@stephanbosch
Copy link

The scene string is documented here:
https://developer.tuya.com/en/docs/iot/product-function-definition?id=K9s9rhj576ypf#title-8-DP25%3A%20scene
Tested this with tinytuya and it works.

This will allow implementing the sliders that the tuya app has for these effects/scenes: speed, brightness, and saturation.
We can create custom scenes that Tuya app doesn't provide.
Maybe we could even make some sort of scene editor.

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

No branches or pull requests

5 participants