This seems to work fine and appears on the UI as expected.
You’ll notice that the switch in the heater section is an input helper, because i can’t directly turn on/off my TRV (it has no switch entity).
So I was assuming the thermostat would then toggle the input boolean (and currently do nothing else).
Problem 1:-
I’ve used dev tools to manipulate the value of the thermostat entity to change the current temperature to above or below the target value set in the thermostat, but the value of the input helper never changes.
Problem 2:-
I’ve written this automation (which never fires because of the above):
If I manually toggle the input helper and fire the automation, it does what I expect (it changes the HVAC mode) correctly, but… turning the HVAC mode to off doesn’t actually do anything to the TRV, its valve position (which is ultimately what I’m trying to control) stays at the same value.
I’ve also tried using climate.turn_off and climate.turn_on and whilst these function as expected in the UI, they also don’t appear to do anything to the TRV (and its valve position).
@Troon - the second I posted my question I realised I’d mixed up some entity names, but now the same problem as described in this thread is happening:-
(It will turn off but not on).
I’m just working through that thread to see if I can get ‘on’ to work.
However, it still leaves the second part of problem 2 to address:-
"If I manually toggle the input helper and fire the automation, it does what I expect (it changes the HVAC mode) correctly, but… turning the HVAC mode to off doesn’t actually do anything to the TRV, its valve position (which is ultimately what I’m trying to control) stays at the same value.
I’ve also tried using climate.turn_off and climate.turn_on and whilst these function as expected in the UI, they also don’t appear to do anything to the TRV (and its valve position)."
What logic path are you thinking will turn off the TRV? Your automation doesn’t trigger on a climatehvac_mode change. If you change the climatehvac_mode to off manually, I’d have thought it’d turn the input_boolean to off, which will trigger the automation and redundantly turn the hvac_modeoff again.
Where is the control of the TRV valve position?
Please repost the code in its current state with the correct entity names.
If I use the UI to drag the target temperature to below the current temperature, the input helper immediately switches of off, and the automation fires.
If I now drag the target temperature to above the target temperature, the input helper state does not change, and no automation fires.
In the thread I posted, the following is mentioned:-
“It seems like the generic thermostat stay in preset “idle” – and that somehow messed things up.”
So I might try and change that and see if turn on will work.
As for the TRV, I’m simply looking to shut off the water to the radiator when the input boolean, controlled by the generic thermostat is off. I was assuming hvac mode: off would do that, but it doesnt seem to change the TRV’s valve position.
Still not sure why ‘on’ does not fire, but it looks like setting the generic thermostat HVAC mode does nothing to the TRV because it only has the following supported HVAC modes:-
You absolutely should not need that automation: it’s just over-complicating things. The whole point of the generic thermostat is to handle its own hvac_mode control. Your automation seems to be trying to help it, but probably making matters worse.
I still don’t understand what the control path for your TRV is — how is that linked into HA?
The reason I used an input helper and an automation is because I don’t have an on/off switch entity on the TRV itself, so I use the input boolean to fire an automation instead:-
It does sound as though you need an automation to translate the input_boolean into actions for the TRV, but that’s not what the automation previously posted does.
You need to work out what entities need to be adjusted / services need to be called to make the changes you want to your TRV, then build that into an automation triggered by the input_boolean. It won’t involve the generic thermostat’s climate entity though.
It seems that just using climate doesn’t have the desired effect on the TRV.
At this point, I’m not even sure if its possible at all, because even though valve position appears as an entity that it looks like I can alter, if I do change its value whilst sitting next to the TRV, I do not hear the valve motors moving, suggesting the TRV valve is only actually controlled internally by the target and current temperatures as recorded by the TRV, but I will continue to investigate, maybe there is a way.
The only thing I can think of if the above is true, is setting the TRV’s target temperature, that might work…
Although the generic thermostat does control the HVAC mode, it has no effect on the TRV which only has one mode ‘heat’. So I’m really just using it for the toggle on the input boolean helper that fires the above automation, which in turn, changes the target temperature on the TRV, which in turn changes the TRV’s valve position.
Whilst the above was a good bit of learning, I have also since discovered the better thermostat integration which basically does all of the above without having to code a single line of automation.
The only caveat is that I am unsure just how many times this method will actually change the TRV’s target temperature during the day, whereas the automation approach only changes the target temp if the external temp sensor exceeds (or falls below) the target temp threshold.
The answer comes a few hours later. The better thermostat undoubtedly sets the TRV’s target temperature on a much more frequent interval than using the automation provided above. There is some correlation between the frequency of these updates and the timings of the updates given by the external temperature sensor, but its not exact.
What this means in practice is that by using the better thermostat integration to control the TRV, you are often changing the trv’s target setting unnecessarily, and therefore writing to the flash storage on the TRV more frequently, which over the longer term, may reduce its operating life.
I think the other reason for the more frequent updates is that the better thermostat doesn’t appear to have a hot tolerance like the generic thermostat, so you cant sit in a comfortable temperature band, which requires no adjustment of the TRV.