Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't turn off BTRV after the lowest setpoint temperatur is reached (ex. window was opened) #1393

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TBSniller
Copy link

@TBSniller TBSniller commented Sep 15, 2024

Motivation:

After an open window was closed, the BTRVs HVACMode often changes to the OFF state, which lead to cold rooms

Changes:

  • Removed the lines which are responsible for switching BTRV to HEAT or OFF, if the new _new_heating_setpoint is the real TRVs lowest temperature:
    if self.real_trvs[entity_id]["advanced"].get("no_off_system_mode", False):
    if _new_heating_setpoint == self.real_trvs[entity_id]["min_temp"]:
    self.bt_hvac_mode = HVACMode.OFF
    else:
    self.bt_hvac_mode = HVACMode.HEAT
    _main_change = True

I'm not sure for what these lines are for. When the window is opened, the real TRV is automatically set to the lowest temp. Then, through these lines, the BTRV is turned off.
Don't know why the BTRV is controlled here? Maybe to reflect such changes to the UI, or is there a specific reason?

If it was for the UI feedback, then these lines make a bit sense, as the BTRV would be set back to HEAT, if _new_heating_setpoint goes back to a higher temperature. But then the issue here is, that this statement is never reached again, as its blocked by this if statement

and self.bt_hvac_mode is not HVACMode.OFF

So if there wasn't a real need for this kind of behavior, my changes should be enough.
Otherwise I think the logic must be fixed, so statement is reached again that turnes the BTRVs HVACMode back to HEAT. But in my opinion, it could still lead to more problems, if BTRV controls it's own HVACMode.

Related issue (check one):

Checklist (check one):

  • I did not change any code (e.g. documentation changes)
  • The code change is tested and works locally.

Test-Hardware list (for code changes)

Debian 11 VM 4GB and devcontainers according to CONTRIBUTION.md

HA Version: 2024.9.1
Zigbee2MQTT Version: 1.40.1-1
TRV Hardware: TS0601 (BRT-100-TRV)

New device mappings

  • I avoided any changes to other device mappings
  • There are no changes in climate.py

@KartoffelToby
Copy link
Owner

@TBSniller sry for the long wait...

This lines should be only activate when the advanced setting "no_off_system_mode" is on.

So it shoudn't be removed.

@TBSniller
Copy link
Author

@KartoffelToby Yeah, my thermostat seems to not support to be turned off.

For what purposes are these lines needed? I'm running without them for this and the late last winter without any problems and the fixed issue.

@KartoffelToby
Copy link
Owner

@TBSniller Its for the BT interface, if your Thermostat is on min temp its equal to "off" for better UX if the window or summer detection kicks in. What exacly in this code breaks your BT?

@TBSniller
Copy link
Author

@KartoffelToby Okay that's what I thought.
The issue with it is, that it will never reflect the change to go back to heat, as the statement for it is unreachable if the BT is currently off.

Like here you would turn it back on, which I think would lead to a working window open/close function:

But this condition prevents that we ever can reach this:

and self.bt_hvac_mode is not HVACMode.OFF

@bueeler
Copy link
Contributor

bueeler commented Nov 3, 2024

Just want to mention I have exactly same issue as @TBSniller and fixed it in same way by removing those lines.
This fix was without issue last heating period, before that change BT was not usable for me as heating was kept turned off after window was opened.

Copy link
Owner

@KartoffelToby KartoffelToby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as an suggestion

@KartoffelToby KartoffelToby self-requested a review November 3, 2024 20:37
@KartoffelToby
Copy link
Owner

@TBSniller Sry i messed up the Github review panel, but the code shoud be updateted now, pls take a look if this workaround fixes your issue too

@TBSniller
Copy link
Author

@KartoffelToby
Cannot test at the moment as I'm not at home. Will come back this weekend and will then let you know.

Already thanks for your effort!

But out of interest, why are these on off states reflected to the buttons in the UI? I now also have a feeling it could lead to false positive On's when the windows are closed again.

I thought for these changes there you put in this heater symbol which goes red when it's heating
Screenshot_20241103-221538_Home Assistant~2.png

@KartoffelToby
Copy link
Owner

@TBSniller

Dont worry, take your time, i plan to merge your PR in the next release 1.6.2

The small heat icon in the middle actually has nothing to do with the MODE itself, but responds to the hvac_action attribute. If the window is open, the HVAC_MODE goes to off, if you use the UI card, you have the blue indicator with the window icon, but there is also the attribute window_open for this. If the window is closed again, BT goes back to the mode before the window was opened , i.e. HEAT or OFF, HEAT would be displayed red in the BT UI with the flame icon in red, OFF gray with the off icon in gray

@MariusSchiffer
Copy link

The PR works for me

@bueeler
Copy link
Contributor

bueeler commented Nov 6, 2024

For me only original PR worked.
But latest modification results in TRV switched off after window was open and closed:
1

2

3

Means original issue not solved.

I think this is because BT cannot distinguish between TRV is intentionally off or just set to 4°C because of window open.
It keeps switched off here:
grafik

@KartoffelToby KartoffelToby modified the milestones: 1.6.2, 1.7.0 Nov 7, 2024
@TBSniller
Copy link
Author

@KartoffelToby Just have checked it out.
I can confirm @bueeler - with your latest changes its not working. A change to the internal temperature triggers the trigger_trv_change function and turns the thermostat off, but now again never on.

Here the flow to replicate:

  • BTRV turned to 20.0° (heat) | external sensor 19.0° | internal sensor 19.9° | Window closed
  • BTRV turned to 20.0° (heat) | external sensor 19.0° | internal sensor 19.9° | Window opend
  • BTRV turned to 20.0° (heat) | external sensor 19.0° | internal sensor 19.8° | Window opend
  • BTRV turned to 20.0° (gets turned off) | external sensor 19.0° | internal sensor 19.8° | Window opend

After that changes to temps or binary sensor doesn't take affect to BTRV, so it stays off.

I found why:
As expected with your change to the if-statement, we can now reach

if self.real_trvs[entity_id]["advanced"].get("no_off_system_mode", False):

Unfortently it's still not working as _new_heating_setpoint equals to 7.0 which reflects the min_temp:
image
So BTRV is not set back to HEAT. The question here: Why is it set to 7.0°? Shouldn't it be the new calculated value? Or will it never have the new value as BTRV is off and off equals to set to 7.0°?


Also with your explanation I'm still a bit confused why the HVACMode is directly changed. I'm wondering if it is correct to not have used HVACAction like this

        if self.real_trvs[entity_id]["advanced"].get("no_off_system_mode", False):
            if _new_heating_setpoint == self.real_trvs[entity_id]["min_temp"]:
                self.attr_hvac_action = HVACAction.OFF
            else:
                self.attr_hvac_action = HVACAction.HEATING
            _main_change = True

Changing the lines to this also reflects the changes to the UI (although when HVACAction.OFF is not working and it automatically sets it to HVACAction.IDLE) without touching the real HAVCMode state that the users wants.
But actually these changes do nothing additional then my initial PR.

image
image

@stefanhepner
Copy link

Hello,
I have the same issue. Testet on 1.6.1 and 1.7.0.
TRV is on, window is closed. After opening the window the TRV turns off, so far so good. After closing the window the TRV stats off and the UI stays grey. Any solution for this?

@TBSniller
Copy link
Author

TBSniller commented Nov 17, 2024

@stefanhepner This PR is not finished, so you will not find these changes in your installed integration.
As a workaround you can for example use the Studio Code Server Add-on to access /homeassistant/custom_components/better_thermostat/events/trv.py, if you are using Supervisored HA.
In this file you can remove line 204-209 to temporary fix this issue. They will come back when you update the extension.

if self.real_trvs[entity_id]["advanced"].get("no_off_system_mode", False):
if _new_heating_setpoint == self.real_trvs[entity_id]["min_temp"]:
self.bt_hvac_mode = HVACMode.OFF
else:
self.bt_hvac_mode = HVACMode.HEAT
_main_change = True

@TBSniller TBSniller removed their assignment Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open and close a window most of the time doesn't reset heating mode correctly
5 participants