albertogeniola / meross-homeassistant

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

Devices becoming unavailable. #250

Closed Kydonakis closed 3 years ago

Kydonakis commented 3 years ago

No issues so far for the last many months. It seems that for the last couple of days the integration is "disconnected" every 7-8 hours resulting in devices being unavailable. API hits drops to 0 calls/sec. After restarting HA server, the integration works normally for another 7-8 hours.

image

A \related log follows.

Logger: meross_iot.manager Source: /usr/local/lib/python3.9/site-packages/meross_iot/manager.py:368 First occurred: 2:56:11 PM (14 occurrences) Last logged: 3:10:23 PM

Client has been disconnected, however auto_reconnect flag is set. Won't stop the looping thread, as it will retry to connect.

Any ideas?

System Health

version core-2021.7.3
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.9.5
os_name Linux
os_version 5.10.17-v8
arch aarch64
timezone Europe/Bucharest
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4839 Installed Version | 1.13.2 Stage | running Available Repositories | 856 Installed Repositories | 26
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 6.1 -- | -- update_channel | stable supervisor_version | supervisor-2021.06.8 docker_version | 20.10.6 disk_total | 27.7 GB disk_used | 13.5 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | File editor (5.1.0), Samba share (9.3.0), Check Home Assistant configuration (3.8.0), Home Assistant Google Drive Backup (0.104.3), AdGuard Home (4.1.6), Node-RED (9.2.1), Mosquitto broker (6.0.1), Zigbee2mqtt (1.18.1-1), SSH & Web Terminal (9.0.0), Paradox Alarm Interface (2.5.3), TasmoAdmin (0.15.0)
Lovelace dashboards | 4 -- | -- resources | 35 views | 28 mode | storage
silviudc commented 3 years ago

Same happens to me, I am on 2021.7.4 and it started on 2021.7.3. Only fix is restart and seeing a lot of this in the logs when it happens:

    Line 2939: 2021-07-25 09:50:28 WARNING (Thread-4) [meross_iot.manager] Client has been disconnected, however auto_reconnect flag is set. Won't stop the looping thread, as it will retry to connect.
purcell-lab commented 3 years ago

I have been running an automation to reload the Meross integration when it is detected offline which had been ok and is less disruptive than restarting everything.

I have now migrated everything to meross-lan integration and it has been rock solid.

Recommend migration to meross-lan.

silviudc commented 3 years ago

How is the reload integration done, never knew this was possible.

purcell-lab commented 3 years ago

My reload automation, which I found reported at #231

image

image

image

Kydonakis commented 3 years ago

This reload automation is very handy indeed, but why is the disconnection happening in the first place? Any plans for a permanent fix?

vibes70 commented 3 years ago

I have also found that issue in the last update. I have realized that my system meross devices become unavailable exactly after 6 hours.

liuk4friends commented 3 years ago

Same issue here. Since this afternoon I cannot use my Meross devices both with the official app and with "Home Assistant".

This evening I've received from Meross the email below: _

Object: ATTENTION: Service Termination of Your meross Smart Device due to Security Concerns

"Dear Customer,

This is meross cloud security team contacting you. First of all, thanks for purchasing meross and we hope that you enjoy life with our smart products. Recently our cloud security system has noticed that your devices are communicating with the could server at an extremely high frequency. We consider these behaviors abnormal and are concerned about the security of your devices. Due to the security concerns and the intent to avoid any further potential damage, we will terminate the cloud services of these devices for now. If you are sure that your devices are safe, NOT hacked, and are performing as expected. Please first lower your periodic request rate to no more than one message every ten seconds and then send an email to support@meross.com. We will resume cloud service for you within 24 hours. Please note that any abnormal high cloud request frequency will cause cloud service termination again. Should you have any information you would like to provide us with or would like to offer us any clarification, please contact us within 24 hours.

Thanks! meross Cloud Security Team"

_

I wonder if the problems we are experiencing are due to this decision by Meross

frosthal commented 3 years ago

Same problem here, and if Meross is going to restrict HA access, i will consider not to buy Meross products in the future. Meanwhile i will keep the automation restarting the services.

Kydonakis commented 3 years ago

Since we still use their cloud services through the integration, we cannot change their suspension scheme and their imposed threshold for "abnormal behaviour" flagging.

However, now that we know there is a limit to 1 call per 10 seconds, I was wondering if we can reduce somehow the API calls of the integration to respect that limit. Or this will turn the integration rather irresponsive and slow?

dragon2611 commented 3 years ago

I have been running an automation to reload the Meross integration when it is detected offline which had been ok and is less disruptive than restarting everything. I have now migrated everything to meross-lan integration and it has been rock solid. Recommend migration to meross-lan.

Not sure how I'd get the required version of MerossIOT into the Hass docker container as it's not in PIP (presumably due to it being newer than the ones in pip)

iBeech commented 3 years ago

I’ve put a fix for this in a fork. Got a pull request out.

albertogeniola commented 3 years ago

Hi, as already mentioned in many other posts about this topic, the current version of this component relies on Meross cloud to work. Meross security team does automatically flag as "abnormal" the usage of high frequency api calls. The frequency of API calls is strictly connected to the number of Meross devices registered to the user's account.

The latest version of the component (v1.1.0) has introduced the possibility to configure API rate limits, as a temporary fix. To avoid such issues on the long term, you should rely on local addon integrations as Meross-LAN or the one that is currently being developed in this repository.