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
780 stars 122 forks source link

Waiting for device until hassio become sluggish #1116

Open LinuxfarmerHH opened 11 months ago

LinuxfarmerHH commented 11 months ago

Prerequisites

Description

Since 1.3.0 and core 1023.10.5 my home assistant become horrible slow, means you can't do anything without 30 seconds until it happens. You cannot enter more than 3 chars and have to wait 30 seconds to enter the next chars.

Steps to Reproduce

Enable debug in BT and let it work for some time End debug and look into the results

2023-10-31 10:08:43.703 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat HZBT-Wohnzimmer: Starting version 1.3.0. Waiting for entity to be ready... 2023-10-31 10:08:43.703 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat HZBT-Wohnzimmer: waiting for outdoor sensor entity with id 'sensor.z_weather_air_temperature' to become fully available... 2023-10-31 10:08:50.233 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat Heizung Küche: Starting version 1.3.0. Waiting for entity to be ready... 2023-10-31 10:08:50.233 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat Heizung Küche: waiting for humidity sensor entity with id 'sensor.shelly_h_t_2074b1_humidity' to become fully available...

Hint: Temperature and humidity devices are battery powered and awake only through bigger changes.

Expected behavior:

BT should use the latest measurement, what we can see in the device page

BT returns when configured and the lovelace card start with latest measurement

Actual behavior:

BT Config take half an hour from the slugginesh to select devices or type chars. Even the mouse pointer in the browser disappear, to enforce the 30 seconds wait. The better ui card is displayed greyed out for hours, until the temperature or humidity device delivers something new.

The logs points to something BT waits instead of using existing older values. Battery powered devices behave this way and cannot provide continous information, seems not a good idea to run a loop until they report.

Versions

Hassos 11.1 Core 1023.10.5 BT 1.3.0

Additional Information

System is RPi4 in Argon-One with SSD 128GB.

LinuxfarmerHH commented 11 months ago

Update for 1.4.0

From configuration to "startup completed" can take up to 12 hours here, because it's waiting in unnatural state for a device. Means every single reconfiguration of BT or some other hassio update will trigger this behavior. A TRV with internal sensor will only send a temperature, if triggered with adjust before.

Have a Popp Z-Weather device outside, in the winter it will only send values every 4 hours. BT will not start and wait that long.

ValueError: Config entry has already been setup! 2023-11-04 10:07:59.001 INFO (MainThread) [custom_components.better_thermostat.utils.bridge] better_thermostat HZG-Schlafz: intigration: zwave_js isn't native supported, feel free to open an issue, fallback adapter generic 2023-11-04 10:07:59.003 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat HZG-Schlafz: Waiting for entity to be ready... 2023-11-04 10:07:59.003 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat HZG-Schlafz: Starting version 1.4.0. Waiting for entity to be ready...

LinuxfarmerHH commented 11 months ago

Found something else, that seems to belong to issue 1115

Hassio cannot setup a BT in "Wait State" because it's waiting for a device in the background, the UI card turns grey if that happen. In reality you can setup a thermometer / hygrometer but have to wait several hours until the UI card signals "startup completed", it cannot be reconfigured before that.

Reminder: The required values are in the database, there is no urgency to wait for a device.

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 557, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 201, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2023-11-04 10:55:32.038 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry HZG-Bad for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 557, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 201, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 202, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2023-11-04 10:55:32.044 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry HZG-Bad for climate