krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
443 stars 47 forks source link

Effects don't work on MSL320 #232

Closed RafaelCasal closed 5 months ago

RafaelCasal commented 1 year ago

Nothing happens when I choose an effect. Nothing appears in the logs, it's like I wasn't making any request. I don't know if it's a problem related only to the MSL320 led strips because I only have these. Thanks krahabb for the amazing job.

krahabb commented 1 year ago

Hello @RafaelCasal, I would need a trace/diagnostic in order to inspect what's happening with your device. Latest firmwares are changing a lot of behaviors so that could be a reason. The only way I can test the issue is to have your diagnostic data since I don't have any recent device to test on https://github.com/krahabb/meross_lan/wiki/Diagnostics#download-diagnostics

RafaelCasal commented 1 year ago

Hi. Sorry for the delay. Here is the diagnostic data. meross_lan-64d71d51dd4d99a7cb95a82d0776d591-Smart Light (2202212951197390868748e1e989f5f2)-77725e9937b5adae08796025ad16642a.json (1).txt

krahabb commented 1 year ago

Hello @RafaelCasal, I might have an idea about the effect not working, but I would like to be sure: Could you set an effect on the light with the app, see if HA shows you the correct effect (HA UI should be able to reflect the actual state of the light anyway) and then try changing the effect with HA? If my guess is right this should work...else I'm lost....

Also, while doing this, please grab another trace while you operate the light with the app (turn on/off the light, turn on/off effects, set an rgb mode and so...) so I can have a lot of different use cases coming out from the trace. Keep in mind meross_lan actually only queries and saves the light state every 30 seconds so wait at least longer before making any change through the app to avoid loosing the recording

garysargentpersonal commented 1 year ago

I have the same with a MSL450. How do I try the fix?

garysargentpersonal commented 1 year ago

Doesn't look like the effect shows up in HA when started in the meross app.

garysargentpersonal commented 1 year ago

Hi - I tried the fix on my MSL450 and it doesn't work (v2.7.0-alpha).

krahabb commented 1 year ago

Hello @garysargentpersonal,

a diagnostic trace of your device might help: here some clues about what would be nice to have while the device is logging the diagnostic (quoting from previous response):

Also, while doing this, please grab another trace while you operate the light with the app (turn on/off the light, turn on/off effects, set an rgb mode and so...) so I can have a lot of different use cases coming out from the trace. Keep in mind meross_lan actually only queries and saves the light state every 30 seconds so wait at least longer before making any change through the app to avoid loosing the recording

(https://github.com/krahabb/meross_lan/wiki/Diagnostics#download-diagnostics)

garysargentpersonal commented 1 year ago

Ok in this trace I used the Meross app to turn the light on, switch to "Party" effect, switch to "Colourful" effect", switch to "Night" effect. Then in color tab changed brightness to 41%, then to 1%, then turned the light off. Looks to have captured the lines where the effects change ("enable" goes from "0" to "1" for the relevant effect).

msl450-1672762073.csv

RafaelCasal commented 1 year ago

[Here is the diagnostic data. There should be a lot of use cases. changes through home assistant before and after changes on the meross app. Thank you for work! meross_lan-64d71d51dd4d99a7cb95a82d0776d591-Smart Light (2202212951197390868748e1e989f5f2)-77725e9937b5adae08796025ad16642a.json (2).txt

garysargentpersonal commented 1 year ago

Latest build still doesn't seem to change the effect

krahabb commented 1 year ago

I was hoping this fix was at least showing in HA UI the correct effect selected from the app... There is something unclear to me in the way the light reports its effects (by using an internal 'effect Id' beside the effect name) and then using a different kind of Id to show the actual selection: In other words, the effect list reports every effect in the device and carries an effect id which is sometimes a numeric string and sometimes a completely random alphanumeric (for different effects). I guess the default effects coming from the device have the numeric string id while other custom effects have the random alphanumeric. When the device has an effect in place, the protocol reports a numeric Id which I'm not really sure how to interpret: i.e is it a positional index in the list of effects ?

garysargentpersonal commented 1 year ago

I did spend quite a while adding debug to the code and trying various changes but to no avail.

The message to set the effect seems to do nothing. You get an update back missing the event as though it didn't take. But when you change in the app I can see the message payload has the effect id as an int.

krahabb commented 1 year ago

I have another idea: meross_lan actually tries to set the active effect through the same command/payload used for setting light parameters in general. we could try instead use the 'Appliance.Control.Light.Effect' namespace as follows: namespace: 'Appliance.Control.Light.Effect' method: 'SET' payload: { "effect": [ { "Id": "0000000000000000", "enable": 1 } ] } and see if this works.

but... WARNING: I hope that command doesnt effectively wipe out the full effect list for the light....this is a real concern since I guess that namespace is used to 'program' the effects in the device and there are many ways this payload could be interpreted

Is there a way from the app to quickly reset the effect list so you can restore it should the command wipe it out?

garysargentpersonal commented 1 year ago

How about you store the effects list on startup, then have a set effect and restore effects service calls in an alpha build. We could then try the set, and if it wipes everything call the restore. These service calls would just be in one alpha release as a test.

krahabb commented 5 months ago

Support for msl320 light effects is now live (Moonlight.1 v5.1.0)