mikey0000 / Mammotion-HA

Home Assistant integration for Luba, Luba 2 and Yuka (Mammotion) lawn mowers
145 stars 20 forks source link

Stopped update of values after one day #152

Open tomcsi opened 1 week ago

tomcsi commented 1 week ago

The problem

Hello,

If I restart the HA, then the integration works fine, but not updating the values after 1 day.

Logs:

Logger: pymammotion.aliyun.cloud_gateway
Source: /usr/local/lib/python3.12/site-packages/pymammotion/aliyun/cloud_gateway.py:686
First occurred: September 23, 2024 at 17:04:41 (758 occurrences)
Last logged: 10:01:49

Error in sending cloud command: 500 - None
Error in sending cloud command: 20056 - None
Error in sending cloud command: 29003 - None

home-assistant_2024-09-24T08-03-07.387Z.log.zip

What Mammotion mower are you using?

Luba 2

What version of the Mammotion intergration are you using?

v0.1.45

What version of Home Assistant Core are you running?

core-2024.9.2

mikey0000 commented 1 week ago

Are you using the same account anywhere else?

tomcsi commented 1 week ago

No, I created new account, and share lubas to them.

tomcsi commented 1 week ago

But there are two Luba2, could this be a problem? Let be two different account?

mikey0000 commented 1 week ago

Ahh yeah there is an issue at the moment with additional devices on the same account. I'm going to fix it but I need to change a bit

tomcsi commented 1 week ago

Thanks, I will change account on second luba2 until. :)

tomcsi commented 1 week ago

I try to add two luba2 with different account, but only one of them updating continuously, the one of them always stuck.

mikey0000 commented 1 week ago

Yeah sorry still some bugs/issues with two devices, one of the next things I'll be fixing. Just been really sick all week.

tomcsi commented 1 week ago

Thanks, and get well fast. 🙂

sgurgul commented 5 days ago

I am having only a single LUBA1 device and observing exactly the same behaviour. After dozens of hours of perfect operation the integration stop getting any updates from sensors. image This is in sync with 29003 cloud_gateway error which is being reported regularly from the moment when it occurs first time. image

The integration is using dedicated Mammotion account - I am sharing the device with this account.

mibr85 commented 4 days ago

with only one LUBA 2 same issue come up after one day V 0.1.50

Bildschirmfoto 2024-10-01 um 18 01 50

i sent you the debug file on discord mikey0000

lackr007 commented 4 days ago

I am also having the same issues described above, I only have 1 LUBA2. Sensors stop updating after 1 day. Only a HA reboot fixes the problem, using version 0.1.46. Attempting to disable and re enable the integration does not work, have to reboot HA prior to mowing each day as I have Automations that reference this integration.

Logs below...

Logger: pymammotion.aliyun.cloud_gateway Source: /usr/local/lib/python3.12/site-packages/pymammotion/aliyun/cloud_gateway.py:528 First occurred: September 29, 2024 at 6:42:10 PM (2425 occurrences) Last logged: 11:09:09 AM

{'code': 2401, 'id': 'b39458f7-693f-48fc-a623-c05d7ae72f8b', 'localizedMsg': 'refreshToken invalid!!', 'message': 'refreshToken invalid!!'} {'code': 2401, 'id': '6813bad9-341c-4c27-8628-deb7af600eee', 'localizedMsg': 'refreshToken invalid!!', 'message': 'refreshToken invalid!!'} {'code': 2401, 'id': '71d0af4c-927e-41f9-958a-925705cfbe3f', 'localizedMsg': 'refreshToken invalid!!', 'message': 'refreshToken invalid!!'} {'code': 2401, 'id': 'b2ff46e3-73f5-4a30-a5e8-6aed70f0829b', 'localizedMsg': 'refreshToken invalid!!', 'message': 'refreshToken invalid!!'} {'code': 2401, 'id': '82ff5972-f36b-4f02-9013-00b3037cc23a', 'localizedMsg': 'refreshToken invalid!!', 'message': 'refreshToken invalid!!'}

This error originated from a custom integration.

Logger: custom_components.mammotion Source: helpers/update_coordinator.py:354 integration: Mammotion (documentation, issues) First occurred: September 29, 2024 at 6:42:10 PM (2425 occurrences) Last logged: 11:09:09 AM

