-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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 binary sensor for Vallox post heater #59762
Conversation
Hey there @andre-richter, mind taking a look at this pull request as it has been labeled with an integration ( |
47b9c78
to
7a814e6
Compare
class ValloxBinarySensorEntityDescription(BinarySensorEntityDescription): | ||
"""Describes Vallox binary sensor entity.""" | ||
|
||
metric_key: str | None = None |
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.
In sensor.py there is the case of the profile sensor which doesn’t need a metric key, because we have to query using get_profile().
As long as we don’t have a similar case for binary sensors, we could remove the None here, which simplifies the is_on() a bit.
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.
Mypy doesn't accept that: error: Attributes without a default cannot follow attributes with one
(this comes from the attributes defined in the superclass EntityDescription)
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 think this should do the trick:
core/homeassistant/components/zwave_js/binary_sensor.py
Lines 61 to 72 in 1bd1a12
@dataclass | |
class PropertyZWaveJSMixin: | |
"""Represent the mixin for property sensor descriptions.""" | |
on_states: tuple[str, ...] | |
@dataclass | |
class PropertyZWaveJSEntityDescription( | |
BinarySensorEntityDescription, PropertyZWaveJSMixin | |
): | |
"""Represent the entity description for property name sensors.""" |
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'm not sure what you mean. The implementation in zwave_js seems quite a bit more complex as it allows multiple different values that mean "on" depending on sensor. As far as I can tell the Vallox API always uses 0 for off and 1 for on, so we shouldn't need that kind of flexibility here. Other than that the is_on method implementation there is exactly the same as the one we have here.
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 was referring to the double inheritance using the “Mixin”, which should allow you to get rid of the default None as originally mentioned.
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
As far as I'm aware this MR isn't waiting on any activity on my part. There was a suggestion for a different implementation, but as far as I can tell that implementation isn't viable. |
2ffa6f3
to
87d2648
Compare
Uncovered files need coverage or to be added to |
Any pointers to an integration that has uses the DataUpdateCoordinator pattern and has tests for individual sensors? I admit I have no idea where to start. |
|
I took a look at the tplink case but that appears to be different enough from this one (discovery instead of config) that I don't know how to get the parts I need from there. In general the initial introduction of tests for an integration appears to need a lot of deep knowledge which I don't have. Would it be unacceptable to add this to .coveragerc for now? Adding a test for this sensor is trivial once the integration has one test (enough scaffolding to initialize), I can definitely add it if someone adds that. |
Thank you for your contribution thus far! 🎖 Since this is a significant contribution, we would appreciate you'd added yourself to the list of code owners for this integration. ❤️ Please, add your GitHub username to the For more information about "code owners", see: Architecture Decision Record 0008: Code owners. |
When and whether the post heater activates is an important piece of information when attempting to configure an optimal heating strategy. Leave room for adding other binary sensors without needing to write more code, there are a lot of things the Vallox devices report as binary values.
Add extra level of inheritance to allow metric_key without default value.
All the other Vallox integration files are already listed.
0b1f366
to
0cdde9e
Compare
To address review comment by @frenck.
ffc079c
to
d24c756
Compare
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, @viiru- 👍
When and whether the post heater activates is an important piece of
information when attempting to configure an optimal heating strategy.
Leave room for adding other binary sensors without needing to write more
code, there are a lot of things the Vallox devices report as binary
values.
Breaking change
Proposed change
Add binary sensor for Vallox post heater
When and whether the post heater activates is an important piece of information when attempting to configure an optimal heating strategy.
Leave room for adding other binary sensors without needing to write more code, there are a lot of things the Vallox devices report as binary values.
Type of change
Additional information
Checklist
black --fast 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
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: