zha-toolkit icon indicating copy to clipboard operation
zha-toolkit copied to clipboard

Error during setup of component zha_toolkit with v1.1.14 upgrade

Open travisp opened this issue 1 year ago • 12 comments

Upon upgrading to v1.1.14, I immediately received the following error:

Error during setup of component zha_toolkit
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 660, in async_setup
    await hass.async_add_executor_job(register_services, hass)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 853, in register_services
    hass.services.async_register(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2515, in async_register
    self._hass.verify_event_loop_thread("hass.services.async_register")
  File "/usr/src/homeassistant/homeassistant/core.py", line 463, in verify_event_loop_thread
    frame.report_non_thread_safe_operation(what)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 225, in report_non_thread_safe_operation
    report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'zha_toolkit' calls hass.services.async_register from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#hassservicesasync_register at custom_components/zha_toolkit/__init__.py, line 853: hass.services.async_register(. Please report it to the author of the 'zha_toolkit' custom integration.

travisp avatar Aug 05 '24 22:08 travisp

Same here. Frustrating. Reverting the change here fixed it for me. Looks like too many levels of async ;-).

Just the single change, nothing else needed.

archite avatar Aug 06 '24 02:08 archite

Same for me:

Logger: homeassistant.setup
Quelle: setup.py:404
Erstmals aufgetreten: 04:03:41 (1 Vorkommnisse)
Zuletzt protokolliert: 04:03:41

Error during setup of component zha_toolkit
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 660, in async_setup
    await hass.async_add_executor_job(register_services, hass)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zha_toolkit/__init__.py", line 853, in register_services
    hass.services.async_register(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2515, in async_register
    self._hass.verify_event_loop_thread("hass.services.async_register")
  File "/usr/src/homeassistant/homeassistant/core.py", line 463, in verify_event_loop_thread
    frame.report_non_thread_safe_operation(what)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 225, in report_non_thread_safe_operation
    report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'zha_toolkit' calls hass.services.async_register from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#hassservicesasync_register at custom_components/zha_toolkit/__init__.py, line 853: hass.services.async_register(. Please report it to the author of the 'zha_toolkit' custom integration.

DarthSonic avatar Aug 06 '24 07:08 DarthSonic

Same here. Frustrating. Reverting the change here fixed it for me. Looks like too many levels of async ;-).

Just the single change, nothing else needed.

Reverting did not fix it for me. :-(

kayloehmann avatar Aug 06 '24 07:08 kayloehmann

same problem for me

RenZan avatar Aug 06 '24 10:08 RenZan

same here

ALeXXBody avatar Aug 06 '24 10:08 ALeXXBody

Same here

urosch avatar Aug 06 '24 13:08 urosch

Same here. Frustrating. Reverting the change here fixed it for me. Looks like too many levels of async ;-).

Just the single change, nothing else needed.

Reverting did not fix it for me. :-(

You have to revert to 1.1.12

DarthSonic avatar Aug 06 '24 13:08 DarthSonic

Same error with 1.1.4 version. Back to 1.1.3 is OK. I'm using HA 2024.6.4.

CordoWEB avatar Aug 06 '24 16:08 CordoWEB

#241

dhover avatar Aug 06 '24 17:08 dhover

How do you guys reverting versions? Selecting versions at "redownload" show me the older ones, but unable to change from the current

thelastoth avatar Aug 06 '24 19:08 thelastoth

How do you guys reverting versions? Selecting versions at "redownload" show me the older ones, but unable to change from the current

I am able to just select the previous version and click the "download" button. The version number appears greyed out, which would make it seem like you can't select it, but you can.

travisp avatar Aug 06 '24 19:08 travisp

image You must wait a few seconds before clicking on donwload button ("Télécharger" in french).

CordoWEB avatar Aug 06 '24 19:08 CordoWEB

Thanks - actually I can select any version I want, but when I click on them, it "jump back" to the current after a second, so I'm unable to redownload anything but 1.1.14 :/

EDIT: seems to be a general HACS issue unfortunately, have to wait for a new release of HACS ( if there is no workaround )

thelastoth avatar Aug 07 '24 05:08 thelastoth

image

call this and your're good

collateral87 avatar Aug 07 '24 06:08 collateral87

image

call this and your're good

Indeed - thanks, it was a very useful tip!

thelastoth avatar Aug 07 '24 07:08 thelastoth

Thanks - actually I can select any version I want, but when I click on them, it "jump back" to the current after a second, so I'm unable to redownload anything but 1.1.14 :/

EDIT: seems to be a general HACS issue unfortunately, have to wait for a new release of HACS ( if there is no workaround )

i had the same. just click on 1.1.13, it will jump back to 1.1.14 but if you click download it will work for 1,1.13

eilandert avatar Aug 07 '24 07:08 eilandert

I've refactored some code - hopefully that's fine by the HomeAssistant team's rules. It start fine for me on 2024.07.4 v1.1.15 is released

mdeweerd avatar Aug 07 '24 22:08 mdeweerd

I've refactored some code - hopefully that's fine by the HomeAssistant team's rules. It start fine for me on 2024.07.4 v1.1.15 is released

Still fails for me. I'm thinking the requirements is a bit malformed (>=>):

Setup failed for custom integration 'zha_toolkit': Requirements for zha_toolkit not found: ['pytz>=>2016.10'].

jsermer avatar Aug 07 '24 22:08 jsermer

Enregistreur: homeassistant.setup
Source: setup.py:269
S'est produit pour la première fois: 00:37:20 (1 occurrences)
Dernier enregistrement: 00:37:20

Setup failed for custom integration 'zha_toolkit': Requirements for zha_toolkit not found: ['pytz>=>2016.10'].

same here

RenZan avatar Aug 07 '24 22:08 RenZan

Right, I did not update using hacs and apparently this is not checked in the ci action - I am updating that.

mdeweerd avatar Aug 07 '24 23:08 mdeweerd

Updated in v1.1.16

mdeweerd avatar Aug 07 '24 23:08 mdeweerd

works for me now...thanks for the quick fix

jsermer avatar Aug 07 '24 23:08 jsermer

I have no longer zha_toolkit actions/services available now it seems.

I will revert back to v1.1.12 in the meantime to see if all is back to normal ^^


edit: v1.1.12 is no longer working with HA 2024.8.

So I'm stuck now ;D

RenZan avatar Aug 07 '24 23:08 RenZan

I don't think v1.1.16 completely fixes it. Actions are still not showing up in 2024.8

2024-08-08 10:01:20.666 DEBUG (MainThread) [custom_components.zha_toolkit] DEFAULT_OTAU = /config/zigpy_ota
2024-08-08 10:01:20.666 DEBUG (MainThread) [custom_components.zha_toolkit] Setup services from async_setup
2024-08-08 10:01:20.676 WARNING (MainThread) [py.warnings] /config/custom_components/zha_toolkit/__init__.py:660: RuntimeWarning: coroutine 'register_services' was never awaited
  register_services(hass)

bbayu123 avatar Aug 08 '24 00:08 bbayu123

zha_toolkit.attr_read works only in 1.1.13 on HA 2024.8... UPD: It doesn't. When running the action I'm getting: Error running action Unknown error

Phobos-7 avatar Aug 08 '24 03:08 Phobos-7

I think several of the (distinct) issues listed in this thread may have been resolved in one of the releases leading up to the beta 1.1.19 which was released today. Want to give that a shot and report back?

wbyoung avatar Aug 09 '24 22:08 wbyoung

I think several of the (distinct) issues listed in this thread may have been resolved in one of the releases leading up to the beta 1.1.19 which was released today. Want to give that a shot and report back?

I tested v1.1.19 and attr_write is working fine now.

thank you @wbyoung and @mdeweerd

RenZan avatar Aug 09 '24 22:08 RenZan

1.1.19 is working for me as well.

bbayu123 avatar Aug 11 '24 01:08 bbayu123

Thank you for the feedback. I am closing this issue.

mdeweerd avatar Aug 11 '24 13:08 mdeweerd