jmcollin78 / versatile_thermostat

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

climate.turn_off does not completely disengage VTherm for over_switch #369

Closed zoidberg21 closed 9 months ago

zoidberg21 commented 9 months ago

Hi, I have a quite usual VThermostat over a switch.

When calling the service climate.turn_off (or turning it off using the thermostat card), I'd expect that VTherm disengages from controlling the switch - no controls at all. However, it seems that turning it off only prevents VTherm to switch on the heater, but it still controls turning off the heater. So when the switch is turned on, VTherm switches it off again after a while.

Use case: I have an automation, which, on button click, should turn on the heater for 20 min and then off for 70 min. During all this time the thermostat is supposed to be turned off (should not interfere).

With the generic and awesome thermostat the behavior is as intended. Hence I think this is a bug.

Version 5.2.2

Configuration

My VTherm attributes are the following:

hvac_modes:
  - heat
  - "off"
min_temp: 16
max_temp: 24
target_temp_step: 0.1
preset_modes:
  - none
  - frost
  - eco
  - comfort
  - boost
current_temperature: 18.7
temperature: 18
hvac_action: idle
preset_mode: eco
is_on: true
hvac_mode: heat
type: null
is_controlled_by_central_mode: true
last_central_mode: null
frost_temp: 16
eco_temp: 18
boost_temp: 20.5
comfort_temp: 19.2
frost_away_temp: 16
eco_away_temp: 16
boost_away_temp: 16
comfort_away_temp: 16
power_temp: null
target_temperature_step: 0.1
ext_current_temperature: -2.1
ac_mode: false
current_power: null
current_power_max: null
saved_preset_mode: eco
saved_target_temp: 18
saved_hvac_mode: null
window_state: "off"
motion_state: null
overpowering_state: null
presence_state: null
window_auto_state: "off"
window_bypass_state: false
security_delay_min: 30
security_min_on_percent: 0.5
security_default_on_percent: 0.1
last_temperature_datetime: "2024-01-30T20:42:57.589267+01:00"
last_ext_temperature_datetime: "2024-01-30T20:42:30.094661+01:00"
security_state: false
minimal_activation_delay_sec: 30
device_power: 1450
mean_cycle_power: 0
total_energy: 31126.67
last_update_datetime: "2024-01-30T20:42:57.590730+01:00"
timezone: Europe/Vienna
window_sensor_entity_id: null
window_delay_sec: null
window_auto_enabled: false
window_auto_open_threshold: null
window_auto_close_threshold: null
window_auto_max_duration: null
motion_sensor_entity_id: null
presence_sensor_entity_id: null
power_sensor_entity_id: null
max_power_sensor_entity_id: null
temperature_unit: °C
is_device_active: false
ema_temp: 18.87
is_over_switch: true
is_inversed: false
underlying_switch_0: switch.plug_1_metered
underlying_switch_1: null
underlying_switch_2: null
underlying_switch_3: null
on_percent: 0
power_percent: 0
on_time_sec: 0
off_time_sec: 300
cycle_min: 5
function: tpi
tpi_coef_int: 0.5
tpi_coef_ext: 0.01
friendly_name: Thermostat Bad OG
supported_features: 17

The automation action:

action:
  - service: climate.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: climate.thermostat_bad_og
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.plug_1_metered
  - delay:
      hours: 0
      minutes: 20
      seconds: 0
      milliseconds: 0
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.plug_1_metered
  - delay:
      hours: 1
      minutes: 10
      seconds: 0
      milliseconds: 0
  - service: climate.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: climate.thermostat_bad_og
jmcollin78 commented 9 months ago

Hello @zoidberg21,

In VTherm you program the desired state of your heater and then VTherm tried to align the heater with this desired state. Turning off VTherm does not mean, "I don't want VTherm to work anymore" but means, "I want the heater to be off".

VTherm is listening the underlying switch, even if turned off. This is for me a safety feature which prevent to have a heater heating and VTherm off. In such case, nobody will stop the heater, and it can stay on for a long time on, risking putting fire on your house.

So, I will not remove this. This is a feature and not a bug.

Use case: I have an automation, which, on button click, should turn on the heater for 20 min and then off for 70 min. During all this time the thermostat is supposed to be turned off (should not interfere).

The question is: why do you need to do that ? I'm sure you just want to reach a target temperature in your room. So, instead, why not just turn VTherm to Boost preset with a high temperature setting ? It will do the same thing, but someone is watching your heater and will turn it off, avoiding to burn your house.

zoidberg21 commented 9 months ago

Thanks for the response. So how would could I temporarily prevent VTherm handling my switch then? Only chance is to completely delete the thermostat?

My use case is sketched in the ticket - it definitely makes sense to disable thermostat control over a switch if needed.

jmcollin78 commented 9 months ago

You can disable the VTherm. In the entities screen, you can disable /enable. This should work. And I suppose there is a service to enable/disable an entity.

zoidberg21 commented 9 months ago

I have not found such a service unfortunately, and according to this "there is no way to do this".

Since all those other thermostat implementations interprete "off" as "do not touch controls" I'd ask you to consider this as well for VTherm. Either it's a bug here or there.

For me unfortunately there seems to be no way than use one of the other thermostats. I'm really grateful for VTherm and your work, this would be a big setback.

Thanks!

jmcollin78 commented 9 months ago

I don't want to do that for the reason I already explain. And you have a workaround: just use it normally (Boost preset is an option). I will not risk safety issue because you want to use it as it is planed. You have to understand this.