HomeAssistant-RoboVac
HomeAssistant-RoboVac copied to clipboard
Transport Endpoint is Already Connected
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
await self.async_device_update()
File "/usr/src/app/homeassistant/helpers/entity.py", line 375, in async_device_update
await self.async_update()
File "/config/custom_components/eufyrobovac/vacuum.py", line 173, in async_update
state = self.vacuum.get_status()
File "/config/deps/lib/python3.7/site-packages/robovac/robovac.py", line 157, in get_status
message = self._build_get_device_status_user_data_message()
File "/config/deps/lib/python3.7/site-packages/robovac/robovac.py", line 284, in _build_get_device_status_user_data_message
magic_number = self._get_magic_number()
File "/config/deps/lib/python3.7/site-packages/robovac/robovac.py", line 300, in _get_magic_number
pong = self._send_packet(ping, True)
File "/config/deps/lib/python3.7/site-packages/robovac/robovac.py", line 318, in _send_packet
self.connect()
File "/config/deps/lib/python3.7/site-packages/robovac/robovac.py", line 153, in connect
self.s.connect((self.ip, self.port))
OSError: [Errno 106] Transport endpoint is already connected
I too am getting this error now after months of working fine. Any ideas?
Wed Jul 17 2019 23:03:39 GMT-0400 (Eastern Daylight Time) Failed to update RoboVac status: [Errno 106] Transport endpoint is already connected Connection lost. Reconnecting…
Have you tried restarting Home Assistant and the Robovac? I think that's how I "fixed" this when it happened to me, I'll take a look at making the code a bit more robust.
Yea I restarted it because in the past, that's historically fixed the problem. Then I assumed maybe the Robovac wasn't connecting to the server, but that's not the problem either. I don't have any other errors so this one is a head scratcher for me.
What version of Home Assistant are you using?
0.95.4 right now, and it's been working fine for the last few weeks. I'm wondering if it's related to something Eufy did. I didn't go to 0.96.0 yet.
OK - don't upgrade to 0.96.0 quite yet - there's some sort of bug either in this package or Home Assistant itself where it doesn't correctly download the required Python module in 0.96.0, but this doesn't happen in 0.95.4.
I've been looking at that bug today and I can confirm that HA 0.95.4 works fine for me locally using the Robovac component, so it shouldn't be any changes Eufy have made unless your Robovac has received an update mine hasn't for some reason.
Just to clarify, have you restarted both Home Assistant and the Robovac?
Yes, I have but will try it again when I get home from work in case it was something going on with my machine last night.
How are you running Home Assistant, by the way? As far as I know this error should be transient and not persist across reboots, as I think it's to do with a socket already being in use.
Hassbian on a Raspberry Pi3 running Python 3.7.3.
I went back and verified that my Eufy was connected to the right wifi router, and not the repeater, at the correct IP address, restarted it, and rebooted the whole pi. Still the same issue. Its bizarre because this hasn't been a problem since you refreshed the layout about a month ago until now.
More Errors: (Hadn't seen this 2 bytes one before)
Thu Jul 18 2019 22:49:04 GMT-0400 (Eastern Daylight Time) Failed to update RoboVac status: unpack requires a buffer of 2 bytes Thu Jul 18 2019 22:51:51 GMT-0400 (Eastern Daylight Time) Failed to update RoboVac status: [Errno 106] Transport endpoint is already connected
OK, I've taken a closer look at the error and it's a problem in the underlying Python library that communicates with the Robovac, not a problem with Home Assistant or the custom component.
The code is written such that it tries to send the instruction to the Robovac, and if that fails for whatever reason, there's a catch-all where it will then try to connect to the Robovac and then send the instruction again. I think what's happening is that sending the packet is failing for other reasons, the catch-all is triggered, it tries to reconnect, and then that fails because the connection already exists.
I'll see if I can narrow down which exceptions are thrown in order to better handle errors.
I've tagged a v0.1.2 release of the custom component - this uses the 0.0.9 version of the PyRobovac library that I just released, which has slightly more robust error handling and better logging of the actual exceptions that occurred.
Can you try upgrading the custom component for me, restarting Home Assistant and seeing how you get on? I don't think there's a reliable way to reproduce this so it might just be a case of waiting and seeing if the transport error comes back.
If you could periodically skim through your logs and see if any exceptions are logged relating to connecting to the Robovac, that'd be great as well - it'd be good to know what's causing the communication to fail.
The buffer error you posted will occur when the Robovac sends back some data that's not in the format the library expects. I've not exactly worked out when this happens, but it does occur once in a while - I think it may be sending back some sort of error, but that's just a guess.
Alright. Now we have some errors. I don't know what a file descriptor or a pipe is though.
Fri Jul 19 2019 23:07:33 GMT-0400 (Eastern Daylight Time) Failed to update RoboVac status: unpack requires a buffer of 2 bytes Fri Jul 19 2019 23:07:54 GMT-0400 (Eastern Daylight Time) [Errno 32] Broken pipe Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/robovac/robovac.py", line 324, in _send_packet self.s.send(encrypted_packet_data) BrokenPipeError: [Errno 32] Broken pipe Fri Jul 19 2019 23:10:00 GMT-0400 (Eastern Daylight Time) [Errno 9] Bad file descriptor Traceback (most recent call last): File "/srv/homeassistant/lib/python3.7/site-packages/robovac/robovac.py", line 324, in _send_packet self.s.send(encrypted_packet_data) OSError: [Errno 9] Bad file descriptor Fri Jul 19 2019 23:10:00 GMT-0400 (Eastern Daylight Time) Failed to update RoboVac status: [Errno 9] Bad file descriptor
The file descriptor errors are to do with a bug I introduced in the underlying library while fixing the transport errors - I think I have a fix for it I'll push out this morning. Once that's fixed you may still see the broken pipe errors but I don't think they'll impact the functionality.
Ok restarting HA today and I lost the Eufy altogether and I think I know what part of the problem is. When I log into my wifi router there's no Eufy. Not in the IP I have reserved for it, not anywhere. Eufy in the app still says its connected to my wifi router, and still works in the app. I don't know why its not showing up in the router settings. I suspect with that missing, the HA configuration doesn't see it either and therefore that's why its not working in HA. I just.....don't know why the router says the Eufy isn't there.
Might just be the router interface, have you tried pinging the Vac from the command line? If it’s still showing connected on the app it must be there somewhere..
So when I ping, something is reporting back right away so....I don't know what's going on.
So Eufy started showing back up in my router again at the proper IP address, matching the login information and it still doesn't show up and it still gives me the same errors. How is everyone faring with 0.96?
There is an update coming to the underlying module that serves this custom_component, hopefully won't be long until it's released. It will still give an occasional error in the logs, but seems to work okay.