CodeFoodPixels / robovac

Add a Eufy RoboVac easily to Home Assistant
Other
110 stars 26 forks source link

Unable to Configure Device #13

Closed cdn4lf closed 9 months ago

cdn4lf commented 10 months ago

Configuration of device fails when device was connected via IP and auto-discovery is being used to identify the device to be configured.

`This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/robovac/config_flow.py:196 Integration: Eufy Robovac (documentation, issues) First occurred: 4:54:49 PM (3 occurrences) Last logged: 7:29:04 PM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, *request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 242, in post return await super().post(request, flow_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 296, in async_configure result = await self._async_handle_step( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 392, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/robovac/config_flow.py", line 196, in async_step_init item_settings[CONF_IP_ADDRESS] = user_input[CONF_IP_ADDRESS]


KeyError: 'ip_address'
`
CodeFoodPixels commented 10 months ago

Oh, so autodiscovery actually finds the IP address of the vacuum too. The vacuums send out a broadcast (every 30 seconds I think) and we can get the IP etc from that. You shouldn't need to set it manually any more.

On Tue, 22 Aug 2023, 00:30 cdn4lf, @.***> wrote:

Configuration of device fails when device was connected via IP and auto-discovery is being used to identify the device to be configured.

`This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/robovac/config_flow.py:196 Integration: Eufy Robovac (documentation, issues) First occurred: 4:54:49 PM (3 occurrences) Last logged: 7:29:04 PM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, *request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 242, in post return await super().post(request, flow_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 296, in async_configure result = await self._async_handle_step( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 392, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/robovac/config_flow.py", line 196, in async_step_init item_settings[CONF_IP_ADDRESS] = user_input[CONF_IP_ADDRESS]


KeyError: 'ip_address'
`

—
Reply to this email directly, view it on GitHub
<https://github.com/CodeFoodPixels/robovac/issues/13>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABEPFVHRZ2JWOSNDFDKKNPDXWPVSZANCNFSM6AAAAAA3ZCEJRQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
cdn4lf commented 10 months ago

@CodeFoodPixels , agreed and understood.

In my case I didn't uninstall and reinstall, I simply downloaded the beta and tried to reconfigure, which caused the error.

hugalafutro commented 10 months ago

uninstalled, reinstalled beta, but I get the vacuum in error state every 20-30 seconds now: image

in ha logs:

2023-08-22 10:34:20.152 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:34:40.185 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:34:40.194 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:36:20.153 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:36:40.182 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:36:40.185 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:38:40.191 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:39:00.171 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:39:00.182 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:39:40.175 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:40:00.154 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:40:20.159 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:40:20.167 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:40:40.171 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:40:40.179 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:41:20.176 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:41:40.171 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:41:40.178 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:42:20.176 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:42:40.171 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:42:40.178 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:43:00.174 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:43:20.176 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:43:20.182 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Connection to [some_string_the_token_i_guess] (192.168.1.205:6668) failed: [Errno 104] Connection reset by peer
2023-08-22 10:43:40.181 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
2023-08-22 10:44:00.169 ERROR (MainThread) [custom_components.robovac.tuyalocalapi] Incomplete read from: [some_string_the_token_i_guess] (192.168.1.205:6668) : 0 bytes read on a total of undefined expected bytes
KyleStilkey commented 10 months ago

I just took a look into my logs and yeah I'm getting the same thing, some reason every so often the device seems to just throw up this connection error like something is not communicating right or blocking it. I have the latest Beta tested too and works in finding my device but noticed it was in error and notice that this error showed up over 1000 times in my logs and looking at the device it seems about every 5 or so minutes it throws back a state error, then docked.

I am wondering if something on our networks blocking this or something in the code or Tuya.

Connection to 68868243f4cfa255d4e2 (192.168.1.200:6668) failed: [Errno 104] Connection reset by peer
Incomplete read from: 68868243f4cfa255d4e2 (192.168.1.200:6668) : 0 bytes read on a total of undefined expected bytes
Update for vacuum.robovac_15c_max fails
Traceback (most recent call last):
  File "/config/custom_components/robovac/tuyalocalapi.py", line 678, in async_connect
    sock.connect((self.host, self.port))
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 938, in async_device_update
    await self.async_update()
  File "/config/custom_components/robovac/vacuum.py", line 287, in async_update
    await self.vacuum.async_get()
  File "/config/custom_components/robovac/tuyalocalapi.py", line 699, in async_get
    return await message.async_send(self, callback)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/robovac/tuyalocalapi.py", line 528, in async_send
    await device._async_send(self)
  File "/config/custom_components/robovac/tuyalocalapi.py", line 766, in _async_send
    await self.async_connect()
  File "/config/custom_components/robovac/tuyalocalapi.py", line 681, in async_connect
    raise ConnectionTimeoutException("Connection timed out") from e
custom_components.robovac.tuyalocalapi.ConnectionTimeoutException: Connection timed out
hugalafutro commented 10 months ago

Again looks like issue with their servers or ratelimiting (I've no idea how often this integration queries the servers) - I was playing around switching the beta and main branches to see what affects the disconnects and suddenly I can't log in with either version

PING home-api.eufylife.com (35.160.202.129): 56 data bytes
^C
--- home-api.eufylife.com ping statistics ---
731 packets transmitted, 0 packets received, 100% packet loss

This is the main reason I keep asking about option to not use the remote tuya at all and be able to put in the token and key manually. This is the integration that does it like that where you do not need the tuya credentials at all, but haven't been updated for the latest HA breaking change - https://github.com/mitchellrj/eufy_robovac

In my personal experience every single device I ever had that relied on remote servers like this failed sooner or later, which is why I got everything on a zigbee network now, with last 2 outliers being Alexa media player and Eufy integrations.

CodeFoodPixels commented 10 months ago

This integration only relies on the remote server for the initial setup. After that, everything is done locally.

I am going to look at adding the key etc manually, I just need to work out the flow.

On Sat, 26 Aug 2023, 11:28 hugalafutro, @.***> wrote:

Again looks like issue with their servers or ratelimiting (I've no idea how often this integration queries the servers) - I was playing around switching the beta and main branches to see what affects the disconnects and suddenly I can't log in with either version

PING home-api.eufylife.com (35.160.202.129): 56 data bytes ^C --- home-api.eufylife.com ping statistics --- 731 packets transmitted, 0 packets received, 100% packet loss

This is the main reason I keep asking about option to not use the remote tuya at all and be able to put in the token and key manually. This is the integration that does it like that where you do not need the tuya credentials at all, but haven't been updated for the latest HA breaking change - https://github.com/mitchellrj/eufy_robovac

In my personal experience every single device I ever had that relied on remote servers like this failed sooner or later, which is why I got everything on a zigbee network now, with last 2 outliers being Alexa media player and Eufy integrations.

— Reply to this email directly, view it on GitHub https://github.com/CodeFoodPixels/robovac/issues/13#issuecomment-1694252482, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEPFVCYBZMUX32CCIQVSF3XXHFWRANCNFSM6AAAAAA3ZCEJRQ . You are receiving this because you were mentioned.Message ID: @.***>

CodeFoodPixels commented 10 months ago

I've added some stuff to the retry logic in the betas that should hopefully reduce the errors. Could folks give it a try please?

hugalafutro commented 10 months ago

Updated to beta4 from 1.0.0 (i think) so far all good. Previous betas it either didn't discover the vacuum or it was taking long to update the state.

On unrelated note: I have a template sensor in HA set up to create a 'virtual' battery sensor for the vacuum, like this:

template:
  - sensor:
      - name: "RoboVac Battery Level"
        unique_id: my_unique_id_blah  # optional; allows more configuration to entity e.g. icon customization to occur via UI
        state: "{{ state_attr('vacuum.robovac', 'battery_level') }}"
        unit_of_measurement: "%"
        state_class: measurement
        device_class: battery

no idea how often HA polls it, was just wondering if that can't contribute to the timeouts I was getting?

Also just want to say thanks a lot for your continuing work on this, much appreciated!

KyleStilkey commented 10 months ago

Logger: custom_components.robovac.tuyalocalapi Source: custom_components/robovac/tuyalocalapi.py:696 Integration: Eufy Robovac (documentation, issues) First occurred: September 6, 2023 at 8:59:45 PM (2 occurrences) Last logged: 3:00:49 AM

Connection to 68868243f4cfa255d4e2 (192.168.1.200:6668) failed: [Errno 104] Connection reset by peer

This is the only errors I'm getting related to it now, I'm not seeing hundreds of log entries over the past day of running this like I was before. My guess is when this error happens it's probably related more to the device having communication issues when it got pinged at those times, unless you think otherwise.

Some from my experience, it's a lot better so far.

CodeFoodPixels commented 10 months ago

no idea how often HA polls it, was just wondering if that can't contribute to the timeouts I was getting?

Possibly, if it was doing it too quick for the vacuum to keep up

This is the only errors I'm getting related to it now, I'm not seeing hundreds of log entries over the past day of running this like I was before. My guess is when this error happens it's probably related more to the device having communication issues when it got pinged at those times, unless you think otherwise.

Yeah, it's just the vacuum having some communication issues. I've added some logic to retry a few times before throwing an error, so hopefully it should be a little better

KyleStilkey commented 10 months ago

no idea how often HA polls it, was just wondering if that can't contribute to the timeouts I was getting?

Possibly, if it was doing it too quick for the vacuum to keep up

This is the only errors I'm getting related to it now, I'm not seeing hundreds of log entries over the past day of running this like I was before. My guess is when this error happens it's probably related more to the device having communication issues when it got pinged at those times, unless you think otherwise.

Yeah, it's just the vacuum having some communication issues. I've added some logic to retry a few times before throwing an error, so hopefully it should be a little better

Yeah I figured much, but so far my logs are a lot cleaner with Beta 4.

CodeFoodPixels commented 9 months ago

Logs should be much cleaner with beta 5

hugalafutro commented 9 months ago

beta5 works great so far, updated from 1.0.0 as the other betas were giving me lots of disconnects, but beta5 has been rock solid so far.

CodeFoodPixels commented 9 months ago

Released in v1.1.0