albertogeniola / meross-homeassistant

Custom component that leverages the Meross IoT library to integrate with Homeassistant
MIT License
730 stars 83 forks source link

my switchs meross becomes unavailable every day #269

Closed yepp31 closed 2 years ago

yepp31 commented 3 years ago

have 7 sockets connected and since update 1.1.4 I lose the connection of all my sockets every day. i uninstalled and reinstalled the addon but still the same problem.

Home Assistant 2021.9.3 rpi4 64bits

Flameboy42 commented 3 years ago

Same. Only have two sockets. They were working for a week there, but nothing over the last two days.

zhazell commented 3 years ago

Same. Only have the MSG100 garage door opener and constantly have to reload the integration. Home Assistant 2021.9.3, rpi4 docker

unlucio commented 3 years ago

same here and for months. homeassistant's logs are littered in these errors:

2021-09-09 11:07:44 ERROR (MainThread) [meross_iot.manager] An error occurred while executing push notification handling for <meross_iot.model.push.online.OnlinePushNotification object at 0xa6e7f1a8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 784, in _handle_and_dispatch_push_notification
    await handler(
  File "/config/custom_components/meross_cloud/sensor.py", line 482, in platform_async_add_entities
    await manager.async_device_discovery(push_notification.namespace == Namespace.HUB_ONLINE,
  File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 333, in async_device_discovery
    http_devices = await self._http_client.async_list_devices()
  File "/usr/local/lib/python3.9/site-packages/meross_iot/http_api.py", line 318, in async_list_devices
    result = await MerossHttpClient._async_authenticated_post(url, {}, cloud_creds=self._cloud_creds, http_proxy=self._http_proxy)
  File "/usr/local/lib/python3.9/site-packages/meross_iot/http_api.py", line 230, in _async_authenticated_post
    raise AuthenticatedPostException("Failed request to API. Response code: %s" % str(response.status))
meross_iot.model.http.exception.AuthenticatedPostException: Failed request to API. Response code: 429
Leivaster commented 3 years ago

Me too

same here and for months. homeassistant's logs are littered in these errors:

2021-09-09 11:07:44 ERROR (MainThread) [meross_iot.manager] An error occurred while executing push notification handling for <meross_iot.model.push.online.OnlinePushNotification object at 0xa6e7f1a8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 784, in _handle_and_dispatch_push_notification
    await handler(
  File "/config/custom_components/meross_cloud/sensor.py", line 482, in platform_async_add_entities
    await manager.async_device_discovery(push_notification.namespace == Namespace.HUB_ONLINE,
  File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 333, in async_device_discovery
    http_devices = await self._http_client.async_list_devices()
  File "/usr/local/lib/python3.9/site-packages/meross_iot/http_api.py", line 318, in async_list_devices
    result = await MerossHttpClient._async_authenticated_post(url, {}, cloud_creds=self._cloud_creds, http_proxy=self._http_proxy)
  File "/usr/local/lib/python3.9/site-packages/meross_iot/http_api.py", line 230, in _async_authenticated_post
    raise AuthenticatedPostException("Failed request to API. Response code: %s" % str(response.status))
meross_iot.model.http.exception.AuthenticatedPostException: Failed request to API. Response code: 429

Me too. I reload the integration with 5 switches and after a while they all become unavailable. Same error as Unlucio

CheekyMonkeyPo commented 3 years ago

+1 for the above. Just seems to randomly drop. Reload manually and all ok again.

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 919, in _async_send_and_wait_ack return await asyncio.wait_for(future, timeout, loop=self._loop) File "/usr/local/lib/python3.9/asyncio/tasks.py", line 494, 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 "/config/custom_components/meross_cloud/sensor.py", line 365, 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 934, in _async_send_and_wait_ack raise CommandTimeoutError(message=str(message), target_device_uuid=target_device_uuid, timeout=timeout) meross_iot.model.exception.CommandTimeoutError

andornaut commented 3 years ago

I have the same experience. I have one garage switch, which seems to become unavailable multiple times per day.

I've used this automation to improve the situation somewhat:

- alias: Reload Meross when unavailable
  description: Reload the Meross Smart Garage Door service when the connection becomes unavailable. Retry every minute for 1 hours.
  trigger:
    - platform: state
      entity_id: cover.garage_msg100_main_channel
      to: unavailable
      for: 00:00:30
  action:
    - repeat:
        while:
          - condition: state
            entity_id: cover.garage_msg100_main_channel
            state: unavailable
          - condition: template
            value_template: "{{ repeat.index < 60 }}" # 1-indexed
        sequence:
          - service: homeassistant.reload_config_entry
            target:
              entity_id: cover.garage_msg100_main_channel
          - delay:
              minutes: 1
  mode: single
aaamoeder commented 3 years ago

same problem here, temporary workaround as suggested above works for the time being

honkerst commented 3 years ago

Chiming in!

I've had a MSS420 for a couple of years. It's mostly been fine, losing connection once every few months maybe.

The past couple of months it has been worse than ever. It now loses connection once a day and I have to manually reload the integration to "fix" (lol) it. It's got the point where I have extra automations to notify me if the Meross switch goes Unavailable. Fed up of it now, I've already ordered some replacement switches.

gabriele-latino commented 3 years ago

same error here, on MSG100

Meross Cloud IoT 1.1.4 core-2021.9.7 supervisor-2021.09.6 Home Assistant OS 6.4

2021-10-05 08:38:37 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall cover.open_cover (c:3b733bd7f07d645ebd5d93ee4f3fe082): entity_id=['cover.basculante_msg100_main_channel']> Traceback (most recent call last): File "/usr/local/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 919, in _async_send_and_wait_ack return await asyncio.wait_for(future, timeout, loop=self._loop) ... File "/usr/local/lib/python3.9/site-packages/meross_iot/manager.py", line 934, in _async_send_and_wait_ack raise CommandTimeoutError(message=str(message), target_device_uuid=target_device_uuid, timeout=timeout) meross_iot.model.exception.CommandTimeoutError

Unfortunately, the "restart when device is unavailable" trick doesn't work for me, because the device is always reachable, I have this error only when I try to interact with the MSG100.

foozyerdooz commented 3 years ago

Fresh install of HA on Pi 4B: Version | core-2021.11.3 Installation Type | Home Assistant Container Docker | true Python Version | 3.9.7 Operating System Family | Linux Operating System Version | 5.10.63-v7l+ CPU Architecture | armv7l

5 meross smart plugs installed. All become unavailable a short time after intitialisation with the following error:

Logger: homeassistant.helpers.entity Source: custom_components/meross_cloud/sensor.py:330 Integration: Meross Cloud IoT First occurred: November 13, 2021, 4:35:26 PM (21574 occurrences) Last logged: 8:27:25 AM

Update for sensor.caravan_mss310_power_sensor_w_0 fails Update for sensor.theatre_mss310_power_sensor_w_0 fails Update for sensor.patio_mss310_power_sensor_w_0 fails Update for sensor.pool_mss310_power_sensor_w_0 fails Update for sensor.study_mss310_power_sensor_w_0 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 468, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 658, in async_device_update raise exc File "/config/custom_components/meross_cloud/sensor.py", line 330, 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)

I've tried rate limiting MQ and disabling rate limiting - same result always happens.

Cecchellone commented 2 years ago

Same for me with a 4 socket power strip that i use for my acquarium. I've tried running an "integration reload" script before my automations, but with no luck. Does anyone have a working script to reload the integration?

albertogeniola commented 2 years ago

Hi all! I am sorry to join this thread so late. However, the last version v1.2.0rc0 introduces some.imporvements regarding entity availability and should be able to better recover in case of cloud disconnections or connection dios. Invite you to test that.