BnMcG / HomeAssistant-RoboVac

Component to implement Eufy RoboVac support in Home Assistant
Apache License 2.0
45 stars 14 forks source link

Error after update #4

Closed codypet closed 5 years ago

codypet commented 5 years ago

This was great and was working fine in 0.94.1. Last night I upgraded to 0.94.3 and this component stopped working. I uploaded to the latest component assuming mine was outdated and still no luck. I also cleared my database file hoping it would clear things up.

Config is as follows: `vacuum:

Error is as follows: Sun Jun 16 2019 10:37:53 GMT-0400 (Eastern Daylight Time) eufyrobovac: Error on device update! Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity await entity.async_device_update(warning=False) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 375, in async_device_update await self.async_update() File "/home/homeassistant/.homeassistant/custom_components/eufyrobovac/vacuum.py", line 192, in async_update self._status = possible_states[self.vacuum_state.mode] KeyError: 240

I'm out of ideas. Any thoughts?

BnMcG commented 5 years ago

Try restarting home assistant. I think this error is when the robovac reports a status the component can't map. I'm going to wrap the update function into a try/catch statement to try and alleviate this.

-------- Original Message -------- On 16 Jun 2019, 15:48, codypet wrote:

This was great and was working fine in 0.94.1. Last night I upgraded to 0.94.3 and this component stopped working. I uploaded to the latest component assuming mine was outdated and still no luck. I also cleared my database file hoping it would clear things up.

Config is as follows: `vacuum:

  • platform: eufyrobovac name: RoboVac ip_address: 192.168.0.142 username: xxxxxxxxx@xxxxxx.com password: xxxxxxxx`

Error is as follows: Sun Jun 16 2019 10:37:53 GMT-0400 (Eastern Daylight Time) eufyrobovac: Error on device update! Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity await entity.async_device_update(warning=False) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 375, in async_device_update await self.async_update() File "/home/homeassistant/.homeassistant/custom_components/eufyrobovac/vacuum.py", line 192, in async_update self._status = possible_states[self.vacuum_state.mode] KeyError: 240

I'm out of ideas. Any thoughts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

BnMcG commented 5 years ago

Also try restarting the robovac and making sure it's not trapped anywhere, brushes need replacing, or any of the other errors that the Eufy app sometimes notifies you of.

-------- Original Message -------- On 16 Jun 2019, 15:48, codypet wrote:

This was great and was working fine in 0.94.1. Last night I upgraded to 0.94.3 and this component stopped working. I uploaded to the latest component assuming mine was outdated and still no luck. I also cleared my database file hoping it would clear things up.

Config is as follows: `vacuum:

  • platform: eufyrobovac name: RoboVac ip_address: 192.168.0.142 username: xxxxxxxxx@xxxxxx.com password: xxxxxxxx`

Error is as follows: Sun Jun 16 2019 10:37:53 GMT-0400 (Eastern Daylight Time) eufyrobovac: Error on device update! Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity await entity.async_device_update(warning=False) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 375, in async_device_update await self.async_update() File "/home/homeassistant/.homeassistant/custom_components/eufyrobovac/vacuum.py", line 192, in async_update self._status = possible_states[self.vacuum_state.mode] KeyError: 240

I'm out of ideas. Any thoughts?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

codypet commented 5 years ago

Good call. I had been updating HA and even rebooted the whole pi, but this time I ran the Eufy before restarting and that solved the problem. Thanks!

codypet commented 5 years ago

Seems to throw a different error now. eufyrobovac: Error on device update! Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity await entity.async_device_update(warning=False) File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 375, in async_device_update await self.async_update() File "/home/homeassistant/.homeassistant/custom_components/eufyrobovac/vacuum.py", line 173, in async_update state = self.vacuum.get_status() File "/srv/homeassistant/lib/python3.7/site-packages/robovac/robovac.py", line 158, in get_status robovac_response = self._send_packet(message, True) File "/srv/homeassistant/lib/python3.7/site-packages/robovac/robovac.py", line 326, in _send_packet return Robovac._parse_local_server_message_from_decrypted_response(decrypted_response) File "/srv/homeassistant/lib/python3.7/site-packages/robovac/robovac.py", line 138, in _parse_local_server_message_from_decrypted_response length = struct.unpack("<H", decrypted_response[0:2])[0] struct.error: unpack requires a buffer of 2 bytes

BnMcG commented 5 years ago

Not seen that one before - are there any errors in the Eufy app?

Edit: To add a bit more context, the error is saying that the data received from the Robovac doesn't match the format that's expected - it's not a problem with Home Assistant, but rather the communication from the Robovac to the Python library. The most obvious cause I can think of is the Robovac sending some odd data because of an error state.

codypet commented 5 years ago

Yea the app is working fine. I had just been running my Eufy, but noticed the last communication was 18 hours ago and it wasn't controlling anything. When I restarted HA, it didn't come up at all.
Edit: I'll add I rebooted the whole pi and got the same error.

BnMcG commented 5 years ago

Sorry for the slow uptake, I've been busy at work lately. I've wrapped the update function for the component in a quick-n-dirty try/catch clause. I think this should stop transient errors like the RoboVac returning a status code that HA doesn't recognise from killing the component until you restart HA.

Can you pull the latest custom component from the master branch and see if that helps? If rebooting the Pi didn't clear the problem then I'm wondering if something about the protocol has changed - do you know if your RoboVac has updated recently? I'll fire up Home Assistant myself later today and see if my integration still works. Also worth restarting the RoboVac to see if that helps, just to try and narrow down potential problems.

Other things I can think of :

Cheers.

Edit: I've just confirmed that my RoboVac still integrates with Home Assistant (0.94.4), so the most likely cause given the error above is that the vacuum's IP address has changed.

codypet commented 5 years ago

Its a RoboVac 11c and it appears the IP address is still the same at 192.168.0.142 according to the wifi router.

I'm not aware of the RoboVac updating recently, but it is possible that it updated overnight and I never knew. Reloading the component shows the Eufy as Unavailable, and the app says standby. I restarted the Robovac and I'm still getting the "Unavailable". I get a new set of errors now.

Sat Jun 22 2019 00:18:57 GMT-0400 (Eastern Daylight Time) Failed to update RoboVac status: unpack requires a buffer of 2 bytes

Sat Jun 22 2019 00:19:18 GMT-0400 (Eastern Daylight Time) Failed to update RoboVac status: [Errno 106] Transport endpoint is already connected

That 2 bytes error was on the other one too. Do you know what that's about?

codypet commented 5 years ago

Ohhh weird. I picked it up and put it next to me. Shut if off an turned it back on, and that did the trick. Bizarre. I'll keep an eye out tomorrow if it disconnects again. Edit: Been working reliably for two days now. I think the update you did really smoothed it out! Thanks.