jmcollin78 / versatile_thermostat

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

Add a support for central boiler: switch on the boiler when one underlying is on #234

Closed jmcollin78 closed 7 months ago

jmcollin78 commented 9 months ago

Cf. title. Give some clues to solve this: (listen the hvac_action changes, when one is Heating -> start the central boiler)

jmcollin78 commented 8 months ago

The feature could be:

  1. add a central configuration switch which turns on / off the central boiler,
  2. add an optional flag on over_climate to control the boiler,
  3. if configured, turns on the boiler if at least one of all VTherm (over_climate / over_valve only) are heating (hvac_action is Heating),
  4. turn off the boiler if all VTherm are Idle or Off.
HACS-bank commented 8 months ago

Would this idea work better as a separate integration?

Reasoning: I have eight UFH circuits which share the same heat source, but only five are controlled by VTherm ... so if I wanted to use this, I would need some way to have it cover all eight physical zone valves / alternatively, if i wanted to use this feature, I would need to create three more Vtherms ...

but my zone valves already command the heat source using a relay box, so I am not a good person to imagine the use case. I would not use this feature if developed.

jmcollin78 commented 8 months ago

Hello @HACS-bank,

I understand your point. I have difficulty to understand why you don't have all your climate controlled by VTherm. But I guess this is something I will have to take into account... or not and then, like you said, this feature will not be usable for your case.

I'm pretty sure some people have to implement an automation that does exactly what I propose to implement natively: start central boiler when at least one heater need to heat.

But because I'm not sure, of that I will wait if this need is a real need. I understand, it is not applicable for your case.

garywg commented 8 months ago

Hi, firstly, thank you for great efforts on Versatile Thermostat. I was looking at VTherm to use and could not figure out from the instructions how to control the central boiler using VTherm if one or more TRV is requesting heat using VTherm until I saw this issue which means (currently) it does not support this functionality. Having the ability to control the boiler on/off in the method you describe here would be useful for my use case.

My use case scenario as follows; I am using Hive Thermostat and Hive TRVs connected using Zigbee2MQTT. All my radiator have installed a Hive TRV. (Except 1 - this I standard in Uk to prevent overpressure if boiler pump runs and all TRV are closed)

To control the boiler I have to do exactly us you say above, I have an automation that runs if any TRV requests heat ( I use template sensor across all TRVs to do this check) I increase set point temp to 1.5 above current on boiler, and then switch mode to heat. (the Hive thermostat serves no purpose in the setup other than I must use it to activate the boiler if any TRV requests heat). When the automation switches on the boiler, I also start a timer for one minute, at the end of 1 minute, I check if any TRV is still requesting heat, if no TRV is requesting heat, I switch off the boiler (if there is TRV still requesting heat, I restart timer for another minute) and set the thermostat temp back to the original value. (the 1 minute is a variable for the timer - I am currently experimenting to see what is optimum) I don't want the boiler to run for longer than 1 minute if no TRV is requesting heat. I use timer instead of directly go to off if no TRV requesting heat, in case someone is manually adjusting TRV up/down - I did not want boiler jumping on/off/on/off etc

The challenges/complications I have: 1) if somone manually change the TRV target temp on TRV itself - boiler could run 'forever', to combat this :

I am leaning towards option 3 above using the Presence, time of day, lux reading to set mode of each room, then depending on mode TRV may or may not call for heat which is why I am looking at VTherm. If heat is requested from any TRV, then activate the boiler, increase set point temp to 1.5c above current. This means boiler needs no schedule, no specific temp, only that set point temp is 'boosted' above current temp to ensure boiler does switch on.

Short Summary I think, certainly for my use case, this will be a 'real need'. If you do implement the ability to trigger boiler if any TRV requesting heat, in my use case it would need :

I hope use case info was useful.

jmcollin78 commented 8 months ago

Thank you, @garywg ,

This is a very valuable return of experience. What I intend to do is not to control directly the boiler but to give an easy way to inform (an automation / a user ...) that the boiler should be turned on.

