10000 Add nobo_hub dynamic temperature controls by lersveen · Pull Request #145157 · home-assistant/core · GitHub
[go: up one dir, main page]

Skip to content

Add nobo_hub dynamic temperature controls #145157

10000
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

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

Conversation

lersveen
Copy link
Contributor
@lersveen lersveen commented May 18, 2025

Proposed change

Add dynamic temperature controls to Nobø Ecohub integration to properly support recievers like NCU-1R, where COMFORT temperature can only be set on the heater while ECO is set from the hub.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copy link
@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @lersveen

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant
Copy link

Hey there @echoromeo, @oyvindwe, mind taking a look at this pull request as it has been labeled with an integration (nobo_hub) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of nobo_hub can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign nobo_hub Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

Copy link
@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @lersveen

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link
@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @lersveen

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@lersveen lersveen marked this pull request as ready for review May 18, 2025 20:23
@home-assistant home-assistant bot dismissed their stale review May 18, 2025 20:23

Stale

@lersveen lersveen marked this pull request as ready for review May 26, 2025 21:40
@home-assistant home-assistant bot requested a review from oyvindwe May 26, 2025 21:40
@lersveen
Copy link
Contributor Author

Implemented and tested now! Also added a very basic unit test.

@lersveen lersveen changed the title Add nobo_hub option to disable comfort control Add nobo_hub dynamic temperature controls May 26, 2025
Copy link
Contributor
@oyvindwe oyvindwe left a comment

Choose a reason for hiding this comment

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

Nice! Only some nitpicking from me.

I also have tested the feature. Unfortunately, I my thermostats are either only manual or support both eco and comfort, so I am not able to test the case for only one temperature to be controlled.

My entities shows up as expected
image

@oyvindwe
Copy link
Contributor

I am not sure if this should be considered a breaking change or not, as any automation setting the eco temperature on zones that change from TARGET_TEMPERATURE_RANGE to TARGET_TEMPERATURE will stop working. I don't think it is very likely that any users actually do that though.

Personally, I'm in favour if the proposed change in the current form!

@lersveen
Copy link
Contributor Author

Made all requested changes now! I agree this is not very likely to be breaking in practice.

I also have tested the feature. Unfortunately, I my thermostats are either only manual or support both eco and comfort, so I am not able to test the case for only one temperature to be controlled.

All my heaters have NCU-1R recievers that only support eco, so then we've at least covered the known cases.

Comment on lines 94 to 103
self._supports_comfort = any(
component["model"].supports_comfort
for component in hub.components.values()
if component["zone_id"] == zone_id
)
self._supports_eco = any(
component["model"].supports_eco
for component in hub.components.values()
if component["zone_id"] == zone_id
)
Copy link
Member

Choose a reason for hiding this comment

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

Instead, create a property that returns this, instead of iterating twice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! Pushed a new implementation with properties, though please let me know if you had something else in mind.

Comment on lines 105 to 110
if self._supports_comfort and self._supports_eco:
self._attr_supported_features |= (
ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
)
elif self._supports_comfort or self._supports_eco:
self._attr_supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE
Copy link
Member

Choose a reason for hiding this comment

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

these can be simplified

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed these, but whether the new version is simpler depends a lot on what you mean by "simplified". Shorter? More verbose? More efficient?

}

# Both comfort and eco supported
zone = NoboZone("zone_1", mock_hub, "override_type")
Copy link
Member

Choose a reason for hiding this comment

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

We don't want to create entities in the tests, we want to mock out the library and have HA create the entities for us and then check their state through the state machine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, working on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will take time. There is no way to do what you're asking without writing tests way beyond the scope of my PR.

@home-assistant home-assistant bot marked this pull request as draft May 30, 2025 18:14
@lersveen lersveen requested a review from joostlek June 1, 2025 23:40
@lersveen lersveen marked this pull request as ready for review June 2, 2025 00:13
@home-assistant home-assistant bot requested a review from oyvindwe June 2, 2025 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0