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
752 stars 123 forks source link

Can't find entitiy still retry log messages #43

Closed upais closed 2 years ago

upais commented 2 years ago

Continuing the problem: https://github.com/KartoffelToby/ai_thermostat/issues/1 p.s. I wrote in a closed issue because I thought that it would be more correct to lead one problem in one issue. I'm sorry.

hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 35.5
temperature: 35
preset_mode: manual
battery: 83
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 300
child_lock: LOCK
current_heating_setpoint: 35
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_children
  hardwareVersion: 1
  ieeeAddr: '0x84fd27fffea664aa'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 7544
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 20
last_seen: '2021-11-26T07:19:05.657Z'
linkquality: 123
local_temperature: 35.5
local_temperature_calibration: 0
max_temperature: 45
min_temperature: 5
position: 0
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
update_available: null
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_children
supported_features: 17
hvac_modes:
  - auto
  - 'off'
  - cool
  - heat
  - dry
  - fan_only
min_temp: 5
max_temp: 35
target_temp_step: 0.5
preset_modes:
  - none
  - programming
  - manual
  - temporary_manual
  - holiday
current_temperature: 32
temperature: 29
preset_mode: manual
battery: 100
boost_heating: 'OFF'
boost_heating_countdown: 0
boost_heating_countdown_time_set: 300
child_lock: LOCK
current_heating_setpoint: 29
device:
  applicationVersion: 64
  dateCode: ''
  friendlyName: trv_cabinet
  hardwareVersion: 1
  ieeeAddr: '0xcc86ecfffeb800b8'
  manufacturerID: 4098
  manufacturerName: _TZE200_b6wax7g0
  model: BRT-100-TRV
  networkAddress: 664
  powerSource: Battery
  stackVersion: 0
  type: EndDevice
  zclVersion: 3
eco_mode: 'OFF'
eco_temperature: 20
last_seen: '2021-11-26T07:34:52.636Z'
linkquality: 33
local_temperature: 32
local_temperature_calibration: 0
max_temperature: 45
min_temperature: 5
position: 25
preset: manual
program_saturday:
  saturday: '6h:0m 24°C,  12h:0m 23°C,   14h:30m 22°C,  17h:30m 21°C '
program_sunday:
  sunday: '  6h:0m 19°C,  12h:30m 20°C,  14h:30m 21°C,  18h:30m 20°C '
program_weekday:
  weekday: ' 6h:0m 20°C,  11h:30m 21°C,  13h:30m 22°C,  17h:30m 23°C '
update_available: null
window: CLOSED
window_detection: 'OFF'
friendly_name: trv_cabinet
supported_features: 17

My config is:

  - platform: ai_thermostat
    name: ai_children
    thermostat: climate.trv_children
    temperature_sensor: sensor.temperature_humidity_hall_temperature
    window_sensors: group.fake_windows
    outdoor_sensor: sensor.temperature_humidity_outdoors_temperature
    off_temperature: 15
    window_off_delay: 20
    valve_maintenance: false

  - platform: ai_thermostat
    name: ai_cabinet
    thermostat: climate.trv_cabinet
    temperature_sensor: sensor.temperature_humidity_cabinet_temperature
    window_sensors: group.fake_windows
    outdoor_sensor: sensor.temperature_humidity_outdoors_temperature
    off_temperature: 15
    window_off_delay: 20
    valve_maintenance: false

Description

Bought two more BRT-100-TRV, connected to z2m and on HA reboot errors (HA startup time: 30-45 seconds):

Logger: custom_components.ai_thermostat.models.models Source: /config/custom_components/ai_thermostat/models/models.py:17 Integration: ai_thermostat (documentation, issues) First occurred: 10:14:09 (1 occurrences) Last logged: 10:14:09 ai_thermostat: can't read the device model of TVR, Enable include_device_information in z2m or checkout issue #1 NoneType: None

Logger: custom_components.ai_thermostat.models.models Source: /config/custom_components/ai_thermostat/models/models.py:42 Integration: ai_thermostat (documentation, issues) First occurred: 10:14:10 (1 occurrences) Last logged: 10:14:10 ai_thermostat: can't read the device model of TVR, Enable include_device_information in z2m or checkout issue #1 NoneType: None

Tried:

