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

Add Bosch Radiator Thermostat 2 (RBSH-TRV0-ZB-EU) quirk #2808

Open
wants to merge 40 commits into
base: dev
Choose a base branch
from

Conversation

jclsn
Copy link
Contributor

@jclsn jclsn commented Dec 6, 2023

Proposed change

The quirk provides Bosch specific thermostat and interface clusters, which add additional attributes and expose some common attributes on different addresses.

Fixes #2476

Additional information

Not sure how to handle what I called the operating_mode attribute and the system_mode attribute.

Operating modes:

  • Schedule or Auto
  • Manual
  • Pause

System modes:

  • Heat
  • Cool

I think those should ideally be combined into one system_mode attribute to be accessible in the thermostat entity.

Furthermore I would be happy to receive assistance in exposing these attributes as entities in the core.

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

@jclsn jclsn changed the title Add Bosch Thermostat 2 quirk Add Bosch Radiator Thermostat 2 (RBSH-TRV0-ZB-EU) quirk Dec 6, 2023
@promasu
Copy link

promasu commented Dec 22, 2023

Is there some way I can support you in writing the quirk. I started the same some time ago and was to quick with pushing everything to GitHub and creating a Draft PR.

I'd like to support you if possible.

@jclsn
Copy link
Contributor Author

jclsn commented Dec 23, 2023 via email

@promasu
Copy link

promasu commented Dec 23, 2023

I've seen that you are missing at least one attribute, the remote temperature input, which I'd add, but I think I'll do this using a PR on your fork repository and branch

@jclsn
Copy link
Contributor Author

jclsn commented Dec 23, 2023 via email

@promasu
Copy link

promasu commented Dec 23, 2023

Actually I'd use it with some temperature sensors I have across my rooms to get a more accurate heating. I think this should be possible so better adding it then missing it ;)

For the ha/core part I just scrolled a bit across the code and I think I should be able to assist you with writing the entities, but I can't test my code until next year, as I'm on CCC Congress.

Should we just create a branch for this in a fork of yours or mine and push code when we have time?

@jclsn
Copy link
Contributor Author

jclsn commented Dec 23, 2023

You can set the temperature using the Advanced Heating Control blueprint. Much better to let HA do it!

I am on vacation and not back before January. So yeah, just go ahead and make your changes when you find the time! Do I need to add you as a collaborator to the PR or something?

@promasu
Copy link

promasu commented Dec 23, 2023

Yes I know that blueprint but i find it quite charming to have the thermostat regulate the valve using the temperature inside the room :D

I don't think that you have to add me anywhere. If I have the time I'll open a draft PR to HA/core and add you there, that should be sufficient

@promasu
Copy link

promasu commented Dec 23, 2023

I seems like I can't create a PR in your fork. Can you give me access to the branch where you are developing or give me somehow permission to create a PR? :D

Thanks!

@jclsn
Copy link
Contributor Author

jclsn commented Dec 24, 2023

I added you as collaborator :)

@Samueras
Copy link

Hey, is there a way to already use this?

@Fxsch
Copy link

Fxsch commented Mar 11, 2024

Is this still being worked on? I wouldn't mind helping out

@jclsn
Copy link
Contributor Author

jclsn commented Mar 11, 2024

@Fxsch The quirk works, but the cluster handlers in ZHA from the HA Core side are harder to implement. I need help there from a HA developer, but it is hard to get a hold of them.

@mrrstux
Copy link

mrrstux commented Apr 24, 2024

Hi! Here is one updated quirk that adds system mode (Heat, Off) integration with HA: #2476 (comment)

@mrrstux
Copy link

mrrstux commented Apr 30, 2024

Updated based on v2 API - #2476 (comment)

@jclsn
Copy link
Contributor Author

jclsn commented May 1, 2024

@mrrstux I invited you as collaborator to my fork. This way you can add commits to this MR! :)

Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 94.06393% with 13 lines in your changes missing coverage. Please review.

Project coverage is 89.54%. Comparing base (728ee42) to head (d370182).

Files with missing lines Patch % Lines
zhaquirks/bosch/rbsh_trv0_zb_eu.py 92.89% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2808      +/-   ##
==========================================
+ Coverage   89.44%   89.54%   +0.09%     
==========================================
  Files         311      313       +2     
  Lines       10033    10252     +219     
==========================================
+ Hits         8974     9180     +206     
- Misses       1059     1072      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mrrstux
Copy link

mrrstux commented May 2, 2024

Thanks! I've pushed my changes directly to this branch. If that was not desired, feel free to revert it and then I'll see if I could push a merge request instead (I do not have much experience with github).

@mrrstux mrrstux force-pushed the add-bosch-thermostat2-quirk branch from 877757e to c2eede2 Compare May 3, 2024 05:04
@jclsn
Copy link
Contributor Author

jclsn commented May 3, 2024

Feel free to works on this PR! I have no interest in continuing this atm, so you can do your thing and try to get it merged. Maybe ask for help on Discord if you are unsure how to pass the code coverage. First thing you should do is format the code with Black. Click on the details of the failed checks and see what needs to be changed!

@mrrstux
Copy link

mrrstux commented May 7, 2024

@jclsn The description of this PR needs updating, but I do not seem to have the rights to do it. With your permission, I would like to bring it up-to-date.

@jclsn
Copy link
Contributor Author

jclsn commented May 8, 2024

Great job! You really made an effort. Let me test out the quirk for the TRV. I think I cannot give you rights to edit the PR description here. What do you want me to change?

@jclsn
Copy link
Contributor Author

