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
877 stars 131 forks source link

BT entity unavailable - only one of 2 identical TRV is available #1089

Open bsafh opened 1 year ago

bsafh commented 1 year ago

Prerequisites

Developer tools:

BT entities

climate.trv_ai_schlafzimmer_1TRV_AI_Schlafzimmer_1 | unavailable | hvac_modes: heat, off min_temp: 5 max_temp: 26 target_temp_step: 0.5 friendly_name: TRV_AI_Schlafzimmer_1 supported_features: 1 -- | -- | -- climate.trv_ai_schlafzimmer_2TRV_AI_Schlafzimmer_2 | heat | hvac_modes: heat, off min_temp: 5 max_temp: 24 target_temp_step: 0.5 current_temperature: 19.9 temperature: 20 hvac_action: heating window_open: false call_for_heat: true last_change: 2023-10-16T02:46:19.439718 saved_temperature: null humidity: 63 main_mode: heat tolerance: 0.1 heating_power: 0.01 errors: [] batteries: {"sensor.temp_hum_schlafzimmer_5_temperature": {"battery": "100", "battery_id": "sensor.temp_hum_schlafzimmer_5_battery"}, "sensor.temp_hum_schlafzimmer_5_humidity": {"battery": "100", "battery_id": "sensor.temp_hum_schlafzimmer_5_battery"}, "climate.trv_danfoss_schlafzimmer_fenster_thermostat": {"battery": "36", "battery_id": "sensor.trv_danfoss_schlafzimmer_fenster_battery"}} friendly_name: TRV_AI_Schlafzimmer_2 supported_features: 1

TRV entities

unavailable in BT:

climate.trv_danfoss_schlafzimmer_fenster_thermostatTRV_Danfoss_Schlafzimmer_Fenster Thermostat | heat | hvac_modes: off, heat min_temp: 5 max_temp: 24 current_temperature: 20.3 temperature: 20.5 hvac_action: heating system_mode: []/heat occupied_heating_setpoint: 2050 pi_heating_demand: 8 friendly_name: TRV_Danfoss_Schlafzimmer_Fenster Thermostat supported_features: 1 target_temp_step: 0.5 -- | -- | --

available in BT

climate.trv_dannfoss_schlafzimmer_tur_thermostatTRV_Dannfoss_Schlafzimmer_Tür Thermostat | heat | hvac_modes: off, heat min_temp: 5 max_temp: 26 current_temperature: 20.2 temperature: 19.5 hvac_action: heating system_mode: []/heat occupied_heating_setpoint: 1950 pi_heating_demand: 28 friendly_name: TRV_Dannfoss_Schlafzimmer_Tür Thermostat supported_features: 1 target_temp_step: 0.5 -- | -- | --

BT Diagnostics "not available" device: config_entry-better_thermostat-328da63efcbb0b3829006a3cecca5499.json.txt

BT Diagnostics from identical working device: config_entry-better_thermostat-05f8998637a9b08ab2cdc49410e99881.json.txt

HA Logfile (BT entries/lines only)

20231016-ha-log.txt

Log entries for TRV 1:

20231016-ha-bt_trv_1-log.txt

Log entries for TRV 2:

20231016-ha-bt_trv_2-log.txt

all BT ERROR log entries:

20231016-ha-bt-error-log.txt

this entry 2023-10-16 04:55:34.476 ERROR (MainThread) [homeassistant.components.climate] Platform better_thermostat does not generate unique IDs. ID 328da63efcbb0b3829006a3cecca5499 already exists - ignoring climate.trv_ai_schlafzimmer_1 looks a bit strange to me that's the currently unavailable device.

Description

both BT entities should work, but one is permanently unavailable

Steps to Reproduce

  1. start HA
  2. create two BT devices from two identical TRV
  3. create a BT frontend card for both devices
  4. one device shows available, the other permanently unavailable
  5. both TRV are working and can be used without BT via the standard HA thermostat card

Expected behavior:

both BT entities should work

image

Actual behavior:

one of them is permanently unavailable

image

Versions

BT Version 1.3.0 HA Version: 2023.10.3

Additional Information

root@homeassistant:~# ha core info
arch: amd64
audio_input: null
audio_output: null
boot: true
image: ghcr.io/home-assistant/qemux86-64-homeassistant
ip_address: 172.30.32.1
machine: qemux86-64
port: 8123
ssl: false
update_available: false
version: 2023.10.3
version_latest: 2023.10.3
watchdog: true
root@homeassistant:~#
TPertenava commented 1 year ago

