jmcollin78 / versatile_thermostat

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

Shelly TRV (thermostat over valve) - no change in valve position when opening window #341

Closed jmcollin78 closed 10 months ago

jmcollin78 commented 10 months ago

Discussed in https://github.com/jmcollin78/versatile_thermostat/discussions/340

Originally posted by **nurunet** January 14, 2024 Hi, I have bought a Shelly TRV because it was recommended here for use with VT. I set it up as a _Thermostat over Valve_. I also created an automation to push the temperature value of an external sensor to the thermostat. Heating seems to work well, I just have some oscillation above the set heat point - I guess I still have to tweak the TPI settings. However, I realized I didn't hear the valve move when opening the window. I checked, and - as expected - the Versatile Thermostat UI card shows the open window with little to no delay. The detail page of the VT entity in Home Assistant also shows the valve position to be 0%. The details of the Shelly TRV entity however show the valve to be still open (at x%), and so does the web UI of the Shelly TRV itself. Confusingly, the valve then normally moves to 0% when I **close** the window again - at least for a while. Is this behavior known? Did I misconfigure something? Should I open an issue?
nurunet commented 10 months ago

Looks like I'm running version 5.2.1.

My VTherm attributes are the following:

hvac_modes: heat, off
min_temp: 7
max_temp: 23
target_temp_step: 0.1
preset_modes: none, frost, eco, comfort, boost
current_temperature: 19
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: 5
eco_temp: 18
boost_temp: 21
comfort_temp: 19
frost_away_temp: 5
eco_away_temp: 18
boost_away_temp: 18
comfort_away_temp: 18
power_temp: null
target_temperature_step: 0.1
ext_current_temperature: 1.9
ac_mode: false
current_power: null
current_power_max: null
saved_preset_mode: eco
saved_target_temp: 19
saved_hvac_mode: heat
window_state: off
motion_state: null
overpowering_state: null
presence_state: on
window_auto_state: off
window_bypass_state: false
security_delay_min: 60
security_min_on_percent: 0.5
security_default_on_percent: 0.1
last_temperature_datetime: 2024-01-14T22:26:47.799397+01:00
last_ext_temperature_datetime: 2024-01-14T21:34:59.615481+01:00
security_state: false
minimal_activation_delay_sec: 10
device_power: 1
mean_cycle_power: 0
total_energy: 0
last_update_datetime: 2024-01-14T22:33:22.809760+01:00
timezone: Europe/Berlin
window_sensor_entity_id: binary_sensor.bathroom_window_contact
window_delay_sec: 1
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: binary_sensor.anyone_home
power_sensor_entity_id: null
max_power_sensor_entity_id: null
temperature_unit: °C
is_device_active: false
ema_temp: 19.1
valve_open_percent: 0
is_over_valve: true
underlying_valve_0: number.bathroom_shelly_trv_valve_position
underlying_valve_1: null
underlying_valve_2: null
underlying_valve_3: null
on_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: Bathroom Versatile Thermostat
supported_features: 17

This was earlier today.

I had opened the window, and VTherm showed that correctly:

Screenshot_20240114-134953

But, at the same time, the valve remained open at 15%:

Screenshot_20240114-135000

I'll try to provide logs tomorrow.

jmcollin78 commented 10 months ago

Try to reproduce in my test env (I have no valve in my house): before opening:

Capture d’écran 2024-01-14 à 23 14 10

After opening the window:

Capture d’écran 2024-01-14 à 23 15 03

The thermostat turns off. The valve percent goes to 10 (which is the lower limit in my test env, else it will be 0).

The thermostat valve open percent is 0 (but I send the minimum value which is 10) : Capture d’écran 2024-01-14 à 23 17 14

I close the window: Capture d’écran 2024-01-14 à 23 19 33

The thermostat turns on, the thermostat valve wants 100% and the real valve is programmed to 90% (which is the max possible for this test valve).

For me all is working as expected.

Try to find logs, there should be an explanation.

EDIT : on the attributes I see that the window is not open window_state: off Do you think it is normal ?

jmcollin78 commented 10 months ago

Oh, the second try I do and I've got the issue:

Capture d’écran 2024-01-14 à 23 26 05

That is not normal to have 90% with the window open and thermostat turned off.

jmcollin78 commented 10 months ago

Hello, the fix have been pushed into the release https://github.com/jmcollin78/versatile_thermostat/releases/tag/5.3.3.beta2

This is beta because there is the central boiler new feature in it. But you can install if you want and not to wait for the official release.

I don't know if it is relevant for you but can also participate to the test of the central boiler feature. See: https://github.com/jmcollin78/versatile_thermostat/discussions/339

nurunet commented 10 months ago

Hi, and thank you. It is awesome how much time and effort you put into this project - and how responsive you are.

I'll see tonight if I can install the beta.

Until then, I am still wondering why (at least sometimes) the valve position does go to 0%... upon closing the window again. Do you have any idea?

jmcollin78 commented 10 months ago

Until then, I am still wondering why (at least sometimes) the valve position does go to 0%... upon closing the window again. Do you have any idea?

Yes it was badly coded. I have recoded this part and add some unit tests.

jmcollin78 commented 10 months ago

https://github.com/jmcollin78/versatile_thermostat/releases/tag/5.3.3

nurunet commented 10 months ago

I confirm, 5.3.3 seems to have fixed the issue. Merci beaucoup !