albertogeniola / meross-homeassistant

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

Meross - device unavailable #32

Closed antivirus68 closed 4 years ago

antivirus68 commented 4 years ago

Hi Alberto,

first of all, thanks for this great component. It handles meross devices really well. I contact you because sometimes a Meross device becomes unavailable and the only way to get it back it is to restart HA. These devices are always available inside Meross App so it looks like it is a comunication problem between HA component and Meross cloud. Is there a way to force a "scan" of meross devices? Is it possible to have a service that looks for devices on demand?

Usually when I get this problem, the component disconnect to Meross Cloud and I have this log:

2019-12-16 03:56:09 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.presa_xxxxxxxxxx fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update await self.async_update() File "/config/custom_components/meross_cloud/sensor.py", line 40, in async_update sensor_info = self._device.get_electricity() File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 136, in get_electricity return self._get_electricity()['electricity'] File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 21, in _get_electricity return self.execute_command("GET", ELECTRICITY, {}) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/device.py", line 126, in execute_command return self.cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/client.py", line 300, in execute_cmd raise CommandTimeoutException("A timeout occurred while waiting for the ACK: %d" % timeout) meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting for the ACK: 10 2019-12-16 03:56:13 INFO (Thread-2) [meross.connection] Disconnection detected. Reason: 1 2019-12-16 03:56:13 WARNING (Thread-2) [custom_components.meross_cloud] Connection with the Meross cloud dropped. 2019-12-16 03:56:19 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.presa_yyyyyyyyy fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update await self.async_update() File "/config/custom_components/meross_cloud/sensor.py", line 40, in async_update sensor_info = self._device.get_electricity() File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 136, in get_electricity return self._get_electricity()['electricity'] File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 21, in _get_electricity return self.execute_command("GET", ELECTRICITY, {}) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/device.py", line 126, in execute_command return self.cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/client.py", line 300, in execute_cmd raise CommandTimeoutException("A timeout occurred while waiting for the ACK: %d" % timeout) meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting for the ACK: 10 2019-12-16 03:56:29 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.xxxxxxxxx fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update await self.async_update() File "/config/custom_components/meross_cloud/sensor.py", line 40, in async_update sensor_info = self._device.get_electricity() File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 136, in get_electricity return self._get_electricity()['electricity'] File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 21, in _get_electricity return self.execute_command("GET", ELECTRICITY, {}) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/device.py", line 126, in execute_command return self.__cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/client.py", line 300, in execute_cmd raise CommandTimeoutException("A timeout occurred while waiting for the ACK: %d" % timeout) meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting for the ACK: 10 2019-12-16 03:56:39 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.xxxxxxxxxxxxx fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update await self.async_update() File "/config/custom_components/meross_cloud/sensor.py", line 40, in async_update sensor_info = self._device.get_electricity() File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 136, in get_electricity return self._get_electricity()['electricity'] File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 21, in _get_electricity return self.execute_command("GET", ELECTRICITY, {}) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/device.py", line 126, in execute_command return self.cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/client.py", line 300, in execute_cmd raise CommandTimeoutException("A timeout occurred while waiting for the ACK: %d" % timeout) meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting for the ACK: 10 2019-12-16 03:56:39 INFO (SyncWorker_14) [custom_components.meross_cloud] Trying to establish a connection with the Meross cloud... 2019-12-16 03:56:39 INFO (SyncWorker_14) [meross.connection] Closing the MQTT connection... 2019-12-16 03:56:39 INFO (SyncWorker_14) [meross.connection] Client has been fully disconnected. 2019-12-16 03:56:39 INFO (SyncWorker_14) [meross.connection] Initializing the MQTT connection... 2019-12-16 03:56:39 WARNING (SyncWorker_14) [custom_components.meross_cloud] Connected to the Meross cloud. 2019-12-16 03:56:39 WARNING (Thread-9) [custom_components.meross_cloud] Connected to the Meross cloud. 2019-12-16 03:56:40 WARNING (Thread-9) [custom_components.meross_cloud] Connected to the Meross cloud. 2019-12-16 03:56:40 INFO (SyncWorker_14) [meross.connection] Client connected to MQTT broker and subscribed to relevant topics. 2019-12-16 03:56:49 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.presa_yyyyyyyyyyy fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update await self.async_update() File "/config/custom_components/meross_cloud/sensor.py", line 40, in async_update sensor_info = self._device.get_electricity() File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 136, in get_electricity return self._get_electricity()['electricity'] File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/devices/power_plugs.py", line 21, in _get_electricity return self.execute_command("GET", ELECTRICITY, {}) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/device.py", line 126, in execute_command return self.cloud_client.execute_cmd(self.uuid, command, namespace, payload, callback=callback, timeout=timeout) File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/client.py", line 300, in execute_cmd raise CommandTimeoutException("A timeout occurred while waiting for the ACK: %d" % timeout) meross_iot.cloud.exceptions.CommandTimeoutException.CommandTimeoutException: A timeout occurred while waiting for the ACK: 10

