KartoffelToby / better_thermostat

This custom component for Home Assistant will add crucial features to your climate-controlling TRV (Thermostatic Radiator Valves) to save you the work of creating automations to make it smart. It combines a room-temperature sensor, window/door sensors, weather forecasts, or an ambient temperature probe to decide when it should call for heat and automatically calibrate your TRVs to fix the imprecise measurements taken in the radiator's vicinity.
https://better-thermostat.org
GNU Affero General Public License v3.0
887 stars 131 forks source link

BetterThermostat Climate HVAC action not accurate #1165

Open niddu85 opened 1 year ago

niddu85 commented 1 year ago

Prerequisites

TRVs Moes BRT-100-TRV

External temperature sensors: Tuya/Moes TS0201

Description

I use to switch the heating system on / off the hvac_action state of the BT climate entity when value is "heat" I noticed the state hvac_action state of the BT entity does not follow the hvac_action state of the TRV.

In this screenshot see the status of the BT climate entity: image

This is the status of the TRV climate entity: image

as shown the TRV wants to start heating, but BT state is off. I also noticed that in this exact moment the TRV valve position is also partially opened: image

This leads to some heaters heating even if they are not calling for heat.

example: i have 3 heaters on a floor: kitchen, living room and bathroom; only kitchen is calling for heat (using hvac_action from BT) but also the bathroom heater is heating up since the valve is partially open (and the TRV hvac_action is calling for heat)

Here are also 2 screenshots related to the same period, the first one is from the BT device, the second from the TRV

Better thermostat image

TRV image

In this case the TRV valve was open and asking for heat, but Better Thermostat was not calling for heat

Expected behavior:

When a heater is not calling for heat it should be cold!

Actual behavior:

When another heater calls for heat, also other heaters are heating

Versions

HA version: 2023.9.0 BT version: 1.4.0

LeoCal commented 11 months ago

Same here, hvac_action does not follow the actual status of the TRV. In my case it's exactly the opposite, i.e. hvac_action=heating all the time, regardless of whether the TRV is heating or it's off. The TRV seems to work normally though, but I cannot count on hvac_action status to report the actual status of the valve in my automations. The main value of the climate entity itself seems to be correct instead.

LeoCal commented 11 months ago

Ok, I've done a bit more testing and I think it's a bug happening only when I turn off the climate (i.e. moving from heat to off), which doesn't get reflected into the hvac_action, that stays in "heating" state. It works correctly for other triggers, for instance if I open the window - in this case I see hvac_action moving into the expected "idle" state.

LeoCal commented 11 months ago

I have glanced through the code and I've found a fix for this issue. The PR solving it is: https://github.com/KartoffelToby/better_thermostat/pull/1192

I have tested it locally and it works fine.

AaronF commented 11 months ago

I have glanced through the code and I've found a fix for this issue. The PR solving it is: #1192

I have tested it locally and it works fine.

Interestingly for me, this doesn't seem to fix anything for me until I remove the first bit of the if statement "self.attr_hvac_action is None". If I don't remove that check, that first statement never seems to be true. Removing it seems to solve the issue and now "off" actually updates the hvac_option (with your fix applied).

So:

if (
    self.attr_hvac_action is None
    and self.bt_target_temp is not None
    and self.cur_temp is not None
):

Becomes:

if (
    self.bt_target_temp is not None
    and self.cur_temp is not None
):

I guess it could also just be switched to check for "not None" instead of "None".