KartoffelToby / better_thermostat

This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.
https://better-thermostat.org
GNU Affero General Public License v3.0
828 stars 126 forks source link

HA 2024.5.x error "Detected blocking call to import_module inside the event loop" #1347

Open stalakerob opened 6 months ago

stalakerob commented 6 months ago

Prerequisites

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2024.5.2", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.12.2", "docker": true, "arch": "x86_64", "timezone": "Europe/Berlin", "os_name": "Linux", "os_version": "6.6.25-haos", "supervisor": "2024.04.4", "host_os": "Home Assistant OS 12.2", "docker_version": "25.0.5", "chassis": "vm", "run_as_root": true }, "custom_components": { "myenergi": { "documentation": "https://github.com/cjne/ha-myenergi", "version": "0.0.27", "requirements": [ "pymyenergi==0.1.1" ] }, "cover_rf_time_based": { "documentation": "https://github.com/nagyrobi/home-assistant-custom-components-cover-rf-time-based", "version": "1.1.3", "requirements": [] }, "tuya_local": { "documentation": "https://github.com/make-all/tuya-local", "version": "2024.5.2", "requirements": [ "tinytuya==1.13.2" ] }, "hacs": { "documentation": "https://hacs.xyz/docs/configuration/start", "version": "1.34.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "blitzortung": { "documentation": "https://github.com/mrk-its/homeassistant-blitzortung", "version": "1.0.1", "requirements": [ "paho-mqtt>=1.5.0" ] }, "scheduler": { "documentation": "https://github.com/nielsfaber/scheduler-component", "version": "v0.0.0", "requirements": [] }, "better_thermostat": { "documentation": "https://github.com/KartoffelToby/better_thermostat", "version": "1.5.1", "requirements": [] }, "alexa_media": { "documentation": "https://github.com/alandtse/alexa_media_player/wiki", "version": "4.9.2", "requirements": [ "alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0" ] } }, "integration_manifest": { "domain": "better_thermostat", "name": "Better Thermostat", "after_dependencies": [ "climate" ], "codeowners": [ "@kartoffeltoby" ], "config_flow": true, "dependencies": [ "climate", "recorder" ], "documentation": "https://github.com/KartoffelToby/better_thermostat", "iot_class": "local_push", "issue_tracker": "https://github.com/KartoffelToby/better_thermostat/issues", "requirements": [], "version": "1.5.1", "is_built_in": false }, "data": { "info": { "name": "Better Thermostat B\u00fcro", "temperature_sensor": "sensor.sonoff_th_buro_temperature", "off_temperature": 20, "tolerance": 0.2, "humidity_sensor": "sensor.sonoff_th_wz_humidity", "outdoor_sensor": "sensor.lumi_temperature_eingang", "window_sensors": null, "weather": null, "cooler": null, "window_off_delay": 0, "window_off_delay_after": 0, "model": "TRVZB" }, "thermostat": { "climate.sonoff_thermostat_buro": { "name": "Sonoff Thermostat B\u00fcro", "state": "heat", "attributes": { "hvac_modes": [ "off", "auto", "heat" ], "min_temp": 4.0, "max_temp": 35.0, "target_temp_step": 0.5, "current_temperature": 23.1, "temperature": 21.0, "hvac_action": "idle", "friendly_name": "Sonoff Thermostat B\u00fcro", "supported_features": 385 }, "bt_config": { "calibration": "local_calibration_based", "calibration_mode": "heating_power_calibration", "protect_overheating": false, "no_off_system_mode": false, "heat_auto_swapped": false, "child_lock": false, "homaticip": false }, "bt_adapter": "mqtt", "bt_integration": "mqtt", "model": "TRVZB" } }, "external_temperature_sensor": { "entity_id": "sensor.sonoff_th_buro_temperature", "state": "23.2", "attributes": { "state_class": "measurement", "unit_of_measurement": "\u00b0C", "device_class": "temperature", "friendly_name": "Sonoff TH B\u00fcro Temperatur" }, "last_changed": "2024-05-07T06:41:05.136384+00:00", "last_reported": "2024-05-07T06:41:05.136384+00:00", "last_updated": "2024-05-07T06:41:05.136384+00:00", "context": { "id": "01HX8WHK3G7QSR8A0KTMPGKPP5", "parent_id": null, "user_id": null } }, "window_sensor": "-" } }

{
  YOUR DEVICE DIAGNOSTICS JSON OUTPUT HERE
}

Description

`Logger: homeassistant.util.loop Quelle: util/loop.py:99 Erstmals aufgetreten: 08:40:00 (3 Vorkommnisse) Zuletzt protokolliert: 08:40:00

Detected blocking call to import_module inside the event loop by custom integration 'better_thermostat' at custom_components/better_thermostat/adapters/delegate.py, line 16: self.adapter = import_module( (offender: /config/custom_components/better_thermostat/adapters/delegate.py, line 16: self.adapter = import_module(), please create a bug report at https://github.com/KartoffelToby/better_thermostat/issues Detected blocking call to import_module inside the event loop by custom integration 'better_thermostat' at custom_components/better_thermostat/model_fixes/model_quirks.py, line 14: self.model_quirks = import_module( (offender: /config/custom_components/better_thermostat/model_fixes/model_quirks.py, line 14: self.model_quirks = import_module(), please create a bug report at https://github.com/KartoffelToby/better_thermostat/issues Detected blocking call to import_module inside the event loop by custom integration 'better_thermostat' at custom_components/better_thermostat/model_fixes/model_quirks.py, line 25: self.model_quirks = import_module( (offender: /config/custom_components/better_thermostat/model_fixes/model_quirks.py, line 25: self.model_quirks = import_module(), please create a bug report at https://github.com/KartoffelToby/better_thermostat/issues`

Steps to Reproduce

Expected behavior:

Actual behavior:

Versions

HA 2024.5.1 & 2024.5.2 BT 1.5.1

Additional Information

stalakerob commented 6 months ago

I wanted to add that this error occurs during HA reboot. BT still seems to work fine though. Regards

velkrosmaak commented 5 months ago

I have the same issue and I think my next step is to remove all of my BT config from the UI and filesystem and try to reinstall and reconfigure it. Will report back!

Edit: I also wonder why so few of us are affected. What's the commonality between our configs?

sleveille4 commented 5 months ago

i too have the same Detected "blocking call to import_module" in my logs.

maybe as nothing is wonrg in use not many do check the logs?

velkrosmaak commented 5 months ago

i too have the same Detected "blocking call to import_module" in my logs.

maybe as nothing is wonrg in use not many do check the logs?

this causes my BT instances to show as Unavailable

I did the full reinstall of BT but the issue remains.

Vergil365 commented 4 months ago

i got the same issue

Der-WU commented 3 months ago

Can confirm. Still getting those errors on startup. But BT did work fine i think.

Mag11c commented 1 month ago

I have the same issue. The log file has a little more information with a hint about the cause of this issue:

2024-10-01 21:35:09.692 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module with args ('custom_components.better_thermostat.adapters.mqtt',) inside the event loop by custom integration 'better_thermostat' at custom_components/better_thermostat/adapters/delegate.py, line 16: self.adapter = import_module( (offender: /config/custom_components/better_thermostat/adapters/delegate.py, line 16: self.adapter = import_module(), please create a bug report at https://github.com/KartoffelToby/better_thermostat/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module

Versions: HA 2024.9.3 BT 1.6.0

Stoepf72 commented 4 weeks ago

Same problem here