libdyson-wg / ha-dyson-cloud

Cloud integration for ha-dyson (https://github.com/libdyson-wg/ha-dyson/)
MIT License
15 stars 2 forks source link

Unable to add device #6

Closed jahnkenneth closed 1 year ago

jahnkenneth commented 1 year ago

Hi, I am unable to add devices. IMG_2933

jahnkenneth commented 1 year ago

IMG_2934

MHohenberg commented 1 year ago

I have the same error ("invalid handler specified" when trying to configure Dyson Cloud)

Logfile says ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration dyson_cloud: cannot import name 'DysonPurifierHumidifyCool' from 'libdyson' (/usr/local/lib/python3.10/site-packages/libdyson/__init__.py)

NickBorgers commented 1 year ago

Same as @MHohenberg

I am someone trying to migrate from shenxn, so am guessing I have a bad reference saved in my configuration after attempting to delete all of that. I have tried many procedures, with the most recent being:

  1. Manually delete all existing devices from Home Assistant; deleting each Dyson Local device + the Dyson Cloud integration
  2. Remove the shenxn integrations from HACS, then replacing the custom repositories with new ones
  3. Install new integrations through HACS
  4. Restart Home Assistant
  5. Try to add new Dyson Cloud integration
  6. Get the "invalid handler specified" error and see this in the logs
dotvezz commented 1 year ago

Very interesting. @NickBorgers I think you may be onto something. The log entry from @MHohenberg That error message would only happen if you're using the old version of libdyson. I wonder if Home Assistant didn't properly remove the old libdyson before installing libdyson-neon (they would both have the same libdyson import path).

For anyone having that error message, can you confirm if the following steps get you cleared up?

  1. Fully uninstall both ha-dyson and ha-dyson-cloud.
    • Remove the repositories from HACS
    • Delete the devices
      1. Restart your Home Assistant
      2. Install ha-dyson (and ha-dyson-cloud if you use it)
NickBorgers commented 1 year ago

I went one step farther in restarts:

  1. Delete devices/integrations in /config/integrations
  2. Restart Home Assistant
  3. Delete HACS integrations and remove custom repositories
  4. Restart Home Assistant
  5. Add HACS custom repositories and install them
  6. Restart Home Assistant
  7. Go to add Dyson Cloud Integration
  8. Get same error and log message
dotvezz commented 1 year ago

Okay, know what, enough people have been dealing with this kind of error that I'm going to change the way the integration uses libdyson. I'll cut a new release soon that vendors the library instead of relying on Home Assistant's venv.

If that doesn't fix the problem, I'll eat my pants.

dotvezz commented 1 year ago

@NickBorgers and @MHohenberg (as well as anyone else facing "invalid handler specified" or import errors): I've cut new releases of this and the cloud integration which vendor the libdyson dependency. Feel free to upgrade and let me know if it helps!

https://github.com/libdyson-wg/ha-dyson/releases/tag/v0.20.0 https://github.com/libdyson-wg/ha-dyson-cloud/releases/tag/v0.19.0

Dexwell commented 1 year ago

Unfortunately still getting Config flow could not be loaded: {"message":"Invalid handler specified"} in version 0.19.0 of ha-dyson-cloud.

dotvezz commented 1 year ago

That's gotta be frustrating. Sorry to bother you for this, but would you be able to set up debug logging (as described in the readme) and share the logs related to Dyson?

dotvezz commented 1 year ago

I released https://github.com/libdyson-wg/ha-dyson-cloud/releases/tag/v0.19.1 which fixes a bug - I don't think it's related to your problem but feel free to update and try it out.

NickBorgers commented 1 year ago

@dotvezz After your updates I was able to successfully execute the no-reconfig flow suggested here.

Thank you!

Dexwell commented 1 year ago

@dotvezz Finally found some time to set it up. Initially kept getting the same message but forgot to install the Local package first. After doing that the latest version works for me too, thanks!

dotvezz commented 1 year ago

@jahnkenneth Just wanted to check and see if your issue was resolved as well.

mkoval commented 1 year ago

Edit: I forgot to re-install libdyson-wg/ha-dyson as well. The fix actually worked for me - thank you!

I'm not jahnkenneth, but I am having the same issue and installing v0.19.1 ~did not~ dit fix it. This is what I ended up doing to resolve the resolve the issue:

  1. Removed the "Dyson Cloud Integration" and "Dyson Integration" repositories from HACS
  2. Manually deleted the dyson_cloud and dyson_local custom_components sub-directories
  3. Restarted home-assistant
  4. Re-added the libdyson-wg/ha-dyson-cloud and libdyson-wg/ha-dyson HACS custom repositories
  5. Installed the "Dyson Cloud Integration" and "Dyson Integration" integration via HACS
  6. Restarted home-assistant again
  7. Added the "Dyson Cloud Integration" integration to home-assistant

In case anyone runs into the same issue that I did (see "edit" above), here is what happened. My first attempt at this failed with the same error as the OP because I forgot to re-install the dyson_local integration. I was able to diagnose this because I found this message in the home-assistant logs:

2023-06-11 09:47:53.935 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration dyson_cloud: No module named 'custom_components.dyson_local'

In case it is helpful to others: I made this mistake because I got confused about two aspects of how this integration works. First, I did not roealize that ha-dyson-cloud internally depends on ha-dyson. Second, I wasn't sure how the names in the HACS and HAAS UIs mapped onto these two repositories.

For the latter point, I made this table to clarify my own understanding. Hopefully it is useful to someone else too:

Github Repository HACS UI HAAS Component HAAS UI
libdyson-wg/ha-dyson Dyson Integration dyson_local Dyson Local
libdyson-wg/ha-dyson-cloud Dyson Cloud Integration dyson_cloud Dyson Cloud

FWIW I personally think it would be clearer if (1) both integrations were in the same repository; (2) ha-dyson was called ha-dyson-local in HACS and (3) "Dyson Local" in HAAS; and (4) the HACS names dropped the work "Integration." Please just interpret this as constructive feedback - I really appreciate all the work you've put into creating and supporting these integrations!

dotvezz commented 1 year ago

FWIW I personally think it would be clearer if (1) both integrations were in the same repository . . .

I actually completely agree with the single-repository approach. Several years ago, before I adopted the repositories from shenxn, they were split up. I don't know the reasoning because I wasn't there at the time, and the commit history isn't super clear, but I'm guessing it came down to wanting to let most of the functionality be provided by a privacy-focused codebase.

Now though, especially as recently released devices require using the Dyson API in order to obtain MQTT credentials, keeping them separate doesn't seem to make as much sense. I've been entertaining the idea of merging them, but for the time being I'm focusing on overhauling the underlying architecture and improving reliability.

Ergonomics of installation and configuration will be a much bigger concern once I've finished the Reliability/QOL overhaul.

dotvezz commented 1 year ago

https://github.com/libdyson-wg/ha-dyson/discussions/49 There's a poll for whether or not to combine the two repositories, feel free to go vote!

dotvezz commented 1 year ago

@mkoval: There's a new Beta release which combines the Cloud and Local functionality: v1.0.0-beta.

If you would like to test it and/or provide feedback, that would be great!

iculookn commented 1 year ago

Installed the Beta, and all seems ok.

Do I now remove the separate "Dyson Cloud" add-on?

dotvezz commented 1 year ago

@iculookn glad it's working! It provides all the features of Dyson Cloud (although you'll have to log in again) so technically the Cloud integration isn't hurting anything.

You should be good to delete it! Although it might make sense to wait for a stable release of v1.0.0 (soon!) before doing that.