krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
387 stars 46 forks source link

mrs100 Server disconnected #419

Open galamarco opened 2 months ago

galamarco commented 2 months ago

some mrs100 cannot be controlled by Home Assistant but connected to the server and managed by the app

Screenshot_93

The debug log generates a file that cannot be opened

Screenshot_94

In the local network management application I checked if the device is connected to wifi and has a correctly assigned IP and everything is working perfectly. The device is connected and transmitting correctly. IMG_2804 IMG_2803

I can also manage the device correctly from the app. IMG_2805 IMG_2807

By pinging Home Assistant to the device's IP it responds.

Despite this, in Home Assistant, the device cannot be managed and is offline. Trying to go to the device configurations the error is sometimes "Timeout error" sometimes "server error", sometimes "Cannot connect to host 192.168.5.200:80 ssl:default [Connect call failed ('192.168.5.200', 80)]". here the screenshot:

Screenshot_95 Screenshot_94 Screenshot_99

Version of the custom_component

I'm using v5.0.3 of custom component

Core 2024.4.2 Supervisor 2024.04.0 Operating System 12.1 Frontend 20240404.1

Debug log

In the error log i found this error, but I don't think it has anything to do with the cause of the problem since it is an error in the automations involving this devices .

Registratore: homeassistant.components.homeassistant.triggers.numeric_state
Fonte: components/homeassistant/triggers/numeric_state.py:208
Integrazione: Home Assistant Core Integration (documentazione, problemi)
Prima occorrenza: 12:53:21 (5 occorrenze)
Ultima registrazione: 13:15:38

Error in 'Se movimento registra data ora ed evento' trigger: In 'numeric_state' condition: entity cover.tapparella_sala_da_pranzo_grande_shutter state '' cannot be processed as a number
Error in 'Se movimento registra data ora ed evento' trigger: In 'numeric_state' condition: entity cover.tapparella_salotto_piccola_shutter state '' cannot be processed as a number
Error in 'Se movimento registra data ora ed evento' trigger: In 'numeric_state' condition: entity cover.tapparella_cucina_shutter state '' cannot be processed as a number
Error in 'Se movimento registra data ora ed evento' trigger: In 'numeric_state' condition: entity cover.bh_tapparella_camera_da_letto_shutter state '' cannot be processed as a number
Error in 'Se movimento registra data ora ed evento' trigger: In 'numeric_state' condition: entity cover.tapparella_sala_da_pranzo_piccola_shutter state '' cannot be processed as a number

and this

Registratore: homeassistant.components.homeassistant.triggers.numeric_state
Fonte: components/homeassistant/triggers/numeric_state.py:155
Integrazione: Home Assistant Core Integration (documentazione, problemi)
Prima occorrenza: 12:45:28 (2 occorrenze)
Ultima registrazione: 12:45:28

Error initializing 'Se movimento registra data ora ed evento' trigger: In 'numeric_state' condition: entity cover.tapparella_bagno_shutter state '' cannot be processed as a number
Error initializing 'Se movimento registra data ora ed evento' trigger: In 'numeric_state' condition: entity cover.tapparella_salotto_grande_shutter state '' cannot be processed as a number
krahabb commented 2 months ago

Hello @galamarco, You could try downgrade meross_lan to 5.0.2 and see if anything changes since v5.0.3 specifically changed the way the HTTP connections are managed in the component by enforcing 'strict serialization' in order to prevent random disconnections due to https://github.com/krahabb/meross_lan/issues/206#issuecomment-1999837054.

The fix in 5.0.3 should be safe overall and just prevent devices disconnections from the fact that sometimes meross_lan was issuing some overlapping HTTP sessions to the device which, as suggested by @gary-sargent, could be 'offended' by this.

Nevertheless, it might be there are some other unforeseen consequences in the patch so, better check if previous version of the code was correctly working with your devices.

I guess you have some mrs100 working and some not so you could also check if these groups share some common fw or hw versions in order to try identify the cause for the issue.

Another option would be to add a 'Meross cloud profile' configuration in meross_lan for your Meross account so that the component could at least switch to cloud MQTT in order to connect to the devices. This will ensure some connectivity (at least) even if not really fixing the HTTP issue.

As usual, provided you did not already try, a device reboot could fix this.

Finally, if anything didn't work, you could enable tracing for the failing device and post the collected trace.

galamarco commented 2 months ago

Good morning, thank you very much for the reply. I downgraded the integration but saw little change.

I have two HA installations in different homes and Meross mrs100 devices in both homes. In both cases I encounter the same problems relating to the communication of the Meross mrs100 devices which are offline for days on end.

Going in order I downgraded the integration and the devices that were previously offline continued to be offline. I tried restarting HA, the wireless network, and meross devices, but nothing changed. All Meross devices work fine from the official app and are all with 2.1.4 firmware and 2.0.0 hardware. I reset a Meross device and reconfigured it in the app. After a few minutes it became available in HA. Unfortunately, however, after a few hours or days the problems return.

On another home with the same problems I downgraded the integration as suggested and nothing changed. However, I noticed that the devices go offline one after the other in sequence, as if when updating the status the communication failed one after the other.

Screenshot_111

Yesterday it happened the integration stopped with the shutter in the "opening" status for 15 hours and all the others offline. This device (same as the others) has firmware 2.1.4 and hardware 2.0.0.

IMG_1961

After this I upgraded to the latest version of the integration and little has changed. One is connected while 3 others are offline.

Here are some logs from one such device that often goes offline Screenshot_112

and another one: Screenshot_113

finally, the Meross cloud profile is already configured Screenshot_114

gary-sargent commented 2 months ago

@galamarco do you have static IP addresses for all your Meross devices? I'd recommend this if not.

galamarco commented 2 months ago

Yes, the static IP is enabled (managed by the Eero access points where the Meross devices are correctly connected)