Thanks for any help you can give me. Marco

albertogeniola commented 4 years ago

Hi Marco,

I'm actually working on a new version of the component which should at least allow you to remove and re-add the integration via Lovelace UI.

antivirus68 commented 4 years ago

Thanks, I'll wait for it.

Ciao Marco

Il Lun 23 Dic 2019, 11:20 Alberto Geniola notifications@github.com ha scritto:

Hi Marco,

I'm actually working on a new version of the component which should at least allow you to remove and re-add the integration via Lovelace UI.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/albertogeniola/meross-homeassistant/issues/32?email_source=notifications&email_token=AMHL323CWGE2HFJHAONLFBLQ2CGIVA5CNFSM4J3KRDNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHQZM3A#issuecomment-568432236, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHL322ZB6LBIWT3LS5N2FLQ2CGIVANCNFSM4J3KRDNA .

albertogeniola commented 4 years ago

Hi Marco, would you mind testing the latest version that I released?

antivirus68 commented 4 years ago

Hi Alberto,

I've installed your latest version yesterday night, when I saw the new version. I've tried on a test HA. All my devices still works, the only strange thing is that all my meross entity switches have a new name. For example:

switch.presa_sala became switch.presa_sala_2

Is it a normal behaviour for this new version? I wished it could keep the original name like all the other meross entities.

About the problem of "device unavailable" I'll have to update meross on my main HA server and see what happens in the next days.

I'll keep you updated on it.

Thanks Marco

Il Mar 31 Dic 2019, 10:17 Alberto Geniola notifications@github.com ha scritto:

Hi Marco, would you mind testing the latest version that I released?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/albertogeniola/meross-homeassistant/issues/32?email_source=notifications&email_token=AMHL3254RIBNN42XRHF7KC3Q3ME4JA5CNFSM4J3KRDNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH36O2Y#issuecomment-569894763, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHL326CBEVG5X77SLB37ATQ3ME4JANCNFSM4J3KRDNA .

albertogeniola commented 4 years ago

Hi Marco, I forgot to mention that I had to change the naming schema and logic in order to fix problems with sub-devices/hubs/power strips. I am sorry, but you'll have to update your automation scripts. Hopefully this won't change again in the future...

antivirus68 commented 4 years ago

Hi Alberto,

no problem, I will change them.

Thanks for the explanation. Marco

Il Mar 31 Dic 2019, 11:22 Alberto Geniola notifications@github.com ha scritto:

Hi Marco, I forgot to mention that I had to change the naming schema and logic in order to fix problems with sub-devices/hubs/power strips. I am sorry, but you'll have to update your automation scripts. Hopefully this won't change again in the future...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/albertogeniola/meross-homeassistant/issues/32?email_source=notifications&email_token=AMHL323YMOSWVZWKDHGXA33Q3MMO3A5CNFSM4J3KRDNKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH4AZ2Y#issuecomment-569904363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMHL3227OMY2MGMHTG4YFWTQ3MMO3ANCNFSM4J3KRDNA .

mthlvt commented 4 years ago

On latest version, I also have the same issue with timeouts that make some of my devices become unavailable (plugs/smartbulbs):

Warning:

Setup of sensor platform meross_cloud is taking over 10 seconds.

Followed by error:

File "/usr/local/lib/python3.7/site-packages/meross_iot/cloud/client.py", line 302, in execute_cmd
    raise CommandTimeoutException("A timeout occurred while waiting for the ACK: %d" % timeout)
albertogeniola commented 4 years ago

Closing here in favour of #42