1) Reinstall the integration. 2) Reconnected BRT-100-TRV to z2m 3) include_device_information = false -> Reboot HA -> true 4) Rename TRV 5) Connect one at a time

p.s. I have two more thermostats just like that, no problem with them. I don't see any difference between them. (config issues #25)

Versions

TRV Model: BRT-100-TRV Z2M Version: 1.22.0-3 HA Version: 2021.11.5 ai_thermostat version: 0.6.0

KartoffelToby commented 2 years ago

@IvanUpa

Will test some configuration with my BRT-100-TRV, i thought the BRT aren't the best chose i have only drouble with them, even if they look great, if its possible i would buy some SPZB0001 or SEA801-Zigbee/SEA802-Zigbee.

But thats not the answer, right ;)

So first (i frogot to write it in the redme) the BRT haven't a system mode, so it can't switch off, my workaround for that is to set the target temp to 0 but for that in Zigbee2Mqtt the min temp must set to 0 aswell.

I also have a bug in the startup process, its possible that the entitys are not ready when the intigration is loaded, it will be changed in the next relase, if it fix it it would be greate, otherwise leave this issue open. or close it if its fixed by the next version.

upais commented 2 years ago

@KartoffelToby

Yes, BRT-100-TRV is "wonderful" device :) I take it the problems are due to incorrect support in z2m? Some external converter won't fix it working in z2m?

Put min temp = 0, the errors remain :(

KartoffelToby commented 2 years ago

@IvanUpa I'll publish 0.7.0 today with the better startup routine, but i didn't think it fixes this issues, because it looks like the not working BRT has a different firmware.

Can you check that agains that BRT's thats working?

upais commented 2 years ago

@KartoffelToby

It seems to be the same firmware. The problematic one: Read result of 'genBasic': {"zclVersion":3, "appVersion":64, "stackVersion":0, "hwVersion":1} Worker: Read result of 'genBasic': {"zclVersion":3, "appVersion":64, "stackVersion":0, "hwVersion":1}

I'll check on 0.7.0 as soon as it's published.

upais commented 2 years ago

@KartoffelToby

Now it is :)

Logger: homeassistant Source: core.py:1092 First occurred: 18:15:14 (1 occurrences) Last logged: 18:15:14 Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/ai_thermostat/climate.py", line 406, in _async_sensor_changed return self.startUp() File "/config/custom_components/ai_thermostat/climate.py", line 269, in startUp if self.hass.states.get(self.window_sensors_entity_ids) is not None: File "/usr/src/homeassistant/homeassistant/core.py", line 1092, in get return self._states.get(entity_id.lower()) AttributeError: 'NoneType' object has no attribute 'lower'

KartoffelToby commented 2 years ago

Should be fixed with 0.7.1

But make sure your window sensor is a real sensor, or remove the line complete from your config if you haven't a window sensor.

upais commented 2 years ago

@KartoffelToby

Problem solved, no error. But now the problem is with the ones that worked originally: climate.ai_bedroom - state=unavailable

There are no errors in the log.

Config:

Version 0.7.2

Reinstalled, renamed, waited 20+ minutes after loading HA. New issue or is it related?

KartoffelToby commented 2 years ago

@IvanUpa Yes to make it clear for the user, i set a active state for the TRV, so only when all entities in the config are updatet and active the TRV itself will switch to an active state otherwise it stay in unavailable

I think one of your sensors are not ready or didn't push any update to your HA. Can you check it? Sometimes it takes a while but even 5min are too long.

upais commented 2 years ago

@KartoffelToby

Checked, "last_seen" of all devices is up to date. Two TRVs are using the same external sensor, only one TRV is "unavailable", and the other is working normally.

Removed TRV, paired it again - "unavailable". And it is controlled correctly by entities from z2m.

state=unavailable

I don't understand what the magic is again.

KartoffelToby commented 2 years ago

@IvanUpa

Do you use a PI or something like that? I found a super weird bug on PI HA Instaces thats result in exaclty this problem.

You can checkout 0.7.3.

upais commented 2 years ago

@KartoffelToby

Now all four state=unavailable. What is PI? If Raspberry, then no, I have a VM with HassOS.

Rolled back to 0.7.1. At least two work.

KartoffelToby commented 2 years ago

