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
846 stars 128 forks source link

Catch Error if Termostat is unavailable #1390

Open StormCh opened 2 months ago

StormCh commented 2 months ago
2024-09-13 06:20:28.571 ERROR (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: ERROR controlling: climate.heizung_bad_gross
Traceback (most recent call last):
  File "/config/custom_components/better_thermostat/utils/controlling.py", line 53, in control_queue
    _temp = await control_trv(self, trv)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/better_thermostat/utils/controlling.py", line 231, in control_trv
    _current_calibration_s = await get_current_offset(self, heater_entity_id)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/better_thermostat/adapters/delegate.py", line 55, in get_current_offset
    return await self.real_trvs[entity_id]["adapter"].get_current_offset(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/better_thermostat/adapters/mqtt.py", line 84, in get_current_offset
    return float(
           ^^^^^^
ValueError: could not convert string to float: 'unavailable'

Description

Please catch to type of error, this should be mandatory. Due to this log information, HA restarting every time the log file is to big

Versions

HA Version 2024.9.1 BT Version 1.6.0

CarpeNecopinum commented 3 weeks ago

A very similar issue also affects thermostats connected via ZHA:

2024-10-21 08:00:54.279 ERROR (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat None: ERROR controlling: climate.thermostat_badezimmer_thermostat
Traceback (most recent call last):
  File "/config/custom_components/better_thermostat/utils/controlling.py", line 53, in control_queue
    _temp = await control_trv(self, trv)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/better_thermostat/utils/controlling.py", line 231, in control_trv
    _current_calibration_s = await get_current_offset(self, heater_entity_id)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/better_thermostat/adapters/delegate.py", line 55, in get_current_offset
    return await self.real_trvs[entity_id]["adapter"].get_current_offset(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/better_thermostat/adapters/generic.py", line 56, in get_current_offset
    return float(
           ^^^^^^
ValueError: could not convert string to float: 'unavailable'

HA Version 2024.10.3 BT Version 1.6.0