-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Add nobo_hub dynamic temperature controls #145157
10000New 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
base: dev
Are you sure you want to change the base?
Conversation
As implemented upstream in pynobo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Hey there @echoromeo, @oyvindwe, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented and tested now! Also added a very basic unit test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this should be considered a breaking change or not, as any automation setting the Personally, I'm in favour if the proposed change in the current form! |
Made all requested changes now! I agree this is not very likely to be breaking in practice.
All my heaters have NCU-1R recievers that only support eco, so then we've at least covered the known cases. |
Use bitwise-and to check feature flags.
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 | ||
) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these can be simplified
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: