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

hvac_action attribute stays in "heating" state even if Better Thermostat is turned off. #1193

Closed
2 of 3 tasks
LeoCal opened this issue Dec 9, 2023 · 10 comments · Fixed by #1192 or #1340
Closed
2 of 3 tasks
Assignees
Labels
new bug incoming bug issue

Comments

@LeoCal
Copy link
Contributor

LeoCal commented Dec 9, 2023

Prerequisites

  • Model name of your Devices
  • Output from Home Assistant Developer Tools state e.g.
  • Output from Home Assistant Device Diagnostic from BT

Description

Better Thermostat's hvac_action attribute stays in "heating" state even if Better Thermostat is turned off.

Steps to Reproduce

  1. Start with a Better Thermostat "on" (i.e. in "heat" state) and check hvac_action attribute is correctly in "heating" state
  2. Open a window and see how hvac_action is correctly moved to "idle". Close the window and see how hvac_action correctly goes back to "heating"
  3. Turn off Better Thermostat (i.e. move its state from "heat" to "off") and check how the hvac_action stays in "heating" state and does not get moved to "idle" state.

Expected behavior:
When turning on Better Thermostat, its hvac_attribute should move to "idle".

Actual behavior:
When turning on Better Thermostat, its hvac_attribute stays in "heating" state.

Versions

HA Version: 2023.12.1
BT version: 1.4.0

@LeoCal
Copy link
Contributor Author

LeoCal commented Dec 9, 2023

I've put together a very simple fix for this, you can find the PR here: #1192. Can you please review and approve it?

@Ashpork
Copy link
Contributor

Ashpork commented Dec 12, 2023

I have the same issue too, and would be happy to test #1192 if needed.

@LeoCal
Copy link
Contributor Author

LeoCal commented Dec 12, 2023

If you want to give it a try on your local HA instance, you can just apply the patch I posted here.

In practice, you just need to edit the file at: /config/custom_components/better_thermostat/climate.py, line 1103 and add the following condition to the if:
and self.bt_hvac_mode is not HVACMode.OFF

Then restart HA and you should see it working.

However, until this PR gets merged into BT component, this manual patch would disappear next time you update BT addon.

@Ashpork
Copy link
Contributor

Ashpork commented Dec 12, 2023

I've implemented that change, with a HA restart, but didn't see any change to the behaviour. Not sure if the fact I single mode TRVs (they only have a heat mode).

I did note that the BT climate entity state goes to "off" when you set the temp lower than the actual, regardless of the BT mode chosen.

@LeoCal
Copy link
Contributor Author

LeoCal commented Dec 13, 2023

Weird, I also have heat-only TRV and it works fine with the fix.
Just to be sure we're talking about the same thing here, the goal of this fix is to make sure that, whenever the BT thermostat is turned off (so, you manually move its state from "heat" to "off"), the BT's hvac_action attribute (and not the controlled thermostat entity) is also set to off.
If you correctly patched the code as explained, there should be no way that hvac_action attribute shows still as "heating".

@zolakt
Copy link

zolakt commented Dec 18, 2023

Thank you for the suggestion. Although that fix solves it half way.

At least with the new climate card, at least with any thermostat I've got, when you turn it off the target temperature disappears from the card. The target temperature needs to be None in order for that to happen. Currently BT doesn't clear the target temperature when hvac_mode it switched to Off. This results in the target temperature always being displayed on the card, which is unlike and "underlying" thermostat that I've got.

So, I've added these 2 highlighted lines. Maybe it's best @LeoCal includes it in his PR, unless there is something wrong with it. It's a quick patch but it should work. It don't mess with storing the value, just in the getter, in case hvac_mode is off I return None.
image

This is how it looks without the patch:
image

This is how it looks with the patch:
image

@Ashpork
Copy link
Contributor

Ashpork commented Dec 19, 2023

With the changes suggested be @LeoCal and @zolakt , I find that adding the below highlighted code resolves this completely for me. HVAC action staying as "heating" and the UI showing a target when off.

image

As this enables the climate "hvac_action to go to "idle", when the thermostat had a set temperature above current temp, and was then set to mode off. Without that change, the entity still thinks it's heating when it's used as an icon on an entity page.

@LeoCal
Copy link
Contributor Author

LeoCal commented Jan 10, 2024

Hi @zolakt, @Ashpork,

thanks for your inputs on this.
I've just seen @KartoffelToby has merged my changes.

If you still see issues after this merge, it would be great if you could open a PR with the additional changes you suggested so that the entire community would benefit from your fixes!

Cheers

@KartoffelToby
Copy link
Owner

@LeoCal yes its in the current Beta loop of 1.5.0, feel free to check it out and test the Changes

@zolakt
Copy link

zolakt commented Apr 24, 2024

If anyone is interested, after 1.5.0, I've had to modify my patch to:

if (self.bt_hvac_mode == HVACMode.OFF or self.hvac_mode == HVACMode.OFF):
    return None

Here are screenshots before and after the patch:
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment