ianByrne / HASS-ukho_tides

Home Assistant integration for tide information
MIT License
27 stars 5 forks source link

No longer works after upgrading to HA 2023.5 #16

Closed nharrison00 closed 1 year ago

nharrison00 commented 1 year ago

Upgraded to HA 2023.5 last night and it broke the okho_tides integration (and some others!). On the Settings, Integrations page is shows an error "Failed to set up: Import error".

neilmartin83 commented 1 year ago

Same here - I'll try to get some debug logs up after work later today.

ianByrne commented 1 year ago

Yep I'm seeing the same thing after updating. Will poke about tonight

neilmartin83 commented 1 year ago

Thanks @ianByrne

Here's the log entry:

2023-05-04 17:54:39.683 ERROR (MainThread) [homeassistant.config_entries] Error importing platform config_flow from integration ukho_tides to set up ukho_tides configuration entry: cannot import name 'async_get_registry' from 'homeassistant.helpers.entity_registry' (/usr/src/homeassistant/homeassistant/helpers/entity_registry.py)

It looks like this is related to the deprecation of async_get_registry as used in https://github.com/ianByrne/HASS-ukho_tides/blob/main/custom_components/ukho_tides/config_flow.py#L30 and https://github.com/ianByrne/HASS-ukho_tides/blob/main/custom_components/ukho_tides/config_flow.py#L215

I'm a Python idiot but it might be as simple as just replacing async_get_registry with async_get in those two lines?

nharrison00 commented 1 year ago

Good call neilmartin83, I manually edited config_flow.py to change async_get_registry to async_get in those two places and it now works. Had to restart HA and wait a little bit for the data to populate but otherwise - back to normal.

Neil

Thanks @ianByrne

Here's the log entry:

2023-05-04 17:54:39.683 ERROR (MainThread) [homeassistant.config_entries] Error importing platform config_flow from integration ukho_tides to set up ukho_tides configuration entry: cannot import name 'async_get_registry' from 'homeassistant.helpers.entity_registry' (/usr/src/homeassistant/homeassistant/helpers/entity_registry.py)

It looks like this is related to the deprecation of async_get_registry as used in https://github.com/ianByrne/HASS-ukho_tides/blob/main/custom_components/ukho_tides/config_flow.py#L30 and https://github.com/ianByrne/HASS-ukho_tides/blob/main/custom_components/ukho_tides/config_flow.py#L215

I'm a Python idiot but it might be as simple as just replacing async_get_registry with async_get in those two lines?

jfparis commented 1 year ago

I did the same as @nharrison00 initially but it appears that everything is being renamed "async_get" in the helpers. I posted a PR with small changes to follow the same conventions as in the core of home assistant and make the code slightly more readable

PS: I love your work @ianByrne. Stumbled on in on Tuesday night after some failed scraping attempt

ianByrne commented 1 year ago

Fantastic, many thanks @jfparis ! That change is now merged in, so you should all be able to update through HACS and get it working again.