Can you check the info log with 0.7.3? The intigration is waiting for the entities so it might be a miss configuration.

upais commented 2 years ago

@KartoffelToby

Reinstalled the integration, refilled the config. Now the situation is similar to versions 0.7.1 and 0.7.2, i.e. state=unavailable on TRVs that worked on 0.7.0. (https://github.com/KartoffelToby/ai_thermostat/issues/43#issuecomment-981065865) And the other two that had problems in 0.6.0 work fine (https://github.com/KartoffelToby/ai_thermostat/issues/43#issue-1064181378)

Looked at the logs, there is nothing but: WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration ai_thermostat which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

KartoffelToby commented 2 years ago

@IvanUpa you need to enable the info log i think, and try to use 0.7.3 or 0.7.4 if its out:

logger:
  default: warning
  logs:
    custom_components.ai_thermostat: info
upais commented 2 years ago

@KartoffelToby

All four TRV state=unavailable. Through the z2m entity they are controlled. In the log:

2021-11-30 00:21:01 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_bedroom with version: 0.7.4 waiting for entity to be ready...
2021-11-30 00:21:01 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_hall with version: 0.7.4 waiting for entity to be ready...
2021-11-30 00:21:01 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_children with version: 0.7.4 waiting for entity to be ready...
2021-11-30 00:21:01 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_cabinet with version: 0.7.4 waiting for entity to be ready...
2021-11-30 00:21:01 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:21:01 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:21:16 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:21:16 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:21:31 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:21:31 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:21:46 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:21:46 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:22:02 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
..........
2021-11-30 00:24:32 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:24:32 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:24:47 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:24:47 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:25:02 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 00:25:02 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
KartoffelToby commented 2 years ago

@IvanUpa Looks like the entity for temperature_sensor and thermostat in your configuration is incorrect it didn't found a usable entity.

Can you run it again with:

logger:
  default: warning
  logs:
    custom_components.ai_thermostat: debug

Also make sure you didn't run in the same issue as #57

And your thermostat entity is a real climate trv entity and your temperature_sensor is a target who reported a temperature as a state

upais commented 2 years ago

@KartoffelToby

2021-11-30 12:20:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 12:20:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 12:20:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 12:20:11 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0

Changed to another sensor, now all four TVRs use different sensors for target temperature. And again all state = unavailable.

In the config a long time ago: mqtt: base_topic: zigbee2mqtt include_device_information: true

KartoffelToby commented 2 years ago

@IvanUpa

is this the only log output?

Can you try to click in HA under Settings > Servercontrol > Reload YAML and than AI_THERMOSTAT And look at your logs again?

upais commented 2 years ago

@KartoffelToby

On 0.7.5 I do not see the error. But also does not work correctly. After starting HA I wait 10+min, all four TRV state=unavailable. I do Reload YAML for AI_THERMOSTAT and two TRVs start, and ai_children and ai_hall have the same external temperature sensor.

2021-11-30 23:42:53 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:42:53 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:42:53 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:42:53 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:42:56 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_bedroom with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:42:56 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_hall with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:42:56 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_children with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:42:56 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_cabinet with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:43:01 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 23:43:01 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 23:43:16 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 23:43:16 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...

........... Reload YAML for AI_THERMOSTAT ...........

2021-11-30 23:55:34 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_bedroom with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:55:34 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:55:34 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_hall with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:55:34 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:55:34 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_children with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:55:34 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:55:34 INFO (MainThread) [custom_components.ai_thermostat.climate] Starting ai_thermostat for ai_cabinet with version: 0.7.5 waiting for entity to be ready...
2021-11-30 23:55:34 DEBUG (MainThread) [custom_components.ai_thermostat.climate] Undefined target temperature, falling back to 5.0
2021-11-30 23:55:39 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 23:55:39 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 23:55:39 INFO (MainThread) [custom_components.ai_thermostat.climate] Register ai_thermostat with name: ai_children
2021-11-30 23:55:39 INFO (MainThread) [custom_components.ai_thermostat.climate] Register ai_thermostat with name: ai_cabinet
2021-11-30 23:55:46 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
2021-11-30 23:55:46 INFO (MainThread) [custom_components.ai_thermostat.climate] retry in 15s...
KartoffelToby commented 2 years ago

Should be fix finally in 0.7.6