jmcollin78 / versatile_thermostat

A full featured Thermostat for Home Assistant: presets, window, motion, presence and overpowering management
MIT License
309 stars 35 forks source link

last_seen and "…the configured sensor for room temperature is unavailable" #496

Open maia opened 1 month ago

maia commented 1 month ago

Version of the custom_component

Version: 6.2.9 (latest)

Configuration

My VTherm attributes are the following:

hvac_modes:
  - "off"
  - heat
min_temp: 14
max_temp: 26
target_temp_step: 0.5
preset_modes:
  - none
  - eco
  - comfort
  - boost
current_temperature: 22.9
temperature: 19.5
preset_mode: comfort
is_on: false
hvac_action: null
hvac_mode: "off"
type: null
is_controlled_by_central_mode: true
last_central_mode: Auto
frost_temp: 0
eco_temp: 19.5
boost_temp: 23
comfort_temp: 19.5
frost_away_temp: 0
eco_away_temp: 0
boost_away_temp: 0
comfort_away_temp: 0
power_temp: 13
target_temperature_step: 0.5
ext_current_temperature: 7.9594858575244665
ac_mode: false
current_power: null
current_power_max: null
saved_preset_mode: comfort
saved_target_temp: 19.5
saved_hvac_mode: null
motion_sensor_entity_id: null
motion_state: null
power_sensor_entity_id: null
max_power_sensor_entity_id: null
overpowering_state: null
presence_sensor_entity_id: null
presence_state: null
window_state: "off"
window_auto_state: "off"
window_bypass_state: false
window_sensor_entity_id: null
window_delay_sec: 120
window_auto_enabled: false
window_auto_open_threshold: null
window_auto_close_threshold: null
window_auto_max_duration: null
window_action: window_turn_off
security_delay_min: 60
security_min_on_percent: 0.5
security_default_on_percent: 0.1
last_temperature_datetime: "2024-09-14T10:40:09.080166+02:00"
last_ext_temperature_datetime: "2024-09-14T10:52:00.102638+02:00"
security_state: false
minimal_activation_delay_sec: 10
device_power: 1
mean_cycle_power: null
total_energy: 0
last_update_datetime: "2024-09-14T10:52:00.112424+02:00"
timezone: Europe/Vienna
temperature_unit: °C
is_device_active: false
ema_temp: 22.85
is_used_by_central_boiler: false
is_over_climate: true
start_hvac_action_date: null
underlying_climate_0: climate.wohnzimmer_eve_trv_thermostat
underlying_climate_1: null
underlying_climate_2: null
underlying_climate_3: null
is_regulated: true
regulated_target_temperature: 19.5
auto_regulation_mode: auto_regulation_slow
regulation_accumulated_error: -576
auto_fan_mode: auto_fan_none
current_auto_fan_mode: auto_fan_none
auto_activated_fan_mode: null
auto_deactivated_fan_mode: null
auto_regulation_use_device_temp: true
friendly_name: Wohnzimmer Heizung
supported_features: 401

Describe the bug

https://github.com/jmcollin78/versatile_thermostat/issues/398 added a last_seen for room temperature sensors. My Aqara temperature devices do not offer such a value. It might be available as an attribute somewhere, but I cannot enter that into the config. See:

Bildschirmfoto 2024-09-14 um 10 48 07

My logs are full of messages like: WARNING (MainThread) [custom_components.versatile_thermostat.pi_algorithm] Temporarily skipping the self-regulation algorithm while the configured sensor for room temperature is unavailable , so it seems I won't have a self-regulation until this is fixed or I can find an alternative solution. Thanks!

jmcollin78 commented 1 month ago

Hello @maia ,

Not sure to have understand. If you don't have last-seen attribute on your temperature device, I suppose it is not configured in your VTherm. So why are you talking about the last-seen ?

The error message is not relative to last-seen but relative to the temperature entity itself.

With Z2M, you have to enable the last-seen in the can check if the last-seen is visible:

Capture d’écran 2024-09-16 à 15 23 37

Do you have this ?

if yes, I think you have to add the last-seen entity by clicking on the "+3 entities not shown" in the first screen.

jmcollin78 commented 1 month ago

I look into the code, and the error is thrown when the room_temp is not available (nothing to do with last-seen):

if room_temp is None:
            _LOGGER.warning(
                "Temporarily skipping the self-regulation algorithm while the configured sensor for room temperature is unavailable"
            )
maia commented 1 month ago

Thanks, so the room temp error is probably just startup-related.

As for last seen room temperature datetime, as you are asking for the entity in the "Main" config screen, this suggests that this isn't an optional entity but required. I know that there's no "*" next to it, but still it is very confusing. It's lacking an explanation what it is used for, what happens if you don't provide it, where to search for it. Especially as not all devices expose this entity and even with Z2M you manually have to enable it (which might not even be possible in ZHA).

I guess many/most/all devices have the datetime for the last measurement of the internal thermometer, but they might only be exposed as attribute and not as entity. See below for my Eve Thermo (Matter).

Bildschirmfoto 2024-09-16 um 15 35 06

As you can see, to the right is last changed, last updated, I imagine this is the necessary information?

jmcollin78 commented 1 month ago

Hello @maia ,

Yes this experimental feature have not been documented yet. You have more explanation here: https://github.com/jmcollin78/versatile_thermostat/issues/398

The objective is to avoid the safety state which happens when the temperature doesn't change for a long period but the thermometer is alive. Last_seen is a Zigbee feature activable that can be useful for this case.

If you don't have one, don't worry, you are just potentially subject to the safety mode while your thermometer is alive.

And yes, it is not mandatory.

maia commented 1 month ago

(deleted)

maia commented 1 month ago

I have to correct myself: you're not interested in the last room temperature of the TRV internal sensor but from the external room sensor, right? I just noticed that my Aqara temperature sensors (Zigbee) don't report for long time spans when the temperature doesn't change above an internal threshold. In one room the temperature measured was very constant between 20,8°C and 21,2°C and the Aqara sensor only reports about once per hour. This might trigger the safety feature.

I wonder if you could prevent early trigger of the safety feature by checking the internal TRV temperature sensor too. Because if the external room sensor doesn't report anything this might just mean that the temperature is currently very constant.

jmcollin78 commented 1 month ago

but from the external room sensor, right?

You should configure the last seen date of the thermometer that controls the VTherm.

the Aqara sensor only reports about once per hour. This might trigger the safety feature.

Exactly the case.

Because if the external room sensor doesn't report anything this might just mean that the temperature is currently very constant.

And how can I use this in your opinion ?

maia commented 1 month ago

I think the safety feature is more of a problem than a feature when using over_climate. When users do not manually enable last seem temperature entities and add these, they will trigger the safety feature frequently, simply because some thermometers do not report if the temperature doesn't change. I think:

  1. the safety feature should be an option and not a fixed feature
  2. the safety feature should be disabled by default for over_climate mode
  3. set the "Safety delay" in "Advanced - Central configuration" to 120 or 180 as default
  4. add an option for safety temperature in "Advanced - Central configuration", it currently is only available for "Power percent"
jmcollin78 commented 1 month ago

Hello @maia, thank you for this report. I understand your point - safety in òver_climate` are less important but:

  1. you can always disable safety feature by setting a high number in delay,
  2. the temperature is critical information for auto-regulation algorithm and can lead to wrong target temp specially if you use strong auto-regulation. Then this can lead to over heating a room.

I will check for point 3 or 4, they are more relevant.