jmcollin78 / versatile_thermostat

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

Randomly set to "off" the vTherm #392

Closed skyderman closed 7 months ago

skyderman commented 9 months ago

Version of the custom_component 5.4.1

Configuration

My VTherm attributes are the following ( BEFORE ):

hvac_modes:
  - "off"
  - auto
  - cool
  - dry
  - heat
  - fan_only
min_temp: 16
max_temp: 30
target_temp_step: 1
fan_modes:
  - Silent
  - Low
  - Medium
  - High
  - Full
  - Auto
preset_modes:
  - none
swing_modes:
  - "Off"
  - Vertical
  - Horizontal
  - Both
current_temperature: 17.6
temperature: 22
fan_mode: Auto
preset_mode: none
swing_mode: "Off"
aux_heat: "off"
is_on: true
hvac_action: null
hvac_mode: heat
type: null
is_controlled_by_central_mode: false
last_central_mode: null
frost_temp: 0
eco_temp: 0
boost_temp: 0
comfort_temp: 0
frost_away_temp: 30
eco_away_temp: 30
boost_away_temp: 30
comfort_away_temp: 30
power_temp: 13
target_temperature_step: 1
ext_current_temperature: 12.4
ac_mode: true
current_power: null
current_power_max: null
saved_preset_mode: none
saved_target_temp: 19
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: 30
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-02-22T15:13:13.136967+01:00"
last_ext_temperature_datetime: "2024-02-22T15:13:13.136967+01:00"
security_state: false
minimal_activation_delay_sec: 10
device_power: 1
mean_cycle_power: null
total_energy: 0
last_update_datetime: "2024-02-22T15:13:13.179430+01:00"
timezone: Europe/Paris
temperature_unit: °C
is_device_active: false
ema_temp: 17.58
is_used_by_central_boiler: false
is_over_climate: true
start_hvac_action_date: null
underlying_climate_0: climate.152832116552564_climate
underlying_climate_1: null
underlying_climate_2: null
underlying_climate_3: null
is_regulated: true
regulated_target_temperature: 23.5
auto_regulation_mode: auto_regulation_light
regulation_accumulated_error: 10
auto_fan_mode: auto_fan_high
current_auto_fan_mode: auto_fan_high
auto_activated_fan_mode: null
auto_deactivated_fan_mode: null
auto_regulation_use_device_temp: true
friendly_name: Thermostat C05
supported_features: 121

AFTER

hvac_modes:
  - "off"
  - auto
  - cool
  - dry
  - heat
  - fan_only
min_temp: 16
max_temp: 30
target_temp_step: 1
fan_modes:
  - Silent
  - Low
  - Medium
  - High
  - Full
  - Auto
preset_modes:
  - none
swing_modes:
  - "Off"
  - Vertical
  - Horizontal
  - Both
current_temperature: 17.6
temperature: 22
fan_mode: Auto
preset_mode: none
swing_mode: "Off"
aux_heat: "off"
is_on: false
hvac_action: null
hvac_mode: "off"
type: null
is_controlled_by_central_mode: false
last_central_mode: null
frost_temp: 0
eco_temp: 0
boost_temp: 0
comfort_temp: 0
frost_away_temp: 30
eco_away_temp: 30
boost_away_temp: 30
comfort_away_temp: 30
power_temp: 13
target_temperature_step: 1
ext_current_temperature: 11.6
ac_mode: true
current_power: null
current_power_max: null
saved_preset_mode: none
saved_target_temp: 19
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: 30
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-02-22T15:13:13.136967+01:00"
last_ext_temperature_datetime: "2024-02-22T15:13:48.050529+01:00"
security_state: false
minimal_activation_delay_sec: 10
device_power: 1
mean_cycle_power: null
total_energy: 0
last_update_datetime: "2024-02-22T15:14:12.657335+01:00"
timezone: Europe/Paris
temperature_unit: °C
is_device_active: false
ema_temp: 17.58
is_used_by_central_boiler: false
is_over_climate: true
start_hvac_action_date: null
underlying_climate_0: climate.152832116552564_climate
underlying_climate_1: null
underlying_climate_2: null
underlying_climate_3: null
is_regulated: true
regulated_target_temperature: 23.5
auto_regulation_mode: auto_regulation_light
regulation_accumulated_error: 10
auto_fan_mode: auto_fan_high
current_auto_fan_mode: auto_fan_high
auto_activated_fan_mode: null
auto_deactivated_fan_mode: null
auto_regulation_use_device_temp: true
friendly_name: Thermostat C05
supported_features: 121

Describe the bug

Randomly the composant Vtherm, go on OFF mode. If I set on heating, the composant go on off after few second, and sometime stay "on".

It seen it's happen, when I use HA API to set the composant

For It, I use the 2 URL ( 1 to set mode and one for the temperature )

http://URLHA/api/services/climate/set_hvac_mode with Args : {"entity_id":"climate.thermostat_c05","hvac_mode":"heat"}

Then : http://URLHA/api/services/climate/set_temperature

with Args : {"entity_id":"climate.thermostat_c05","temperature":22}

I'm trying to: Use Vtherm, witch stay on, unless I Put manualy on OFF

And I expect: Stay On

To reproduce the issue, I put set thermostat to OFF via API (15h12) , I set to Heat ( via API ), and Set temperature ( via URL ) ( 15h13), after 1 minute, the Vtherm is set to OFF ( 15h14 )

Debug log

2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_temp_datetime - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_ext_temp_datetime - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_temperature_slope - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_ema_temperature - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_energy - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_regulated_temperature - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_security_state - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_window_bypass_state - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_temp_datetime - climate state change
2024-02-22 15:13:48.120 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_ext_temp_datetime - climate state change
2024-02-22 15:13:48.121 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_temperature_slope - climate state change
2024-02-22 15:13:48.121 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_ema_temperature - climate state change
2024-02-22 15:13:48.121 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_energy - climate state change
2024-02-22 15:13:48.121 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_regulated_temperature - climate state change
2024-02-22 15:13:48.121 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_security_state - climate state change
2024-02-22 15:13:48.121 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_window_bypass_state - climate state change

....

2024-02-22 15:14:12.656 DEBUG (MainThread) [custom_components.versatile_thermostat.thermostat_climate] VersatileThermostat-Thermostat C05 - _async_climate_changed new_state is <state climate.152832116552564_climate=off; hvac_modes=[<HVACMode.OFF: 'off'>, <HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.HEAT: 'heat'>, <HVACMode.FAN_ONLY: 'fan_only'>], min_temp=17, max_temp=30, target_temp_step=0.5, fan_modes=['Silent', 'Low', 'Medium', 'High', 'Full', 'Auto'], preset_modes=['none', 'comfort', 'eco', 'boost', 'sleep', 'away'], swing_modes=['Off', 'Vertical', 'Horizontal', 'Both'], current_temperature=20.0, temperature=26.0, fan_mode=Auto, preset_mode=none, swing_mode=Off, aux_heat=off, prompt_tone=True, power=False, mode=4, target_temperature=26.0, fan_speed=102, swing_vertical=False, swing_horizontal=False, smart_eye=False, dry=False, aux_heating=False, boost_mode=False, sleep_mode=False, frost_protect=False, comfort_mode=False, eco_mode=False, natural_wind=False, temp_fahrenheit=False, screen_display=False, screen_display_alternate=False, full_dust=False, indoor_temperature=20.0, outdoor_temperature=12.4, indirect_wind=False, indoor_humidity=55, breezeless=False, total_energy_consumption=0.0, current_energy_consumption=0.0, realtime_power=0.0, fresh_air_power=False, fresh_air_fan_speed=0, fresh_air_mode=None, fresh_air_1=None, fresh_air_2=None, icon=mdi:air-conditioner, friendly_name=Clim-C05, supported_features=121 @ 2024-02-22T15:13:13.550164+01:00>
2024-02-22 15:14:12.656 INFO (MainThread) [custom_components.versatile_thermostat.thermostat_climate] VersatileThermostat-Thermostat C05 - Underlying climate climate.152832116552564_climate changed. Event.new_hvac_mode is off, current_hvac_mode=heat, new_hvac_action=None, old_hvac_action=None
2024-02-22 15:14:12.656 DEBUG (MainThread) [custom_components.versatile_thermostat.thermostat_climate] VersatileThermostat-Thermostat C05 - last_change_time=2024-02-22 15:13:13.179185+01:00 old_state_date_changed=2024-02-22 14:13:13.550164+00:00 old_state_date_updated=2024-02-22 14:13:13.550164+00:00 new_state_date_changed=2024-02-22 14:13:13.550164+00:00 new_state_date_updated=2024-02-22 14:14:12.655711+00:00
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.thermostat_climate] VersatileThermostat-Thermostat C05 - All underlyings have the same hvac_mode, so VTherm will send the new hvac mode off
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.underlyings] VersatileThermostat-Thermostat C05-climate.152832116552564_climate - hvac_mode is already is requested state off. Do not send any command
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.thermostat_climate] VersatileThermostat-Thermostat C05 - Calling update_custom_attributes: {'is_on': False, 'hvac_action': None, 'hvac_mode': 'off', 'preset_mode': 'none', 'type': None, 'is_controlled_by_central_mode': False, 'last_central_mode': None, 'frost_temp': 0.0, 'eco_temp': 0.0, 'boost_temp': 0.0, 'comfort_temp': 0.0, 'frost_away_temp': 30.0, 'eco_away_temp': 30.0, 'boost_away_temp': 30.0, 'comfort_away_temp': 30.0, 'power_temp': 13, 'target_temperature_step': 1.0, 'ext_current_temperature': 11.6, 'ac_mode': True, 'current_power': None, 'current_power_max': None, 'saved_preset_mode': 'none', 'saved_target_temp': 19.0, 'saved_hvac_mode': None, 'motion_sensor_entity_id': None, 'motion_state': None, 'power_sensor_entity_id': None, 'max_power_sensor_entity_id': None, 'overpowering_state': None, 'presence_sensor_entity_id': None, 'presence_state': None, 'window_state': 'off', 'window_auto_state': 'off', 'window_bypass_state': False, 'window_sensor_entity_id': None, 'window_delay_sec': 30, 'window_auto_enabled': False, 'window_auto_open_threshold': None, 'window_auto_close_threshold': None, 'window_auto_max_duration': None, '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-02-22T15:13:13.136967+01:00', 'last_ext_temperature_datetime': '2024-02-22T15:13:48.050529+01:00', 'security_state': False, 'minimal_activation_delay_sec': 10, 'device_power': 1.0, 'mean_cycle_power': None, 'total_energy': 0, 'last_update_datetime': '2024-02-22T15:14:12.657335+01:00', 'timezone': 'Europe/Paris', 'temperature_unit': '°C', 'is_device_active': False, 'ema_temp': 17.58, 'is_used_by_central_boiler': False, 'is_over_climate': True, 'start_hvac_action_date': None, 'underlying_climate_0': 'climate.152832116552564_climate', 'underlying_climate_1': None, 'underlying_climate_2': None, 'underlying_climate_3': None, 'is_regulated': True, 'regulated_target_temperature': 23.5, 'auto_regulation_mode': 'auto_regulation_light', 'regulation_accumulated_error': 10, 'auto_fan_mode': 'auto_fan_high', 'current_auto_fan_mode': 'auto_fan_high', 'auto_activated_fan_mode': None, 'auto_deactivated_fan_mode': None, 'auto_regulation_use_device_temp': True}
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat C05 - Checking new cycle. hvac_mode=off, security_state=False, preset_mode=none
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat C05 - Window auto is on, check the alert. last slope is 0.150
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat C05 - Window auto event is ignored because bypass is ON or window auto detection is disabled
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat C05 - power not configured. check_overpowering not available
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat C05 - checking security delta_temp=1.0 delta_ext_temp=0.4 mod_cond=False temp_cond=False climate_cond=True switch_cond=False
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.base_thermostat] VersatileThermostat-Thermostat C05 - End of cycle (HVAC_MODE_OFF)
2024-02-22 15:14:12.657 DEBUG (MainThread) [custom_components.versatile_thermostat.thermostat_climate] %s - don't send regulated temperature cause VTherm is off 
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_temp_datetime - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_ext_temp_datetime - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_temperature_slope - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_ema_temperature - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_energy - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_regulated_temperature - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_security_state - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_window_bypass_state - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_temp_datetime - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_last_ext_temp_datetime - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_temperature_slope - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_ema_temperature - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_energy - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.sensor] Thermostat C05_regulated_temperature - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_security_state - climate state change
2024-02-22 15:14:12.659 DEBUG (MainThread) [custom_components.versatile_thermostat.binary_sensor] Thermostat C05_window_bypass_state - climate state change
jmcollin78 commented 9 months ago

Hello,

Underlying climate climate.152832116552564_climate changed. Event.new_hvac_mode is off

Your underlying climate have turn to off itself. So Vtherm is following this and turns off also. You have to find why the underlying is turning off without request from VTherm: another controller (Scheduler, automation, the device itself, ...)

skyderman commented 9 months ago

Thank you for your return.

I looking for this way.

I just see, if I put 'Heat' on the Vtherm with HA web interface, AC get 'Heat' mode right the way, but If I use API, the vterm turn on "heat", but AC stay "off" ( and so vtherm go Off after few time).

Do you have an idea why set_hvac mode on Vtherm for API doesn't start AC ?

Thank you in advance.

skyderman commented 9 months ago

I find how to reproduce the issue.

If we send, climate/set_hvac_mode and then climate/set_temperature, Vtherm turn on AC, and turn it off. If you add 1 second sleep between the 2 command, it's ok.

Do you need I create a new issue for this or do you need any help for fix ?

jmcollin78 commented 9 months ago

Hello @skyderman ,

What is the brand of you AC device ? I will list it as not compatible.

VTherm never turn on and set target temperature at the same time explicitly. It is possible that the command are send with a veryt short delay but it is a race condition and not explicite in the code. I guess this is a consequence of the self-regulation which starts when you turn on the device.

So it is not so easy to add a sleep(1 sec) between the 2 commands. I don't want to degrade the behavior for all users also, but I will have a look of what is possible.

skyderman commented 9 months ago

Hello,

The AC brand is "Airwell", used with integration "Midea AC LAN".

Just for people who have the same problem, timing of 1 sec between 2 orders on the Vtherm seems fix the issue. ( I have only this brand, so I don't know if the issue is only for this brand )

jmcollin78 commented 7 months ago

I have added incompatibilty in the README. Thank for the report.