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
832 stars 126 forks source link

Devices are 'not loaded' after update to v. 1.5.0-Beta7 #1299

Closed csidirop closed 2 days ago

csidirop commented 8 months ago

Description

All my devices are not longer available after the last update (went from beta 5 to beta 7): grafik

I found two exceptions in the HA logs:

2024-02-25 20:43:05.796 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component custom_components.better_thermostat
Traceback (most recent call last):
  File "/snap/home-assistant-snap/585/lib/python3.11/site-packages/homeassistant/loader.py", line 814, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/var/snap/home-assistant-snap/585/custom_components/better_thermostat/__init__.py", line 10, in <module>
    from .utils.const import (
  File "/var/snap/home-assistant-snap/585/custom_components/better_thermostat/utils/const.py", line 60, in <module>
    | ClimateEntityFeature.TURN_OFF
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 784, in __getattr__
    raise AttributeError(name) from None
AttributeError: TURN_OFF

and

2024-02-25 20:43:05.806 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration 'better_thermostat': Unable to import component: Exception importing custom_components.better_thermostat
Traceback (most recent call last):
  File "/snap/home-assistant-snap/585/lib/python3.11/site-packages/homeassistant/loader.py", line 814, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/var/snap/home-assistant-snap/585/custom_components/better_thermostat/__init__.py", line 10, in <module>
    from .utils.const import (
  File "/var/snap/home-assistant-snap/585/custom_components/better_thermostat/utils/const.py", line 60, in <module>
    | ClimateEntityFeature.TURN_OFF
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 784, in __getattr__
    raise AttributeError(name) from None
AttributeError: TURN_OFF

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/snap/home-assistant-snap/585/lib/python3.11/site-packages/homeassistant/setup.py", line 251, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/snap/home-assistant-snap/585/lib/python3.11/site-packages/homeassistant/loader.py", line 822, in get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing custom_components.better_thermostat

Steps to Reproduce

  1. Update via HACS

Expected behavior:

Still working after update.

Actual behavior:

Not working after update.

Versions

Core 2023.12.4 Frontend 20231208.2

csidirop commented 8 months ago

Updated to Core 2024.1.6 and Frontend 20240104.0 and still not working. Should I try to just resetting them up?

Thanks in advance.

csidirop commented 8 months ago

In addition: It was not possible to add a new device. Aborting with an error pop up.

I rolled back to beta4 and its working again. Let me know if you want more logs or want me to test something.

vandenbulckjean commented 6 months ago

I got exactly the same error, my home assistant is running in a docker container i don't know if it is connected or not

vandenbulckjean commented 6 months ago

Okay bro i got you bro the constant TURN OFF has been added on the 2024.2 version of homeassistant core. If like me you have it installed via docker you just have to pull the new image, delete the container (be sure your data is saved) and restart it.

csidirop commented 2 days ago

I hesitantly updated to version 1.6.1 yesterday. The problem no longer seems to exist. Therefore I close the issue! Thanks @KartoffelToby