garbled1 / homeassistant_ecowitt

Ecowitt Weather Station integration for homeassistant
Apache License 2.0
143 stars 70 forks source link

Home Assistant Core 2023.5 breaks integration #157

Open pascaltippelt opened 1 year ago

pascaltippelt commented 1 year ago

When upgrading from 2023.4.X to 2023.5.X, the integration does no longer load. Error message:

Logger: homeassistant.setup Source: setup.py:214 First occurred: 11:26:57 (1 occurrences) Last logged: 11:26:57 Setup failed for custom integration ecowitt: Unable to import component: cannot import name 'async_get_registry' from 'homeassistant.helpers.entity_registry' (/usr/src/homeassistant/homeassistant/helpers/entity_registry.py)

It is impossible to delete the integration (in my case nothing happens an the integration just stays "active"). So the repository can't be removed.

Possebly relatet log-entrys:

2023-05-07 11:30:29.774 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, 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 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 235, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 86, in delete result = await hass.config_entries.async_remove(entry_id) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1072, in async_remove await entry.async_remove(self.hass) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 578, in async_remove component = integration.get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 813, in get_component ComponentProtocol, importlib.import_module(self.pkg_path) File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/ecowitt/init.py", line 20, in from homeassistant.helpers.entity_registry import ( ImportError: cannot import name 'async_get_registry' from 'homeassistant.helpers.entity_registry' (/usr/src/homeassistant/homeassistant/helpers/entity_registry.py)

grafik

My device:

WS2900_V2.01.18 von ecowitt Firmware: EasyWeatherV1.6.4

JohnMcLear commented 1 year ago

see https://github.com/garbled1/homeassistant_ecowitt/issues/155

duplicate plz close

Jonvelle53 commented 1 year ago

I have the same! Any idea - how can I delete the integration?

pascaltippelt commented 1 year ago

see https://github.com/garbled1/homeassistant_ecowitt/issues/155

duplicate plz close

Not entirely. I additionally informed, that I am unable to remove the integration.

CamFlyerCH commented 1 year ago

Same here. I renamed and labeled many sensors. So I have to do that all again !?! I would very much like a fix for anyone using this integration !

ronjtaylor commented 1 year ago

same here. Logger: homeassistant Source: components/sensor/init.py:583 First occurred: May 7, 2023 at 5:38:18 AM (14248 occurrences) Last logged: 6:21:48 AM

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 579, in state numerical_value = int(value) ValueError: invalid literal for int() with base 10: 'unknown'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in async_update_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 583, in state raise ValueError( ValueError: Sensor sensor.pm2_5_2_battery has device class battery, state class measurement unit % and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: unknown (<class 'str'>)

CountOlaf87 commented 1 year ago

Same here, I removed it and when I try to add the integration again, I get: Config flow could not be loaded: {"message":"Invalid handler specified"}

Error log: ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration ecowitt: cannot import name 'async_get_registry' from 'homeassistant.helpers.entity_registry' (/usr/src/homeassistant/homeassistant/helpers/entity_registry.py)

romainlouvet commented 1 year ago

Same and I am not able to remove this integration 😔

rpajik commented 1 year ago

Same and I am not able to remove this integration 😔 Downgrade HA on version 2023.4, it will start working and you will be able to remove it.

RXM307 commented 1 year ago

you can try my fork it is still working in 2023.5 https://github.com/RXM307/homeassistant_ecowitt however I believe Ecowitt is now part of homeassistant core https://github.com/home-assistant/core/tree/dev/homeassistant/components/ecowitt

I haven't tried it myself but have been meaning too

pilehave commented 1 year ago

you can try my fork it is still working in 2023.5 https://github.com/RXM307/homeassistant_ecowitt however I believe Ecowitt is now part of homeassistant core https://github.com/home-assistant/core/tree/dev/homeassistant/components/ecowitt

I haven't tried it myself but have been meaning too

I can't get the official integration to work. Never had problems with the HACS one and the whole webhook thing has me puzzled as to why it is needed.

JohnMcLear commented 1 year ago

I gave up with the official integration and reverted back to HACS as the official integration doesn't support Official Home Assistant Hardware / OS.

pilehave commented 1 year ago

Same thing here. The official integration requires all kinds of reverse proxy if you use https and offers nothing that is not in the HACS version.

rbauman70 commented 1 year ago

Yeah, I guess getting the integration into the core adds more requirements, like maybe not using private listening ports. Anyway, I put in a feature request that would solve the problem. And I have a workaround for using the new core integration. Probably a way to do it with Python also.

RXM307 commented 1 year ago

From what I read the core version also used private listening ports.

On Wed, 14 Jun 2023 at 01:04, rbauman70 @.***> wrote:

Yeah, I guess getting the integration into the core adds more requirements, like maybe not using private listening ports. Anyway, I put in a feature request https://community.home-assistant.io/t/add-webhook-support-on-non-ssl-port-for-integrations/579725 that would solve the problem. And I have a workaround https://github.com/garbled1/homeassistant_ecowitt/issues/154 for using the new core integration. Probably a way to do it with Python also.

— Reply to this email directly, view it on GitHub https://github.com/garbled1/homeassistant_ecowitt/issues/157#issuecomment-1589493992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALJQCYNJEWUSXBPHNTSDX3XLB6OLANCNFSM6AAAAAAXYX4YPM . You are receiving this because you commented.Message ID: @.***>

rbauman70 commented 1 year ago

Since we seem to have lost the author's support, maybe we can revert the core's implementation back to the private port method then? Can you merge your fork?

iNaiks commented 1 year ago

This Worked for me, only need to change 2 lines in the .py of ecowitt and works. Link --> https://github.com/garbled1/homeassistant_ecowitt/issues/155#issuecomment-1609959845