Unexpected error fetching mammotion data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mammotion/coordinator.py", line 366, in _async_update_data await self.async_send_command("get_report_cfg") File "/config/custom_components/mammotion/coordinator.py", line 249, in async_send_command await self.manager.send_command_with_args( File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 273, in send_command_with_args return await device.cloud().command(key, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/base.py", line 234, in command return await self.queue_command(key, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 227, in queue_command return await future ^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 78, in process_queue result = await self._execute_command_locked(iot_id, key, command) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 94, in _execute_command_locked await self.loop.run_in_executor(None, self._mqtt_client.get_cloud_client().send_cloud_command, iot_id, command) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/aliyun/cloud_gateway.py", line 640, in send_cloud_command self.check_or_refresh_session() File "/usr/local/lib/python3.12/site-packages/pymammotion/aliyun/cloud_gateway.py", line 529, in check_or_refresh_session raise Exception("Error check or refresh token: " + response_body_dict.str()) Exception: Error check or refresh token: {'code': 2401, 'id': 'b9524521-3cba-427e-b618-3b1f54b30f22', 'localizedMsg': 'refreshToken invalid!!', 'message': 'refreshToken invalid!!'}

This error originated from a custom integration.

Logger: custom_components.mammotion Source: helpers/update_coordinator.py:354 integration: Mammotion (documentation, issues) First occurred: September 29, 2024 at 9:45:55 AM (17 occurrences) Last logged: September 29, 2024 at 7:03:19 PM

Unexpected error fetching mammotion data Traceback (most recent call last): File "/config/custom_components/mammotion/coordinator.py", line 249, in async_send_command await self.manager.send_command_with_args( File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 273, in send_command_with_args return await device.cloud().command(key, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/base.py", line 234, in command return await self.queue_command(key, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 227, in queue_command return await future ^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 78, in process_queue result = await self._execute_command_locked(iot_id, key, command) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion_cloud.py", line 94, in _execute_command_locked await self.loop.run_in_executor(None, self._mqtt_client.get_cloud_client().send_cloud_command, iot_id, command) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/aliyun/cloud_gateway.py", line 692, in send_cloud_command raise SetupException(response_body_dict.get("code")) pymammotion.aliyun.cloud_gateway.SetupException: 29003

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/mammotion/coordinator.py", line 366, in _async_update_data await self.async_send_command("get_report_cfg") File "/config/custom_components/mammotion/coordinator.py", line 253, in async_send_command await self.async_login() File "/config/custom_components/mammotion/coordinator.py", line 333, in async_login await self.manager.login_and_initiate_cloud(account, password, True) File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 178, in login_and_initiate_cloud cloud_client = await self.login(account, password) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 239, in login await loop.run_in_executor( File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymammotion/aliyun/cloud_gateway.py", line 158, in get_region response = client.do_request("/living/account/region/get", "https", "POST", None, body, RuntimeOptions()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/alibabacloud_iot_api_gateway/client.py", line 132, in do_request raise UnretryableException(_last_request, _last_exception) Tea.exceptions.UnretryableException: HTTPSConnectionPool(host='api.link.aliyun.com', port=443): Read timed out. (read timeout=5.0)

mikey0000 commented 4 days ago

Can you please try 0.1.55 thanks

tomcsi commented 4 days ago

Can you please try 0.1.55 thanks

I tried it, but the problem is still yet.

sgurgul commented 4 days ago

@tomcsi How could you know already if the release was published 6 hours ago and the ticket relates to problem of disappearing connection after 1 day ? :) There might be some other issue you want to report, unless you have exactly the same error logs after <6 hours.

tomcsi commented 4 days ago

@sgurgul I have installed to 0.1.55 in the morning, and updating has stopped.

CleanShot 2024-10-02 at 12 57 57 CleanShot 2024-10-02 at 12 58 17

mikey0000 commented 3 days ago

Going to need logs

tomcsi commented 3 days ago

I attached today logs.

home-assistant_2024-10-02T18-55-29.966Z.log

mikey0000 commented 3 days ago

Couple things in your log that are helpful but not for this issue unfortunately. Do a reload or reconfigure and turn debugging on. There is a protobuf error but Unfortunately no log of what it failed on. I'm going to push out a release that will fix some of the issues seen in your log.

mikey0000 commented 3 days ago

managed to track down the protobuf error, so that will be solved now.

mikey0000 commented 3 days ago

Please update to 0.1.58

tomcsi commented 3 days ago

I updated, but the issue is still exists.

home-assistant_2024-10-03T07-56-55.119Z.log

mikey0000 commented 3 days ago

I've taken a quick look from my phone, I've encountered something similar once, disable the integration, log into your phone app with the same account, logout. Wait at least 24 hours and re-enable and see if it fixes it. I'll do some deeper diving tomorrow.

tomcsi commented 6 hours ago

I tried as you wrote above, but one of the two luba 2 still does not update.

mikey0000 commented 5 hours ago

I'm working on multiple device support now. So hold tight