Skip to content

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

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

Conversation

ekobres
Copy link

@ekobres ekobres commented Jul 6, 2025

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

  • 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:

@Copilot Copilot AI review requested due to automatic review settings July 6, 2025 19:16
@ekobres ekobres requested a review from a team as a code owner July 6, 2025 19:16
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 @ekobres

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 home-assistant bot added cla-needed core new-feature small-pr PRs with less than 30 lines. labels Jul 6, 2025
@home-assistant
Copy link

home-assistant bot commented Jul 6, 2025

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 home-assistant bot marked this pull request as draft July 6, 2025 19:16
Copy link
Contributor

@Copilot Copilot AI left a 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 to UnitOfPressure enum and to conversion factors in unit_conversion.py
  • Extended tests/util/test_unit_conversion.py with round-trip cases for INH2O
  • 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 to INH2O to ensure the mapping works in both directions.
        UnitOfPressure.INH2O: 1 / 249.0889083333348,

@ekobres ekobres marked this pull request as ready for review July 6, 2025 19:38
@home-assistant home-assistant bot dismissed their stale review July 6, 2025 19:38

Stale

@MartinHjelmare MartinHjelmare changed the title Add inH2O pressure unit support and tests for HVAC static pressure sensors. Add inH2O pressure unit support and tests for HVAC static pressure sensors Jul 6, 2025
@epenet epenet changed the title Add inH2O pressure unit support and tests for HVAC static pressure sensors Add support for inH2O pressure unit Jul 7, 2025
Copy link
Contributor

@epenet epenet left a 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

@home-assistant home-assistant bot marked this pull request as draft July 7, 2025 09:02
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.

There is a merge conflict.

number and sensor components. Add constant for
inH2O to Pascal conversion factor in
unit_conversion.py.
@ekobres
Copy link
Author

ekobres commented Jul 13, 2025

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

Thanks for the review.

1 - Done - sorry missed this.
2 - Done - somehow I had written the whole thing in a comment block.
3 - Done - The magic number here is the SI (Pascals) conversion factor. (How many inH2O are in one PA - which the unit conversion utility uses to convert all pressure units of measure.) It serves the same purpose for inH2O as this line serves for PSI. Given the existing PSI conversion factor uses this format, I took the path to use the equivalent approach of those who have gone before. I have made the change and added _INH2O_TO_PA as a constant.
4 - Done
5 - Done

@ekobres ekobres requested a review from epenet July 13, 2025 00:13
@joostlek
Copy link
Member

Is there an architectural proposal for this?

@ekobres
Copy link
Author

ekobres commented Jul 14, 2025

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.

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.

sensor integration - device class ('pressure') needs new unit ('inH2O') added
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy