libdyson-wg / ha-dyson

Home Assistant custom integration for Wi-Fi connected Dyson devices
MIT License
220 stars 25 forks source link

Can't connect to Dyson Pure Cool Link TP02 purifying fan (White/Silver) #86

Open Agile-Travel opened 10 months ago

Agile-Travel commented 10 months ago

It is discovered using my cloud account, and I've identified the IP address via an IP Scanner (has name matching serial # so sure that is correct IP).

I get the error: Failed to connect. The IP Address may be required if your Home Assistant installation is running in a Container or a VM.

No complicated networking or firewalls in between.

image

I've also tried getting my credentials manually and using manual setup, but still can't connect.

Is the Dyson Pure Cool Link TP02 supported?

dotvezz commented 10 months ago

Hi @Agile-Travel! Sorry for the slow reply. The TP02 is supported, but you're not the only person who has reported issues with it in the past few weeks. Are you able to enable debug logging for the integration, then re-attempt connection to the device? That would be awesome!

Let me know if you would like any more info for debug logging.

charlesomer commented 9 months ago

I believe I may have the same issue with a HP04, the debug logs just show:

2023-11-19 02:02:23.276 DEBUG (MainThread) [custom_components.dyson_local.config_flow] Failed to connect to device: 
SungFeng-Huang commented 9 months ago

I have a similar issue with my HP04, while the error message shows "unknown error occurred" and the debug logs are as follow:

2023-11-19 01:58:38.597 ERROR (MainThread) [aiohttp.server] 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/headers.py", line 31, in headers_middleware
    response = 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/http/decorators.py", line 63, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, 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 293, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 422, in _async_handle_step
    result = await self.async_finish_flow(flow, result.copy())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 978, in async_finish_flow
    title=result["title"],
          ~~~~~~^^^^^^^^^
KeyError: 'title'
charlesomer commented 9 months ago

Just tried again and it worked... 🤷‍♂️ No idea why though

ufu- commented 9 months ago

I have the same issue with my Dyson Pure Hot+Cold ( Device model 527 ). Dyson app works and I can ping the address but it looks like setup times out. I have tried config flow and manual setup as well as moving the device in different subnets to no avail. As per what charlesomer posted all I get with debug logging enabled : "2023-11-23 10:20:02.347 DEBUG (MainThread) [custom_components.dyson_local.config_flow] Failed to connect to device:" Nothing after the ":" .

Thanks

dotvezz commented 9 months ago

It feels like something has changed. The past few weeks people have been having difficult-to-reproduce errors with a wide variety of Dyson Fan devices. One thing clear to me is this: I need to improve the error logging to make this easier to reproduce.

I'll get a release out that improves logging, hopefully we can find an answer for you all soon!

dotvezz commented 9 months ago

Okay, better logging is still forthcoming, but in the meantime I wonder if the new release happens to have improved the situation. @ufu- @SungFeng-Huang @Agile-Travel any changes after updating?

dotvezz commented 9 months ago

I've also released the logging improvement in v1.3.4. If you happen to have time, please update then enable debug logging so we can get a clearer picture of what's happening.

Thanks!

Agile-Travel commented 9 months ago

Thanks so much for working on this plugin and this issue.

Here is the updated error when on 1.3.4:

2023-12-02 20:01:37.471 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/config/custom_components/dyson_local/config_flow.py", line 400, in _async_try_connect device.connect(host) File "/config/custom_components/dyson_local/vendor/libdyson/dyson_device.py", line 115, in connect raise DysonConnectTimeout custom_components.dyson_local.vendor.libdyson.exceptions.DysonConnectTimeout During handling of the above exception, another exception occurred: 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/headers.py", line 31, in headers_middleware response = 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/http/decorators.py", line 63, in with_admin return await func(self, request, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, 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 293, in async_configure result = await self._async_handle_step( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/dyson_local/config_flow.py", line 309, in async_step_host data = await self._async_get_entry_data( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/dyson_local/config_flow.py", line 358, in _async_get_entry_data await self._async_try_connect(serial, credential, device_type, host) File "/config/custom_components/dyson_local/config_flow.py", line 404, in _async_try_connect _LOGGER.debug(f"Failed to connect to device: {err.name}, {err}") ^^^^^^^^^^^^ AttributeError: 'DysonConnectTimeout' object has no attribute 'name'

dotvezz commented 8 months ago

@Agile-Travel wow I could have sworn I'd already replied here. I owe you an apology.

In your logs, you're getting DysonConnectTimeout with a whole bunch of noise. The noise is my fault for trying to log the error incorrectly (I fixed that in 1.3.5 lol).

DysonConnectTimeout means that the fan is not acknowledging the connection attempt. This is the first time I've seen that behavior for the TP02, which is frustrating. There isn't much we can do unfortunately. Can you unplug and plug-in your device, then try to connect again?

SungFeng-Huang commented 8 months ago

Okay, better logging is still forthcoming, but in the meantime I wonder if the new release happens to have improved the situation. @ufu- @SungFeng-Huang @Agile-Travel any changes after updating?

Problem solved in v1.3.6! Thanks @dotvezz!

Agile-Travel commented 8 months ago

It still was not able to connect. On mobile so can’t grab logs atm

On Mon, Dec 18, 2023, at 7:51 PM, Sung-Feng Huang wrote:

Okay, better logging is still forthcoming, but in the meantime I wonder if the new release happens to have improved the situation. @ufu- https://github.com/ufu- @SungFeng-Huang https://github.com/SungFeng-Huang @Agile-Travel https://github.com/Agile-Travel any changes after updating?

Problem solved in v1.3.6! Thanks @dotvezz https://github.com/dotvezz!

— Reply to this email directly, view it on GitHub https://github.com/libdyson-wg/ha-dyson/issues/86#issuecomment-1862073561, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQGLNLA2G7FRLHNKZCMVSW3YKEFMVAVCNFSM6AAAAAA655F3H2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRSGA3TGNJWGE. You are receiving this because you were mentioned.Message ID: @.***>

codyc1515 commented 8 months ago

How did you get on with this?

ufu- commented 7 months ago

I hope this will help some of you; I had the issue for quite a long time and nothing seemed to solve it: I kept getting time out errors, and if I checked the IP address it would respond to pings, but the MQTT port seemed close or unavailable ( 1883/TCP ). Finally the solution was to factory reset the unit ( simultaneously hold power on both the unit and the remote for 10 seconds while the device is on ) and re-connect it to wifi and it started to work instantly.

Geoff47 commented 6 months ago

Hi,

I can't connect my HP04 too. It worked fine two month ago.... I treid to factory reset and re-add the HP04 on my mobile app several times but can't detect on homeassitant. Here the debug logs :

Logger: homeassistant.config_entries Source: config_entries.py:605 First occurred: 18:17:17 (1 occurrences) Last logged: 18:17:17 Error unloading entry MyDyson: my_adress_mail@gmail.com (FR) for dyson_local

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 605, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/dyson_local/init.py", line 187, in async_unload_entry device = hass.data[DOMAIN][DATA_DEVICES][entry.entry_id]


KeyError: 'a5a9de0eb6a03cadcc3adff98e121a9a'

Thanks for some help.