I might be having the same issue. Out of 3 only 1 available. After disabling that one and rebooting the next one became available.

fishtank4real commented 10 months ago

Same here i lost 3 entities in the morning. Deactivation and activation doesn´t help

getting two different errors in the log: 2024-01-12 11:33:59.630 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat Büro: Starting version 1.4.0. Waiting for entity to be ready... 2024-01-12 11:33:59.637 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/better_thermostat/climate.py", line 833, in startup await control_trv(self, trv) File "/config/custom_components/better_thermostat/utils/controlling.py", line 249, in control_trv await set_offset(self, heater_entity_id, _calibration) File "/config/custom_components/better_thermostat/utils/bridge.py", line 91, in set_offset return await self.real_trvs[entity_id]["adapter"].set_offset( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/better_thermostat/adapters/generic.py", line 142, in set_offset await self.hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 111, in async_set_value await entity.async_set_native_value(native_value) File "/usr/src/homeassistant/homeassistant/components/zha/number.py", line 435, in async_set_native_value await self._cluster_handler.write_attributes_safe( File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/init.py", line 518, in write_attributes_safe res = await self.write_attributes(attributes, manufacturer=manufacturer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/init.py", line 84, in wrapper return await RETRYABLE_REQUEST_DECORATOR(func)(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy/util.py", line 137, in retry return await func() ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zhaquirks/tuya/init.py", line 727, in write_attributes manufacturer_attrs.update(new_attrs) TypeError: 'NoneType' object is not iterable 2024-01-12 11:33:59.676 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Büro for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 561, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 214, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 203, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2024-01-12 11:33:59.684 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Büro for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 561, in async_unload result = await component.async_unload_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 214, in async_unload_entry return await component.async_unload_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 203, in async_unload_entry raise ValueError("Config entry was never loaded!") ValueError: Config entry was never loaded! 2024-01-12 11:33:59.690 INFO (MainThread) [homeassistant.components.climate] Setting up better_thermostat.climate 2024-01-12 11:33:59.691 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Büro for climate Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 208, in async_setup_entry return await component.async_setup_entry(entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 188, in async_setup_entry raise ValueError("Config entry has already been setup!") ValueError: Config entry has already been setup! 2024-01-12 11:33:59.700 INFO (MainThread) [custom_components.better_thermostat.utils.bridge] better_thermostat Büro: intigration: zha isn't native supported, feel free to open an issue, fallback adapter generic 2024-01-12 11:33:59.701 INFO (MainThread) [custom_components.better_thermostat.utils.bridge] better_thermostat Büro: intigration: zha isn't native supported, feel free to open an issue, fallback adapter generic 2024-01-12 11:33:59.702 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat Büro: Waiting for entity to be ready... 2024-01-12 11:33:59.704 INFO (MainThread) [custom_components.better_thermostat.climate] better_thermostat Büro: Starting version 1.4.0. Waiting for entity to be ready... 2024-01-12 11:33:59.711 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/better_thermostat/climate.py", line 833, in startup await control_trv(self, trv) File "/config/custom_components/better_thermostat/utils/controlling.py", line 249, in control_trv await set_offset(self, heater_entity_id, _calibration) File "/config/custom_components/better_thermostat/utils/bridge.py", line 91, in set_offset return await self.real_trvs[entity_id]["adapter"].set_offset( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/better_thermostat/adapters/generic.py", line 142, in set_offset await self.hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 111, in async_set_value await entity.async_set_native_value(native_value) File "/usr/src/homeassistant/homeassistant/components/zha/number.py", line 435, in async_set_native_value await self._cluster_handler.write_attributes_safe( File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/init.py", line 518, in write_attributes_safe res = await self.write_attributes(attributes, manufacturer=manufacturer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/init.py", line 84, in wrapper return await RETRYABLE_REQUEST_DECORATOR(func)(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy/util.py", line 137, in retry return await func() ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zhaquirks/tuya/init.py", line 727, in write_attributes manufacturer_attrs.update(new_attrs) TypeError: 'NoneType' object is not iterable

Anyone a good idea?

image

fishtank4real commented 10 months ago

If i rename the devices under the Better Thermostat section and with that also the entities i suddenly get all of the thermostats back. Which file does list the name of the entities for better thermostat? I want to take a look how they got named. Maybe there are some duplicates it doesn´t like.

Anyone some hints?

image