shenxn / ha-dyson

HomeAssitant custom integration for dyson
MIT License
312 stars 59 forks source link

Cannot Import Name 'DysonPurifierHumidifyCoolFormaldehyde' #164

Open shukarCA opened 2 years ago

shukarCA commented 2 years ago

I have recently installed both the Dyson_local and Dyson_cloud integrations on my HASS OS VM, and they were working great until the system rebooted. Now they are both failing to load and giving the following error in the logs:

Setup failed for custom integration dyson_cloud: Unable to import component: cannot import name 'DysonPurifierHumidifyCoolFormaldehyde' from 'libdyson'(/usr/local/lib/python3.10/site-packages/libdyson/init.py`

I suspect this is related to my newer Dyson fan, an HP07 Purify Hot+Cool, since I had zero issues previously with my older two Pure Cool Link fans.

Please advise on any additional logs or information required and I can provide as needed.

bradyemerson commented 2 years ago

I'm having the same issue and no changes to my previously working fan setup, so don't believe this is related to your new Dyson model.

Setup failed for custom integration dyson_cloud: Unable to import component: cannot import name 'DysonPurifierHumidifyCoolFormaldehyde' from 'libdyson' (/usr/local/lib/python3.10/site-packages/libdyson/init.py) Setup failed for custom integration dyson_local: Unable to import component: cannot import name 'DysonPurifierHumidifyCoolFormaldehyde' from 'libdyson' (/usr/local/lib/python3.10/site-packages/libdyson/init.py)

GitPetri commented 2 years ago

Please advise on any additional logs or information required and I can provide as needed.

Probably worth checking which libdyson version(s) you have in your HA. At least some time back Dyson cloud installed older libdyson than Dyson local. See https://github.com/shenxn/ha-dyson/issues/103#issuecomment-1093901557

bakteriak commented 2 years ago

Thanks, @GitPetri. I was able to install both local and cloud.

I have modified manifest.json

libdyson==0.8.11 originally it was 0.8.7 I think now it matches the version of local.

image

However, got another obstacle. Local was able to pull all information from the cloud, however, when I try to configure local it asks me for the host (I know this should be ignored) and when I press submit I got an unknown error occurred.

image

In the logs, I have found below.

This error originated from a custom integration.

Logger: aiohttp.server Source: custom_components/dyson_local/config_flow.py:246 Integration: Dyson Local (documentation, issues) First occurred: 21:22:09 (3 occurrences) Last logged: 21:23:48

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/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 60, 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 82, 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 136, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, 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 280, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/dyson_local/config_flow.py", line 167, in async_step_host data = await self._async_get_entry_data( File "/config/custom_components/dyson_local/config_flow.py", line 216, 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 246, in _async_try_connect discovery.register_device(device, _callback) File "/usr/local/lib/python3.10/site-packages/libdyson/discovery.py", line 30, in register_device if device.serial in self._discovered: AttributeError: 'NoneType' object has no attribute 'serial'

MarcusKapun commented 1 year ago

Same issue here

dotvezz commented 1 year ago

Unfortunately this integration is no longer maintained, but I've created a new fork and am actively working on the new Formaldehyde models. Have a look at #185 for more information, and let me know if you have any questions.