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 support for retrieving central heating flow temperature (OpenTherm) #210

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

Conversation

strix-technica
Copy link

Since October 2022, API endpoints have existed to set the maximum flow temperature and get the last recorded flow temperature on OpenTherm installations (at the least).

This PR adds support for reading current flow temperature (API and CLI). I haven't added a setter, but it looks like it would not be difficult.

A test is included, and I also updated test_devices to cope when not all the devices checked are available in this instance.

test(api): fix test_devices not to check for absent device types

test(api): add device type BR02 (wireless receiver) to test_devices
@strix-technica
Copy link
Author

strix-technica commented Nov 19, 2023

Ah. The API endpoint in question uses the bridge's "Auth Code" for authentication, rather than the bearer token used by the rest of the API, because it is intended for use by installers etc who don't have access to the user's account. For the unit test, therefore, I added environment variable TADO_BRIDGE_AUTHKEY so this API call can be tested.

I've just noticed that either the test workflow is going to need modification to import this from github secrets, or the unit test will need to be modified to skip that test if this env var isn't defined. Let me know what, if anything, you'd like me to do further on that.

@germainlefebvre4
Copy link
Owner

Thank you very much for paying attention to this lib :) I appreciate contributions from the open source community <3

I will take a look at this in the next few days

hotWaterZonePresent (bool): whether controller includes DHW
boiler (dict): output temperature (celcius) with timestamp

Example:
Copy link
Owner

Choose a reason for hiding this comment

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

Rebase from master to apply the doc templating in the get_boiler_state method:

  • Add a description
  • Change the result example layout
  def get_boiler_state(self, authKey):
    """
    Add a description here.

    [...]

    ??? info "Result example"
      ```json
      {
        "state": "INSTALLATION_COMPLETED",
        "deviceWiredToBoiler": {
          "type": "BR02",
          "serialNo": "SOME_SERIAL",
          "thermInterfaceType": "OPENTHERM",
          "connected": true,
          "lastRequestTimestamp": "2023-11-18T16:22:01.788Z"
        },
        "bridgeConnected": true,
        "hotWaterZonePresent": false,
        "boiler": {
          "outputTemperature": {
            "celsius": 50.01,
            "timestamp": "2023-11-18T16:29:35.785Z"
          }
        }
      }
      ```
    """

The PR will generate a preview RTD link to help you fine tuning the mkdocstring.

@@ -24,6 +25,20 @@ def test_get_zones(self):

assert response[0]["id"] == 1

def test_get_boiler_state(self):
Copy link
Owner

Choose a reason for hiding this comment

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

Add a condition to allow running the unit test without the TADO_BRIDGE_AUTHKEY envvar, which will be 99% of the times in the CI/

@strix-technica
Copy link
Author

Acknowledged, sorry about the delay, will get to it ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants