mikey0000 / Mammotion-HA

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

v0.0.22 error fetching data after 2nd poll. #66

Open lackr007 opened 2 months ago

lackr007 commented 2 months ago

The problem

After a mowing starts a task the sensor values update correctly during the first poll (2 min), however the 2nd poll (@ 4 min) home assistant generates a fetching data error, most of the task progress sensor data goes to 0 and the integration stops updating, screen shot below. After monitoring for several hours, it appears that successful polls are very infrequent, every so often it will succeed in updating sensor values (about every 50 mins).

updating sensor (Battery) values (about every 50 mins) image

This error originated from a custom integration.

Logger: custom_components.mammotion Source: helpers/update_coordinator.py:386 integration: Mammotion First occurred: 9:08:23 AM (1 occurrences) Last logged: 9:08:23 AM

Error fetching mammotion data: Could not find device

Stale values after fetching data error... image

What Mammotion mower are you using?

Luba 2

What version of the Mammotion intergration are you using?

v0.0.22

What version of Home Assistant Core are you running?

core- 2024.8.1

mikey0000 commented 2 months ago

Yeah I'm tweaking one of the commands during working, which results in other sensors zeroing out, I'll likely sort this out today.

mikey0000 commented 2 months ago

0.0.23 should resolve this

lackr007 commented 2 months ago

Still an issue on 0.0.24. When device is added all sensor values are updated correctly, but never update again when task is started. Error in log below.

This error originated from a custom integration.

Logger: custom_components.mammotion Source: helpers/update_coordinator.py:386 integration: Mammotion First occurred: 5:58:17 PM (1 occurrences) Last logged: 5:58:17 PM

Error fetching mammotion data: Could not find device

mikey0000 commented 2 months ago

That's a range problem unless you have an esp32 inside your mower?

lackr007 commented 2 months ago

I have the esp32 inside Luba 2, it's powered by Luba also. I have 3 outside wireless access points that keep it connected. The entity sensors worked flawlessly on v0.0.4 and v0.0.5 (wrong units of measure but no big deal). I ran those versions for 3-4 weeks with no issues. I usually downgrade to those versions while the bugs are being worked out. Let me know if you need me to test anything, again thanks for all the hard work.

lackr007 commented 2 months ago

I rebooted and testing again... stand by and I'll do a longer test than i did last time.

lackr007 commented 2 months ago

It seems like rebooting after adding the device seemed to have fixed it as it's updating consistently now. The only error I have in my log is this one....