jclsn commented May 8, 2024

Unfortunately I can't test it, since I have trouble pairing the device. This has always been troublesome, but now it doesn't work at all anymore.

@mrrstux
Copy link

mrrstux commented May 8, 2024

@jclsn I had issues pairing my TRV as well, after multiple pair-remove sessions while working on this quirk. The solution on my side was to backup+restore ZHA Network.

As for what to add to the PR descriptions:

  • it is now about Bosch Room Thermostat II 230V and Bosch Radiator Thermostat II
  • the translation table mentioned in one of the commits above
  • for Bosch Radiator Thermostat II, only Heat/Off/Auto modes are supported (no cooling).

@jclsn
Copy link
Contributor Author

jclsn commented May 10, 2024

Might be related to this https://discord.com/channels/651488327630979131/651489945172836355/1238474646316384277

Seems like the Bosch Thermostat Integration is also having issues because of some Python versions.

@lgraf
Copy link

lgraf commented May 12, 2024

Hi, thank you for the work on the new quirk, really helpful. I tested the quirk with a Thermostat II 230V and most of the stuff works great. Still i think there are a few difference between the Thermostat II 230V and the Radiator Thermostat II.

Notes for Thermostat II 230V

  • OPERATING_MODE_ATTR_ID: works as expected.
  • VALVE_POSITION_ATTR_ID: can not be controlled stepwise, there is only open/closed (0%/100%).
    • ✅ The quirk shows the the pi_heating_demand attribute as read only diagnostic property.
  • WINDOW_OPEN_ATTR_ID works as expected.
  • BOOST_ATTR_ID i can not find anything about the "boost mode" in the device manuals (neither for the Radiator Thermostat II). What does this exactly do?
    • ✅ However my device also exposes the zigee attribute 0x4043 (value: 0/1) and can be modified through ha. But in the end i am not sure how it affects the thermostat. There is also no symbol shown on the device display.
  • SCREEN_TIMEOUT_ATTR_ID works as expected.
  • SCREEN_BRIGHTNESS_ATTR_ID works as expected.

Not sure about the Radiator Thermostat II but the Thermostat II 230V supports a "cooling mode" (inverting the logic when the thermostat opening the valve.)

  • heating: current_temp<target_temp
  • cooling: current_temp>target_temp

Like discussed in #2707 (comment) the mode can be set through the ZCL ControlSequenceOfOperation Attribute (thremostat).

There is an example quirk that exposes the ControlSequenceOfOperation Attribute as config property. (tested with Thermostat II 230V).

lgraf@55043e8

If this is useful also for Bosch Radiator Thermostat II users (e.g. heat pump with a radiator infrastructure), feel free to use the example code.

Don´t want to highjack this PR, if preferred i can a create a seperate PR for #2707 after this PR was merged.

Thanks again. 👍

@mrrstux
Copy link

mrrstux commented May 12, 2024

@lgraf Thanks for trying it out! I was not interested in cooling, but, I can merge your change into this PR.

As far as I read, boost is called "fast heating" in Bosch App and, for radiator thermostat, it opens the valve to 80% for 5 minutes. Not sure when and why you would want it, but it is there. Also, for my underfloor heating, boost also doesn't make much sense for the room thermostat (230V).

I'm not entirely sure about exposing pi_heating_demand for room thermostat (230V). I added it it just because it looked like being exposed by zigbee2mqtt. For complete cooling support, we might need to also expose pi_cooling_demand.

mrrstux and others added 23 commits November 15, 2024 16:15
@Hedda
Copy link
Contributor

Hedda commented Nov 16, 2024

@mrrstux Tip if it is still work-in-progress then it is usually a good idea if you set it as a draft until it is ready to be reviewed by ZHA Device Handlers developers.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests

You can select "Convert to draft" yourself (to the right) then later also change it back yourself by clicking on "Ready for review":

image

image

@mrrstux
Copy link

mrrstux commented Nov 16, 2024

@Hedda It is not a draft. Current state is ready for mass consumption. The build failure is caused by old zigpy dependency (0.70 vs 0.71 being needed).

@doerek
Copy link

doerek commented Nov 16, 2024

Perhaps a dumb question and probably the wrong place (but): What would be needed to get the new entitys and functions once the code gets added to HA?
Do i just need to "reconfigure" the Radiator Thermostat through ZHA in HA?

@mrrstux
Copy link

mrrstux commented Nov 16, 2024

Perhaps a dumb question and probably the wrong place (but): What would be needed to get the new entitys and functions once the code gets added to HA? Do i just need to "reconfigure" the Radiator Thermostat through ZHA in HA?

No actions should be needed once the quirks are in a HA release, but:

  • in cases where some entities don't update, a reconfiguration would be needed.
  • some pre-existing entities might become unavailable after matching to a new quirk. They would need to be manually removed.

@Hedda
Copy link
Contributor

Hedda commented Nov 16, 2024

It is not a draft. Current state is ready for mass consumption.

Ok, cool! i just assumed it was still WIP (work-in-progress) since still keep adding or changing stuff almost daily, (and guessed some zha-quirk devs might think the same and waiting to review until it is no longer a moving target), anyway that is why I suggested to change it to draft and then click the ”ready for review” to signal that it is finally ready to be reviewed.

@mrrstux
Copy link

mrrstux commented Nov 16, 2024

@Hedda Unfortunately, I do not have the permissions on this PR to play with its draft state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 quirk Quirks using v2 API. Might add custom entities that need translation keys in HA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Device Support Request] Full implementation of BOSCH Radiator Thermostat II (BTH-RA)