FreshlyBrewedCode / hacs-homee

a Home Assistant custom component to integrate the homee smart home platform
MIT License
17 stars 6 forks source link

Error configuring homee integration with HA version 8 #12

Closed mesistostefre closed 1 year ago

mesistostefre commented 2 years ago

In core version 2022.7.1, Home Assistant OS 8.2 the latest version of this homee integration (1.4.1) does not load because the configuration fails: "TypeError: As of 3.10, the loop parameter was removed from Queue() since it is no longer necessary" As a result, the config flow can't be loaded

This is a new issue likely introduced with HA 8 since the Homme integration worked just fine in versions 6 and 7

FreshlyBrewedCode commented 2 years ago

Thanks for reporting this issue. Unfortunately, I don't have time to look into the problem. But it sounds like it may be a relatively easy fix, so any help would be appreciated.

Stklingner commented 1 year ago

I've fixed up pymee in my fork and tested it standalone; all good (asyncio version change removed the loop as a param).

But: I can't seem to install it as a req from the repository in HA so haven't tested it with the component itself.

FreshlyBrewedCode commented 1 year ago

@Stklingner If you submit a PR for pymee I can merge it and release the new version on PyPi so it might be easier to test with HA. However, I have not looked into any of this for a long time so I won't be able to help with testing.

mesistostefre commented 1 year ago

I did find a reference to "loop" in lines 44 and 54 of file init.py and relate them to the error message "TypeError: As of 3.10, the loop parameter was removed " ... though ... I could not even find folder "/usr/local/lib/python3.10". All I see is /usr/local/lib/python3.9. :-/

I'm not familiar enough with homeassistant coding to be able to help, but am more than happy to help with testing ... if that is of value.

FreshlyBrewedCode commented 1 year ago

Both pymee and the integration need their dependencies bumped and tested against Python 3.10. I have not looked into HA development for a long time so there might be other things that need to be changed. I still won't work on this issue but happy to accept any PRs...

Stklingner commented 1 year ago

There still seems to be some sort of hang in the integration set-up; will have a look this weekend.

Stklingner commented 1 year ago

Spent about half a day on this - although pymee's working just fine the set-up flow call to homee.run() in validate_and_connect() never gets the homee.wait_until_connected() event and just hangs until HA closes the socket...

There's probably something obvious I'm missing - I've tried a direct hass.loop.create_task(homee.run()) and that never gets the await either (works just fine in Pymee) - any clues?

FreshlyBrewedCode commented 1 year ago

If pymee does work standalone them maybe something changed with the way HA handles async tasks. Although it looks like hass.async_create_task is still around. Also since the loop parameter was removed from the asyncio.Event class maybe some adjustments need to be made to homee._connected_event/homee.wait_until_connected().

Did you try to debug the websocket connection when running in HA? E.g. by using a debugger or logging the events in Homee?

Stklingner commented 1 year ago

Strange - added debug to config and restarted to have a closer look and all of a sudden it works?

Will dig around and figure it out, tidy up and send a PR

Stklingner commented 1 year ago

Have narrowed it down to something to do with HACs cleanup and restarting again and again...

New problem: the token expires and won't renew until restart so will look at that

Plus: I've implemented covers, thinking about doing sensors too for power consumption

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.5.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

mesistostefre commented 1 year ago

Very cool. I just upgraded to 1.5.0 The upgrade itself went just fine and the integration initializes completely. Just FYI: I do find an error log "unable to prepare setup for homee.sensor: Platform not found (no module named 'custom_components.homee.sensor')" In a next step, I'll remove the homee integration completely and reinstall.

Stklingner commented 1 year ago

Ah, sorry - I forgot to remove that during the tidy-up; I'm taking a crack at getting the sensors in from the node attributes

The message is harmless and the error shouldn't affect the rest of the platforms