meross-homeassistant icon indicating copy to clipboard operation
meross-homeassistant copied to clipboard

Integration stops working

Open chicco83 opened this issue 3 years ago • 16 comments
trafficstars

I use the integration with mss310 plugs. The integration stops working After some hours. If you try to change the plug state the following error appears. The only way to fix It Is to reload the plugin

Your environment HomeAssistant version: core 2022.5.5 Hardware environment: orangepi PC

Logs taken when the issue happened

--- PASTE LOGS HERE ---

Questo errore ha avuto origine da un'integrazione personalizzata.

Logger: homeassistant.helpers.entity Source: custom_components/meross_cloud/sensor.py:401 Integration: Meross Cloud IoT First occurred: 22 maggio 2022, 23:40:28 (4063 occurrences) Last logged: 14:22:22

Update for sensor.lavatrice_mss310_power_sensor_v_0 fails Update for sensor.asciugatrice_mss310_power_sensor_v_0 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 515, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_device_update raise exc File "/config/custom_components/meross_cloud/sensor.py", line 401, in async_update await self._device.async_get_instant_metrics(channel=self._channel_id) File "/usr/local/lib/python3.9/site-packages/meross_iot/controller/mixins/electricity.py", line 43, in async_get_instant_metrics result = await self._execute_command(method="GET", File "/usr/local/lib/python3.9/site-packages/meross_iot/controller/device.py", line 281, in _execute_command return await self._manager.async_execute_cmd(destination_device_uuid=self.uuid, File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 838, in async_execute_cmd return await self.async_execute_cmd_client(client=client, File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 903, in async_execute_cmd_client response = await self._async_send_and_wait_ack( File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 915, in _async_send_and_wait_ack message_info = client.publish( File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1257, in publish rc = self._send_publish( File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2693, in _send_publish return self._packet_queue(PUBLISH, packet, mid, qos, info) File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3016, in _packet_queue return self.loop_write() File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1577, in loop_write rc = self._packet_write() File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2464, in _packet_write write_length = self._sock_send( File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 649, in _sock_send return self._sock.send(buf) File "/usr/local/lib/python3.9/ssl.py", line 1173, in send return self._sslobj.write(data) ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2483)

chicco83 avatar May 23 '22 12:05 chicco83

Issue still present. The integration suddenly stops updating the values.

chicco83 avatar Jun 10 '22 12:06 chicco83

I have just upgraded to 1.2.4 and its run for a few hours now without having to reload the integration. This has been going on for months now and its rare that I dont have to do a reload. Bill

BillKen avatar Jun 13 '22 04:06 BillKen

Its just stopped working again ... BillK

BillKen avatar Jun 13 '22 14:06 BillKen

Same for me. I have 4 MSS310 plugs and evertyhings stops to work after a few hours (control of plugs, power data...)

josntrm avatar Jun 22 '22 08:06 josntrm

Same thing here, 3 mss310 plugs

mecrip avatar Jun 26 '22 11:06 mecrip

Hi @chicco83 , what version of the Meross integration are you using? From the log you posted, it looks like you are using an old version of the integration. In fact, the file sensor.py has only 307 lines in the last version, but from the stack trace the error is generated at line 041.

Can you please update to the latest version and post again the stack trace?

albertogeniola avatar Jun 26 '22 12:06 albertogeniola

One month ago, when i posted the issue, It should be the latest one

chicco83 avatar Jun 26 '22 13:06 chicco83

Mine is 1.2.5rc2 (from manager.py) - manual install from git. Note that these are different error message so maybe its multiple issues/causes with similar symptoms? (listed as "Error 1:" and "Error 2:")

Error 1: This error originated from a custom integration.

Logger: custom_components.meross_cloud.sensor Source: deps/lib/python3.9/site-packages/meross_iot/manager.py:825 Integration: Meross Cloud IoT First occurred: June 24, 2022 at 1:25:35 PM (8 occurrences) Last logged: June 24, 2022 at 9:12:30 PM

Error occurred. ------------------------------------- Component version: 0.0.0 Device info: Name: M1 UUID: 2109070108298090855748e1e97521f6 Type: mss310 HW Version: 6.0.0 FW Version: 6.1.10 Error Message: "An exception occurred" Error occurred. ------------------------------------- Component version: 0.0.0 Device info: Name: M4 UUID: 2109071161599990855748e1e975232d Type: mss310 HW Version: 6.0.0 FW Version: 6.1.10 Error Message: "An exception occurred" Error occurred. ------------------------------------- Component version: 0.0.0 Device info: Name: M3 UUID: 2109079643062090855748e1e9753292 Type: mss310 HW Version: 6.0.0 FW Version: 6.1.10 Error Message: "An exception occurred" Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 490, in wait_for return fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/etc/homeassistant/deps/lib/python3.9/site-packages/meross_iot/manager.py", line 818, in _async_send_and_wait_ack return await asyncio.wait_for(future, timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/etc/homeassistant/custom_components/meross_cloud/sensor.py", line 147, in async_update await self._device.async_get_instant_metrics(channel=self._channel_id) File "/etc/homeassistant/deps/lib/python3.9/site-packages/meross_iot/controller/mixins/electricity.py", line 41, in async_get_instant_metrics result = await self._execute_command(method="GET", File "/etc/homeassistant/deps/lib/python3.9/site-packages/meross_iot/controller/device.py", line 278, in _execute_command return await self._manager.async_execute_cmd(destination_device_uuid=self.uuid, File "/etc/homeassistant/deps/lib/python3.9/site-packages/meross_iot/manager.py", line 778, in async_execute_cmd return await self.async_execute_cmd_client(client=client, File "/etc/homeassistant/deps/lib/python3.9/site-packages/meross_iot/manager.py", line 799, in async_execute_cmd_client response = await self._async_send_and_wait_ack( File "/etc/homeassistant/deps/lib/python3.9/site-packages/meross_iot/manager.py", line 825, in _async_send_and_wait_ack raise CommandTimeoutError(message=str(message), target_device_uuid=target_device_uuid, timeout=timeout) meross_iot.model.exception.CommandTimeoutError

Error 2: This error originated from a custom integration.

Logger: homeassistant Source: custom_components/meross_cloud/switch.py:93 Integration: Meross Cloud IoT First occurred: June 24, 2022 at 8:03:26 PM (2 occurrences) Last logged: June 24, 2022 at 8:03:26 PM

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/lib/python3.9/site-packages/homeassistant/helpers/update_coordinator.py", line 270, in _async_refresh update_callback() File "/etc/homeassistant/custom_components/meross_cloud/switch.py", line 93, in entity_adder_callback manager: MerossManager = hass.data[DOMAIN][MANAGER] # type KeyError: 'manager'

BillKen avatar Jun 26 '22 14:06 BillKen

sorry, version number is from manifest.json, not manager.py.

BillKen avatar Jun 26 '22 14:06 BillKen

I have also been having issues, probably within last 2 months or so.

This error originated from a custom integration.

Logger: custom_components.meross_cloud Source: helpers/update_coordinator.py:204 Integration: Meross Cloud IoT First occurred: June 26, 2022, 17:09:15 (180 occurrences) Last logged: 19:27:53

Error requesting meross_http_coordinator data: Cannot connect to host iot.meross.com:443 ssl:default [Try again]

augelr avatar Jun 27 '22 23:06 augelr

Hi @augelr , Please open a new issue if unrelated to the current one and be sure to provide all the details requested.

albertogeniola avatar Jun 28 '22 05:06 albertogeniola

Hi @BillKen , The first error is, unfortunately, known. It occurres from time to time when issuing too many commands to the remote Meross cloud. The only way to get rid of it is to switch to the local-addon, for now.

Regarding the second issue, I believe that's related to the version you are using. Can you please update to latest version, check if the error still occurs, and if so, post the error trace generated by the latest version?

Thanks.

albertogeniola avatar Jun 28 '22 05:06 albertogeniola

Hi, an update in that it still occurs with 1.2.5rc5 (downloaded from git, manual install - version number in manifest.json) Unfortunately I cant see anything relevant in the logs so far. BillK

BillKen avatar Jul 02 '22 05:07 BillKen

Hi guys, version v.1.2.6 introduces a new option to send local controls to the devices via HTTP when the HA and the devices are on the same network. If that is your case, you should test that option, which should "offload" the Meross cloud of most of the API calls.

You can enable that operating mode by doing as follows:

  1. Update the integration to version v1.2.6
  2. In the Integration settings, search for "Meross Cloud" and then click on "configure"
  3. Select "Attempt local HTTP communication first and fall-back to MQTT broker", as in the screenshot below.

image

Let me know if that makes it any better!

albertogeniola avatar Jul 27 '22 15:07 albertogeniola

Hi Alberto, it took me awhile to realize I needed the development branch to get 1.2.6. Its been two days now with no connection problems - looking good so far! BillK

BillKen avatar Jul 31 '22 18:07 BillKen

It was too good to last - after a promising beginning it still regularly stops working. My M310 switches and HA are on different VLAN networks - is that an issue? BillK

BillKen avatar Aug 03 '22 12:08 BillKen

Hi @BillKen , can the two VLAN communicate each other via a router? The "local HTTP" communication option requires both the HA integration and the device to be able to communicate at TCP/IP level.

Anyways, can you attach the log portion shown when the issue occurs? That is, as soon as you see that the integration stops working against the device, issue some commands to it via HA and then attach the logs you see.

To be sure to catch all the info we need from the logs, please add this section to your configuration.yaml:

logger:
    default: warning
    logs:
        custom_components.meross_cloud: debug
        meross_iot.manager: debug

Some ideas that need to be proven via logs:

  1. Change of IPs of the underlying device (DHCP?) and missing IP update strategy on the remote Meross cloud
  2. Deadlock/race condition poisoning the HA integration
  3. Mqtt client not being able to restore the connection to the Meross Cloud.

albertogeniola avatar Nov 19 '22 12:11 albertogeniola

Hi Alberto, I moved to the krahabb/meross_lan integration in local mode which was much harder get running but fixed the problem. I am not sure if the various firewalls involved were set to block http (port 80) at the time but I suspect this might have been the case. BillK

BillKen avatar Nov 19 '22 12:11 BillKen

Thanks a lot for the feedback!

albertogeniola avatar Nov 19 '22 12:11 albertogeniola