Skip to content
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 kV and MV unit conversion for voltages #36878

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/_integrations/number.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The following device classes are supported for numbers:
- **sulphur_dioxide**: Concentration of sulphur dioxide in µg/m³
- **temperature**: Temperature in °C, °F or K
- **volatile_organic_compounds**: Concentration of volatile organic compounds in µg/m³
- **voltage**: Voltage in V, mV, µV
- **voltage**: Voltage in V, mV, µV, kV, MV
- **volume**: Generic volume in L, mL, gal, fl. oz., m³, ft³, or CCF
- **volume_flow_rate**: Volume flow rate in m³/h, ft³/min, L/min, gal/min, or mL/s
- **volume_storage**: Generic stored volume in L, mL, gal, fl. oz., m³, ft³, or CCF
Expand Down
2 changes: 1 addition & 1 deletion source/_integrations/sensor.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The following device classes are supported for sensors:
- **timestamp**: Datetime object or timestamp string (ISO 8601)
- **volatile_organic_compounds**: Concentration of volatile organic compounds in µg/m³
- **volatile_organic_compounds_parts**: Ratio of volatile organic compounds in ppm or ppb
- **voltage**: Voltage in V, mV, µV
- **voltage**: Voltage in V, mV, µV, kV, MV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Documentation includes unsupported voltage units

The documentation adds kV (kilovolt) and MV (megavolt) units, but these units are not currently implemented in Home Assistant core. The documentation should only list the currently supported units:

  • V (volt)
  • mV (millivolt)
  • µV (microvolt)
🔗 Analysis chain

LGTM! The voltage units are correctly documented.

The addition of kV and MV units is properly formatted and follows the ascending order of magnitude (µV, mV, V, kV, MV).

Let's verify that this documentation change matches the implementation in the parent PR:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the voltage units implementation in the core repository
# Note: This assumes the parent PR #135396 has been merged

# Clone the core repository and check the voltage device class implementation
git clone https://github.com/home-assistant/core.git
cd core
rg -A 5 "DEVICE_CLASS_VOLTAGE" homeassistant/const.py

Length of output: 1966


Script:

#!/bin/bash
# Search for voltage-related implementations with different patterns
cd core
# Search for voltage class and units
rg -i "voltage" homeassistant/const.py
# Search for unit conversion implementations
rg -i "UnitOfElectricPotential" homeassistant/

Length of output: 38538

- **volume**: Generic volume in L, mL, gal, fl. oz., m³, ft³, or CCF
- **volume_flow_rate**: Volume flow rate in m³/h, ft³/min, L/min, gal/min, or mL/s
- **volume_storage**: Generic stored volume in L, mL, gal, fl. oz., m³, ft³, or CCF
Expand Down
Loading