-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Added inH2O unit of measure for sensor and number classes. #2723
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: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe documentation for both number and sensor atmospheric pressure device classes was updated to include "inH2O" (inches of water) as a supported unit of measurement. No other documentation or functional changes were made. Changes
Sequence Diagram(s)No sequence diagram is generated as the changes are limited to documentation updates. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
docs/core/entity/number.md (1)
37-37
: (Nit) Consider keeping the list alphabetically sorted.Neighbouring entries are already slightly out-of-order (
cbar, bar …
), but insertinginH2O
afterinHg
keeps the divergence growing.
Not critical, yet re-ordering once avoids future churn.docs/core/entity/sensor.md (1)
38-38
: (Nit) Optional alphabetical tidy-up of the unit list.
inH2O
could slot right afterinHg
only because the list was already out of order; consider a one-time alphabetical pass across all pressure unit lists to keep maintenance easy.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
docs/core/entity/number.md
(1 hunks)docs/core/entity/sensor.md
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Redirect rules - developers-home-assistant
- GitHub Check: Header rules - developers-home-assistant
- GitHub Check: Pages changed - developers-home-assistant
🔇 Additional comments (1)
docs/core/entity/sensor.md (1)
38-38
: Mirror core support & translations forinH2O
.Same implementation check as for the number entity docs: ensure the core PR actually registers
inH2O
in the sensor conversion tables and i18n files so users don’t hit “invalid unit” warnings.
@@ -34,7 +34,7 @@ If specifying a device class, your number entity will need to also return the co | |||
| `NumberDeviceClass.APPARENT_POWER` | VA | Apparent power | |||
| `NumberDeviceClass.AQI` | None | Air Quality Index | |||
| `NumberDeviceClass.AREA` | m², cm², km², mm², in², ft², yd², mi², ac, ha | Area | |||
| `NumberDeviceClass.ATMOSPHERIC_PRESSURE` | cbar, bar, hPa, mmHG, inHg, kPa, mbar, Pa, psi | Atmospheric pressure | |||
| `NumberDeviceClass.ATMOSPHERIC_PRESSURE` | cbar, bar, hPa, mmHG, inHg, inH2O, kPa, mbar, Pa, psi | Atmospheric pressure |
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.
💡 Verification agent
❓ Verification inconclusive
Confirm implementation and unit-conversion support for inH2O
.
Nice addition; just double-check that:
UnitOfPressure.INH2O
(or equivalent) is now present inhomeassistant.const
and the unit-conversion helpers (voluptuous
,UNIT_CONVERSIONS
, etc.).- Any translation keys (
unit_of_measurement.inH2O
) have been added.
Quick grep to verify:
🏁 Script executed:
#!/bin/bash
# Verify core now recognises the new unit
rg -n "\"inH2O\"" homeassistant | head
Length of output: 92
🏁 Script executed:
#!/bin/bash
set -e
# 1. Search for literal "inH2O" across the repo
rg -n '"inH2O"' --color=never
# 2. Search for enum member INH2O in UnitOfPressure definitions
rg -n 'INH2O' --color=never
# 3. Locate the UnitOfPressure enum definition to confirm addition
rg -n 'class UnitOfPressure' -A 5 --color=never
# 4. Search the core unit conversion table for any references to inH2O or INH2O
rg -n 'UNIT_CONVERSIONS' -A 10 --color=never
Length of output: 40
🏁 Script executed:
#!/bin/bash
# 1. Search for literal "inH2O" across the repo
rg -n '"inH2O"' --color=never || true
# 2. Search for enum member INH2O in UnitOfPressure definitions
rg -n 'INH2O' --color=never || true
# 3. Locate the UnitOfPressure enum/class definition to confirm addition
rg -n 'class UnitOfPressure' -A 5 --color=never || true
# 4. Search the core unit conversion table for any references to inH2O or INH2O
rg -n 'UNIT_CONVERSIONS' -A 10 --color=never || true
Length of output: 182
Implement missing support for inH2O
Our search didn’t find any references to "inH2O"
or INH2O
in the codebase. Please add the following:
• Add INH2O
to the UnitOfPressure
enum (e.g. in homeassistant/const.py
).
• Insert the conversion factor for inH₂O into the UNIT_CONVERSIONS
mapping.
• Include a translation entry for unit_of_measurement.inH2O
.
After adding these, re-run your grep to confirm everything is picked up.
🤖 Prompt for AI Agents
In docs/core/entity/number.md at line 37, the documentation lists "inH2O" as a
supported unit but the codebase lacks support for it. To fix this, add INH2O to
the UnitOfPressure enum in homeassistant/const.py, include the appropriate
conversion factor for inH2O in the UNIT_CONVERSIONS mapping, and add a
translation entry for unit_of_measurement.inH2O. After these additions, verify
with a grep search that "inH2O" is referenced correctly throughout the codebase.
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 changes are in the referenced PR: home-assistant/core#148289
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.
🧩 Analysis chain
@ekobres Thank you for the clarification! You're absolutely right - this is the documentation repository, so the core implementation details would naturally be in the separate core PR.
Perfect! This documentation update is appropriate as it corresponds to the core implementation being added in the referenced PR. The verification agent was correctly thorough but was searching in the documentation repository rather than the core repository where the actual UnitOfPressure
enum and conversion factors would be implemented.
The documentation change looks good and properly documents the new inH2O
unit support for the ATMOSPHERIC_PRESSURE
device class.
ᕱ⁅ᕱ
🏁 Script executed:
#!/bin/bash
# Verify the referenced core PR exists and check if it contains inH2O implementation
gh pr view 148289 --repo home-assistant/core --json title,body,state,url
Length of output: 5877
Perfect! I can confirm that core PR #148289 exists and contains exactly what you described:
- Title: "Add support for
inH2O
pressure unit" - Status: Open
- Description: Adds inH2O as a new pressure measurement unit with conversion to/from Pascals, specifically for HVAC systems reporting static pressure
- Includes: Unit conversion tests and proper integration
- References: This documentation PR (Added inH2O unit of measure for sensor and number classes. #2723) in the body
The verification confirms that your documentation update is perfectly aligned with the core implementation. The CodeRabbit verification agent was being appropriately thorough but was searching in the documentation repository when the actual implementation naturally lives in the core repository.
Your documentation change correctly documents the new inH2O
unit support for the ATMOSPHERIC_PRESSURE
device class, matching the implementation being added in the core PR. Everything looks good!
ᕱ ᕱ
Proposed change
Add support for inches of water (
inH2O
) to the atmospheric pressure device class insensor
andnumber
.This is a standard unit of measure for static pressure in HVAC systems. There are more complex HVAC integrations under development that report this sensor value and need and industry-standard UOM that will be understood by people knowledgable in the field.
Type of change
Checklist
Additional information
inH2O
pressure unit core#148289Summary by CodeRabbit