Depending of the boiler, one will need to change the target temperature and hvac_mode to force heat, one will just need to activate a switch. I think It could be difficult to try to manage all different use case. With VTherm, the philosophie it to simplify the integration with each specific environment and limit as much as possible any automation. Your post reinforces this idea for me.

What could be possible:

  1. add a virtual switch entity which represent the boiler. When this switch is on, the boiler should be turned on else turned off,
  2. add a flag on each VTherm: True if it should control the boiler,
  3. each time a VTherm with the flag at true, turns on or off, checks for all VTherm if one is 'on'. If yes, turns on the virtual switch of the boiler.

This is simple to implement and should be useful to integrate on different environment.

What do you think about that proposal ?

johnbur1 commented 8 months ago

@jmcollin78 many thanks for all your work on this, it is excellent. Regarding control of the boiler, what you suggest is pretty much what I do currently in an automation - using the count of how many climate entities are calling for heat to decide when to fire the boiler. One thing I have found is that if you have multiple vtherms, you can get in a situation where the boiler is constantly on as the vtherms are out of sync - ie one calls for heat, reaches temp, then another does the same etc, etc. Therefore, some way of coordinating them to reduce boiler on time would be great. Hope that makes sense!

jmcollin78 commented 8 months ago

Hello @johnbur1 ,

Thank you for your feedback. I agree with your statement. It is possible that the boiler will be always on. But it is already the case without VTherm I guess and is it really an issue ?

Remember that for VTHerm over climate, VTherm doesn't control directly the TRV. So it will rely on the TRV climate heating algorithm and will not be able to optimize things.

For VTherm over_valve, the VTherm is controlling the valve open percent directly but I don't see how to have any optimisation possible. If we need to open 30% to regulate the temperature, the regulation will be impacted if the 30% are not respected.

garywg commented 8 months ago

Thank you, @garywg ,

This is a very valuable return of experience. What I intend to do is not to control directly the boiler but to give an easy way to inform (an automation / a user ...) that the boiler should be turned on.

Depending of the boiler, one will need to change the target temperature and hvac_mode to force heat, one will just need to activate a switch. I think It could be difficult to try to manage all different use case. With VTherm, the philosophie it to simplify the integration with each specific environment and limit as much as possible any automation. Your post reinforces this idea for me.

What could be possible:

  1. add a virtual switch entity which represent the boiler. When this switch is on, the boiler should be turned on else turned off,
  2. add a flag on each VTherm: True if it should control the boiler,
  3. each time a VTherm with the flag at true, turns on or off, checks for all VTherm if one is 'on'. If yes, turns on the virtual switch of the boiler.

This is simple to implement and should be useful to integrate on different environment.

What do you think about that proposal ?

Hello, that is a simple and effective solution that you propose. Some automation/logic will be still needed to make use of the boiler switch, but, I think anything more will not cover all possible scenarios and therefore makes it good proposal. In my case, it will additionally simplify the logic needed to check the TRVs so that is also a plus for what you propose for my user case.

garywg commented 8 months ago

In my opinion don't think there is a solution for the case where because of when each TRV requests heats the boiler could run 24/7. In my testing this indeed what I experienced - boiler ran 24/7.

The only way around this was to 'fine tune' each room where there is TRV. to Explain: using presence, motion, time of day set a 'profile' for each TRV (and therefore room). The profile, in my case to keep things simple (I am always a believer in KISS principal), is something like ; Bedrooms: No-one Home = 14c, Room Occupied = 19c, People Sleeping=18c, Unoccupied=16c Other rooms: No-one Home = 14c, Room Occupied = 21c, Unoccupied=17c

By 'applying' these profiles to each room type based on presence, motion, lux level, time of day and then adjusting the temp in each profile for further 'tuning' you can significantly limit this issue.

I tried using

Most success I had in limiting run time was 2 room types, profiles for each room type and applying these dynamically. Also biggest test was passed on this approach - wife did not complain about too hot/too cold.

Having tested all these combos I am now rewriting my heating automations with a view to also using VTherm as follows;

  1. Use outside temp to determine if heating will be active
  2. House can have 2 Heating Profiles selected by user a) House Schedule -or- b) Room Occupancy
  3. House Schedule = 1 schedule where you can set required temp at specified times for entire house and then an automation sync each TRV temp to the central thermastat temp when change in temp on the schedule. This give equivalent of 'traditional' heating logic.
  4. Room Occupancy - per above apply profile to room based on presence etc - each profile has associated temp which the automation set TRV. Another automation turn boiler on/off based on demands from TRV

VTherm if I understood everything correctly will allow me achieve most of the functionality around the "Room Occupancy" profile functionality with minimal need for 'extra' work needing to be built by me. And if the boiler control is implemented, then even less extra work for me.

pieri70 commented 8 months ago

I already made this automation with help of HA community. I made an automation that controls the state of each underlying TRV and sets the central thermostat target temperature high/low if heat is needed or not. If at least one TRV is in heating state the central wifi thermostat is set to 25°C and the boiler starts. If all TRV are idle then the central thermostat target temperature is set to 15°C so the boiler is turned off. I used this automation but you could also use a switch (dry contact) turned on/off.

This is the automation:

alias: TurnOnBoiler
description: Turn on boiler if any TRV demands heat
trigger:
  - id: "25"
    platform: template
    value_template: >
      {{ ['climate.trv_cucina', 'climate.trv_davide', 'climate.trv_matr','climate.trv_sog_g']
      | select('is_state_attr', 'hvac_action', 'heating') | list | count > 0 }}
  - id: "15"
    platform: template
    value_template: >
      {{ ['climate.trv_cucina', 'climate.trv_davide', 'climate.trv_matr','climate.trv_sog_g']
      | select('is_state_attr', 'hvac_action', 'heating') | list | count == 0 }}
condition: []
action:
  - service: climate.set_temperature
    target:
      entity_id: climate.casa
    data:
      temperature: "{{ trigger.id|int(15) }}"

P.S. I don't know how to format yaml code with correct indent, sorry

jmcollin78 commented 8 months ago

I don't know how to format yaml code with correct indent, sorry

To format in yaml, just select the code and click on the "code" button (<>)

This is an interesting post you have done. This will inspire myself for doing this feature. You will have directly a binary_sensore which is true is boiler should be On or false else. This will simplify (but not cancel) the automation you done.

pieri70 commented 8 months ago

Here is the original discussion I had on Home Assistant community https://community.home-assistant.io/t/best-way-to-turn-on-switch-based-on-true-false-conditions/664551 The solution was given by Taras, I just modified it on my needs.

At the beginning I wanted to control a zigbee switch that I wanted to install in parallel with the Tuja Wifi Thermostat.

So Taras suggested me to use an automation with on/off action on that switch.

Then I discovered that I could also set the temperature of the Tuja Wifi Thermostat. So I modified the automation and now the Tuja Thermostat works as a "switch", its reading of the temperature is irrelevant. With authomation I just set target temperature on it (25°C turns on the boiler and 15 turns it off). You can use any value you want, I used 25°C and 15°C because usually in my home temperature range is 23/17°C So there is no need for a parallel switch to the Wifi thermostat

jmcollin78 commented 8 months ago

Hello dear users,

I have released a pre-release with the central boiler feature: https://github.com/jmcollin78/versatile_thermostat/releases/tag/5.3.3.beta1

Because I don't have any central boiler in my house I would like to ask you to make some real tests. It have been tested locally with a fake boiler, so I guess it is working as expected. But real conditions are always necessary.

If you would like to help me to test this feature, please install the 5.3.3.beta1 release and announce yourself here (https://github.com/jmcollin78/versatile_thermostat/discussions/339). I will centralize all remarks in this discussion.

The documentation have been updated here (not on the main branch now): EN, FR

My objective is to have a full release on next week.

Have a nice day.

Ping @HACS-bank, @garywg , @johnbur1 , @pieri70

jmcollin78 commented 7 months ago

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