Logger: homeassistant Source: /usr/src/homeassistant/homeassistant/runner.py:148 First occurred: 8:37:38 PM (38 occurrences) Last logged: 8:37:48 PM

Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 540, in _notification_handler self._update_raw_data(data) File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 197, in _update_raw_data tmp_msg = LubaMsg().parse(data) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 759, in parse value = self._postprocess_single( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 701, in _postprocess_single fmt = _pack_fmt(meta.proto_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 281, in _pack_fmt return { ^ KeyError: 'int32'

lackr007 commented 2 months ago

Ok after working fine for 10 min, I received this error in the log, it stoped updating. I also checked my wifi bluetooth proxy connection to verify no wifi drops and it shows 2 days of uptime, I also verified it did not hop to another AP, I have it mowing next to an ap during this test.

This error originated from a custom integration.

Logger: custom_components.mammotion Source: helpers/update_coordinator.py:386 integration: Mammotion First occurred: 8:45:02 PM (1 occurrences) Last logged: 8:45:02 PM

Error fetching mammotion data: Could not find device

image

image

mikey0000 commented 2 months ago

It seems like rebooting after adding the device seemed to have fixed it as it's updating consistently now. The only error I have in my log is this one....

Logger: homeassistant Source: /usr/src/homeassistant/homeassistant/runner.py:148 First occurred: 8:37:38 PM (38 occurrences) Last logged: 8:37:48 PM

Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 540, in _notification_handler self._update_raw_data(data) File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 197, in _update_raw_data tmp_msg = LubaMsg().parse(data) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 759, in parse value = self._postprocess_single( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 701, in _postprocess_single fmt = _pack_fmt(meta.proto_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 281, in _pack_fmt return { ^ KeyError: 'int32'

Any chance for a full error log on this one?

mikey0000 commented 2 months ago

Ok after working fine for 10 min, I received this error in the log, it stoped updating. I also checked my wifi bluetooth proxy connection to verify no wifi drops and it shows 2 days of uptime, I also verified it did not hop to another AP, I have it mowing next to an ap during this test.

This error originated from a custom integration.

Logger: custom_components.mammotion Source: helpers/update_coordinator.py:386 integration: Mammotion First occurred: 8:45:02 PM (1 occurrences) Last logged: 8:45:02 PM

Error fetching mammotion data: Could not find device

image

image

Can you view the esp32 logs and watch to see if 1. The esp32 is online, and 2. See if it tries to connect/any errors

lackr007 commented 2 months ago

It seems like rebooting after adding the device seemed to have fixed it as it's updating consistently now. The only error I have in my log is this one.... Logger: homeassistant Source: /usr/src/homeassistant/homeassistant/runner.py:148 First occurred: 8:37:38 PM (38 occurrences) Last logged: 8:37:48 PM Error doing job: Task exception was never retrieved (None) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 540, in _notification_handler self._update_raw_data(data) File "/usr/local/lib/python3.12/site-packages/pymammotion/mammotion/devices/mammotion.py", line 197, in _update_raw_data tmp_msg = LubaMsg().parse(data) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 759, in parse value = self._postprocess_single( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 701, in _postprocess_single fmt = _pack_fmt(meta.proto_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/betterproto/init.py", line 281, in _pack_fmt return { ^ KeyError: 'int32'

Any chance for a full error log on this one?

No I rebooted and testing v0.0.4 and seeing if this version is ignoring drops... I think that is what is happening. v0.0.23 doesn't like drops. This is what I found in the log running .4. Logger: pymammotion.mammotion.devices.luba Source: runner.py:190 First occurred: 9:12:10 PM (1 occurrences) Last logged: 9:12:10 PM

Luba-VSCVR9DM (C8:FE:0F:1C:FB:20): Device unexpectedly disconnected; RSSI: 0

This error originated from a custom integration.

Logger: pymammotion.mammotion.devices.luba Source: custom_components/mammotion/coordinator.py:76 integration: Mammotion First occurred: 9:12:15 PM (2 occurrences) Last logged: 9:34:43 PM

Luba-VSCVR9DM (C8:FE:0F:1C:FB:20): Error disconnecting: esp32-bluetooth-proxy-459c00 [3C:71:BF:45:9C:00]: Luba-VSCVR9DM - C8:FE:0F:1C:FB:20 is not connected; RSSI: 0

image

lackr007 commented 2 months ago

It does disconnect from time to time... 21:49:00

This error originated from a custom integration.

Logger: pymammotion.mammotion.devices.luba Source: custom_components/mammotion/coordinator.py:76 integration: Mammotion First occurred: 9:12:15 PM (3 occurrences) Last logged: 9:49:00 PM

Luba-VSCVR9DM (C8:FE:0F:1C:FB:20): Error disconnecting: esp32-bluetooth-proxy-459c00 [3C:71:BF:45:9C:00]: Luba-VSCVR9DM - C8:FE:0F:1C:FB:20 is not connected; RSSI: 0

logs_esp32-bluetooth-proxy-459c00_logs (1).txt

mikey0000 commented 2 months ago

I think part of the issue is we are making more calls than before. Two things coming that would likely improve this. 1. is staying connected, 2. is adding better retry logic. I'll have to go back and stare at v0.0.4 and see if I can see anything that stands out.

mikey0000 commented 1 month ago

Any update on this? Resolved now?

lackr007 commented 1 month ago

I've been running old code, has there been any updates as it relates to connection issues since v0.0.24?

mikey0000 commented 1 month ago

There was one update specifically to try address connection issues. Can try 0.1.18? I'll go back and look at those older releases again.

mikey0000 commented 1 month ago

@lackr007 if you only use bluetooth I've just released an update that lets you keep bluetooth connected, would be good to know if that resolves your problems?

lackr007 commented 1 month ago

Ok great, I'll update to the latest version and give it a try and report back.

mikey0000 commented 1 month ago

any update?

lackr007 commented 1 month ago

Apologies, I had a lot of rain here and wasn't able to mow. Yesterday I installed the latest update, and I have a question. When going through the wizard it had an option of "keep Bluetooth connected", do I select that? Just want to make sure I set it up correctly to test Bluetooth only.

mikey0000 commented 1 month ago

It means with Bluetooth it will no longer disconnect after sending requests, I recommend turning it on, but if you want to control your mower with your phone for example you need to be able to turn it off.

lackr007 commented 1 month ago

My initial test was promising yesterday, I would like to also test the WiFi connection also. How will the new version behave if both WiFi and Bluetooth are available?

mikey0000 commented 1 month ago

It will pick based on if the use WiFi is ticked or not, not ticked, Bluetooth, ticked wifi