-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Add support for inH2O
pressure unit
#148289
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
base: dev
Are you sure you want to change the base?
Conversation
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 👍 |
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.
Pull Request Overview
This PR introduces support for the HVAC standard unit inH2O for static pressure, updating conversion mappings and adding corresponding tests.
- Added
INH2O
toUnitOfPressure
enum and to conversion factors inunit_conversion.py
- Extended
tests/util/test_unit_conversion.py
with round-trip cases forINH2O
- Removed two
.vscode
configuration files
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
homeassistant/const.py | Added UnitOfPressure.INH2O entry |
homeassistant/util/unit_conversion.py | Added conversion factor and supported unit set |
tests/util/test_unit_conversion.py | Added tests covering conversions from/to INH2O |
.vscode/settings.default.json (deleted) | Removed VS Code settings (unrelated to feature) |
.vscode/launch.json (deleted) | Removed VS Code launch configs (unrelated to feature) |
Comments suppressed due to low confidence (3)
homeassistant/util/unit_conversion.py:419
- Consider adding a unit conversion test from
UnitOfPressure.PA
toINH2O
to ensure the mapping works in both directions.
UnitOfPressure.INH2O: 1 / 249.0889083333348,
inH2O
pressure unit
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.
1 - there is no reason to delete the vscode files - please revert that change
2 - please expand the PR description to indicate why you feel the new unit is needed, and which integrations would make use of it
3 - what does 249.0889083333348
correspond to as a number? could it be a named constant so we know what it is?
4 - please ensure that docstrings are adjusted in sensor
and number
platforms for pressure device class
5 - please ensure that developer docs are updated for pressure device class in sensor
and number
platforms
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 is a merge conflict.
number and sensor components. Add constant for inH2O to Pascal conversion factor in unit_conversion.py.
Thanks for the review. 1 - Done - sorry missed this. |
Is there an architectural proposal for this? |
This PR adds a new unit of measurement (inH₂O) to the core unit registry. It doesn’t modify any existing units or conversions and has zero impact on current integrations. While it does touch a shared core component, the change is purely additive and enables future integrations (particularly in HVAC and industrial contexts) to report pressure using a more appropriate and widely used unit without resorting to workarounds. Since there’s no change in behavior and no potential for breakage, I don’t believe this warrants a full architectural proposal. That said, I’m happy to open one if you think it's necessary. |
Proposed change
This change adds the HVAC industry standard unit of measurement for static pressure, inH2O (inches of water) which has a direct conversion to Pascals.
Modern HVAC systems can report system static pressure. They report it in inH2O - for example the Carrier Infinity system uses this unit for its static pressure sensor. This type of sensor can be used to monitor overall system health, detect anomalies, or track how restrictive an air filter becomes over time.
I propose adding "inH2O" as a new PRESSURE measurement unit.
I propose adding support for conversion to/from Pascals as other pressure units do and also to ensure users who may be tracking such sensors in non HVAC-standard units (such as PSI) can switch units and retain their history if desired.
I propose adding appropriate conversion tests to the
test_unit_conversion.py
tests.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: