krahabb / meross_lan

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

Shutter / Cover displays wrong Position in HA #227

Closed R1200G closed 1 year ago

R1200G commented 2 years ago

Hi there,

I´m quite new to HA. I´didnt find the issue yet, so hopefully you guys can help me.

I integrated my Meross Shutters in HA via the cloud and meross_lan integration. Problem:

The Position which is displayed in HA lovelace or directly at the entity is always wrong (not the same like in the Meross app or in the Homekit app on the iPhone, this is the real position). I found out, that when i looked at the attribute of the Shutter (entity) there is always the correct positon displayed (Position Native).

In my case (shown on the picture) the shutter is fully closed.

How can i fix that?

Thanks a lot,

R1200G entity

krahabb commented 2 years ago

Hello @R1200G, Thank you for reporting this. The native position reported in the attributes is, like you guessed, the position according to the hardware but, in my tests, this hardware position was always reporting either 0 (closed) or 100 (open) with no values in between. Now, maybe things have changed through a recent firmware update but, nevertheless, the device cannot (or shouldnt be able to) report a correct position because it lacks any sort of sensor to read the effective actual position of the shutter. These kind of devices usually estimate the position based on the 'time of run' and are prone to accumulating errors which are only resolved when they run to the end a couple of times.

This is how meross_lan itself calculates the emulated position in software but, of course, this estimate suffers a lot from latencies in communication expecially when you bind the device to meross_lan through HTTP (which is the only option if you still have your meross paired to the Meross App). If you instead bind the device to a local MQTT these latencies are greatly reduced and calculations can provide a better result even though I see this is not viable for many users (i.e. unbinding from the Meross App in order to bind to a local MQTT).

However, this 'software position' proved to work correctly for the same HTTP binding scenario for other users so I suggest you to try (or investigate) this:

R1200G commented 2 years ago

Hello @krahabb,

thanks for your answer! Just a quick response tonight, i will try the rest tomorrow.

The roller shutter - position native - is always correct in my case. I observed this the last few days. I have another picture to show you. The - native position - is the same position as in real life, HomeKit and the Meross App.

I would really appreciate it if you could make an update.

If you need anything else from me or if I can help you please let me know [but im still a Newbie ;) ]

Roller Shutter

krahabb commented 2 years ago

Thank you! Yes, it would be awesome if you could collect a diagnostic trace for the device (https://github.com/krahabb/meross_lan/wiki/Diagnostics#download-diagnostics)
When the tracing is in progress try to operate the shutter both from HA and the App so it can collect data for different behaviors. This way I could better understand all of the implication of this (current) firmware release for the shutter and update meross_lan as best as I can

R1200G commented 2 years ago

Hey @krahabb,

I did what you told me. I triggerd the shutter from HA, HomeKit and the Meross App. The - native Position - in HA was always the correct one (also in HomeKit and Meross App)

I logged the file. How can I send the file to you in a private message? I'm not sure if there are confidential / private data in the file.

Best regards,

R1200G

krahabb commented 2 years ago

you can PM at davide.perteghella@mthree.it

R1200G commented 2 years ago

Thanks. I just sent you an email!

Please keep me updated.

I also tried your suggestion:

But it did not work. Even if i pull the trigger to the 0 or 100 position on the slide bar.

Is there a way to choose which position value the slide bar should use to display the position? So that i could change it to the attribute: native position ?

krahabb commented 1 year ago

Hello @R1200G, I'm sorry for the late reply, I've already checked your log and it clearly shows the correct 'native' position exposed by the device so it is very easy to pick it up and show instead of the meross_lan own computed one. Nevertheless, I have to make sure the update doesnt disrupt the existing 'emulated' position feature for (older) devices which dont expose the correct native position. I guess I would be able to work on this and many other issues before or around christmas so I ask you to be a bit patient with my timing :)

R1200G commented 1 year ago

Hello @krahabb Thank you very much for your effort! I will test the new pre version you published.

I will let you know how it works. :)

lucas-TT commented 1 year ago

hi @krahabb I had exactly the same issue than @R1200G. I've replaced original files with those that you provided in 50fc90f and it works like a charm. Thank you very much for the efforts!

krahabb commented 1 year ago

Thank you very much for your confirmation, I'm going to close this :)