mdeweerd / zha-toolkit

🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant
GNU General Public License v3.0
170 stars 17 forks source link

Detected blocking call to import_module inside the event loop by custom integration 'zha_toolkit' #224

Open luke7101 opened 2 months ago

luke7101 commented 2 months ago

Core v2024.5.0 Every call to zha_toolkit generates this error:

[homeassistant.util.loop] Detected blocking call to import_module inside the event loop by custom integration 'zha_toolkit' at custom_components/zha_toolkit/default.py, line 33: m = importlib.import_module(f".{module_name}", package=package_name) (offender: /config/custom_components/zha_toolkit/default.py, line 33: m = importlib.import_module(f".{module_name}", package=package_name)), please create a bug report at https://github.com/mdeweerd/zha-toolkit/issues
mdeweerd commented 2 months ago

Thank you for reporting this.

It seems that HA now added a requirement to do imports inside a task.

https://github.com/home-assistant/core/issues/116425#issuecomment-2085697174 https://github.com/frenck/spook/pull/722/files

I have other priorities to handle. If somebody wants to fix and and propose a PR, that'ld be welcome.

luke7101 commented 2 months ago

I don't have the skills to do so, sorry...

ChristBKK commented 2 months ago

Yes same warning all day

mdeweerd commented 2 months ago

In the mean time, I think that the log level for homeassistant.util.loop] could be set to "error" to stop filling the logs.

fbalesse commented 2 months ago

Same issue keep on Core v2024.5.1

erkr commented 2 months ago

If somebody wants to fix and and propose a PR, that'ld be welcome.

I would love to help but haven't the required knowledge.

CordoWEB commented 1 month ago

I have other priorities to handle. If somebody wants to fix and and propose a PR, that'ld be welcome.

Can we still hope for a new version in the coming weeks? If I could have helped you, I would have :)

ChristBKK commented 1 month ago

I have other priorities to handle. If somebody wants to fix and and propose a PR, that'ld be welcome.

Can we still hope for a new version in the coming weeks? If I could have helped you, I would have :)

What I don't get considering how important this tool is for some ZHA integrations. Why is ZHA not taking this tool and integrating it into the ZHA main repo. Any reasons they don't?

This tool is a great addition to make ZHA even better.

So the ZHA owners could maintain it?

But yeah maybe there is a reason for that and I don't understand that.

nathan-curtis commented 1 month ago

It's a custom integration. HA core Devs generally don't adopt custom integrations like that. Instead the author elects it for inclusion if they wish to. But realize that adds extra requirements to the Devs time and many custom integration authors generally aren't interested.

If the author has no intention to do so - HA won't add extra work for themselves... They're already manpower constrained.

CordoWEB commented 1 month ago

It's a custom integration. HA core Devs generally don't adopt custom integrations like that. Instead the author elects it for inclusion if they wish to. But realize that adds extra requirements to the Devs time and many custom integration authors generally aren't interested.

The big problem is that the ZHA integration is missing functionality like reading in entity "not exposed" Cluster / Attribute.

nathan-curtis commented 1 month ago

Then open a bug against zha to get the. To add the functionality. Slurping up a custom integration isn't how functions get tagged to HA.

erkr commented 1 month ago

Then open a bug against zha to get the. To add the functionality. Slurping up a custom integration isn't how functions get tagged to HA.

No for additions it's a feature requests, not a bug.

CordoWEB commented 1 month ago

The subject of the topic "Detected blocking call to import_module inside the event loop by custom integration 'zha_toolkit'" is a bug.

erkr commented 1 month ago

@CordoWEB my reply was on having ZHA toolkit functions added to ZHA, that is a feature request. This issue is deprecation. Little harsh to call it a bug, but you are right (it's more maintenance).

CordoWEB commented 1 month ago

Thanks a lot to @benschumacher for his work. His patch work fine on 2024.5.x HAS 👍

ChristBKK commented 1 month ago

@mdeweerd can you push this update so it shows up via HACS?

elupus commented 1 month ago

Note. Next on need to be fixed too. Open calls of files.

[homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'zha_toolkit' at custom_components/zha_toolkit/utils.py, line 84: with open(fname, encoding="utf_8") as infile: (offender: /config/custom_components/zha_toolkit/utils.py, line 84: with open(fname, encoding="utf_8") as infile:), please create a bug report at https://github.com/mdeweerd/zha-toolkit/issues
CordoWEB commented 1 month ago

Note. Next on need to be fixed too. Open calls of files.

You have this error when you call what service ?

elupus commented 1 month ago

Just startup. (New warning in beta of home Assistant)

CordoWEB commented 1 month ago

I do not have this error with HAS 2024.5.x. I have just apply the patch provided by @benschumacher and all work fine.

elupus commented 1 month ago

I do not have this error with HAS 2024.5.x. I have just apply the patch provided by @benschumacher and all work fine.

Its in 2024.6.0 beta

erkr commented 1 month ago

I do not have this error with HAS 2024.5.x. I have just apply the patch provided by @benschumacher and all work fine.

Its in 2024.6.0 beta

@elupus Please don't add new issues into this one. Make a new issue please.

I guess this issue won't be fixed in core, it requires a new toolkit version with the patch as provided by
@benschumacher

CordoWEB commented 1 month ago

@elupus : When you'll add your new issue, could you make the same test when HA 2024.6.0 final version will be available ?

elupus commented 1 month ago

@elupus : When you'll add your new issue, could you make the same test when HA 2024.6.0 final version will be available ?

Probably not. I dont use the integration anymore. So ive disabled it. Just wanted to give a heads up . The warning will guaranteed remain in final version (im part of ha member team)

CordoWEB commented 1 month ago

@mdeweerd Where are you ? We need you ! @mdeweerd Où es tu ? Nous avons besoin de toi ! Nous pouvons t'aider mais il faut nous guider. Rien de grave j'espère.

avibarilan commented 2 weeks ago

Thanks a lot to @benschumacher for his work. His patch work fine on 2024.5.x HAS 👍

Sorry for being such a noob, i am not a developer and do not have any coding knowledge i just have an urgent need to get the zha toolkit working again so that i can "cast tuya magic spell" on a deivce. can you please guide me on how to apply this patch?