mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Deprecate deprecated unit of measurement constants (#106455)
This commit is contained in:
parent
f92e732f27
commit
fbcb31b103
@ -621,7 +621,10 @@ class UnitOfApparentPower(StrEnum):
|
|||||||
VOLT_AMPERE = "VA"
|
VOLT_AMPERE = "VA"
|
||||||
|
|
||||||
|
|
||||||
POWER_VOLT_AMPERE: Final = "VA"
|
_DEPRECATED_POWER_VOLT_AMPERE: Final = (
|
||||||
|
UnitOfApparentPower.VOLT_AMPERE,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfApparentPower.VOLT_AMPERE."""
|
"""Deprecated: please use UnitOfApparentPower.VOLT_AMPERE."""
|
||||||
|
|
||||||
|
|
||||||
@ -634,11 +637,20 @@ class UnitOfPower(StrEnum):
|
|||||||
BTU_PER_HOUR = "BTU/h"
|
BTU_PER_HOUR = "BTU/h"
|
||||||
|
|
||||||
|
|
||||||
POWER_WATT: Final = "W"
|
_DEPRECATED_POWER_WATT: Final = (
|
||||||
|
UnitOfPower.WATT,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPower.WATT."""
|
"""Deprecated: please use UnitOfPower.WATT."""
|
||||||
POWER_KILO_WATT: Final = "kW"
|
_DEPRECATED_POWER_KILO_WATT: Final = (
|
||||||
|
UnitOfPower.KILO_WATT,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPower.KILO_WATT."""
|
"""Deprecated: please use UnitOfPower.KILO_WATT."""
|
||||||
POWER_BTU_PER_HOUR: Final = "BTU/h"
|
_DEPRECATED_POWER_BTU_PER_HOUR: Final = (
|
||||||
|
UnitOfPower.BTU_PER_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPower.BTU_PER_HOUR."""
|
"""Deprecated: please use UnitOfPower.BTU_PER_HOUR."""
|
||||||
|
|
||||||
# Reactive power units
|
# Reactive power units
|
||||||
@ -656,11 +668,20 @@ class UnitOfEnergy(StrEnum):
|
|||||||
WATT_HOUR = "Wh"
|
WATT_HOUR = "Wh"
|
||||||
|
|
||||||
|
|
||||||
ENERGY_KILO_WATT_HOUR: Final = "kWh"
|
_DEPRECATED_ENERGY_KILO_WATT_HOUR: Final = (
|
||||||
|
UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfEnergy.KILO_WATT_HOUR."""
|
"""Deprecated: please use UnitOfEnergy.KILO_WATT_HOUR."""
|
||||||
ENERGY_MEGA_WATT_HOUR: Final = "MWh"
|
_DEPRECATED_ENERGY_MEGA_WATT_HOUR: Final = (
|
||||||
|
UnitOfEnergy.MEGA_WATT_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfEnergy.MEGA_WATT_HOUR."""
|
"""Deprecated: please use UnitOfEnergy.MEGA_WATT_HOUR."""
|
||||||
ENERGY_WATT_HOUR: Final = "Wh"
|
_DEPRECATED_ENERGY_WATT_HOUR: Final = (
|
||||||
|
UnitOfEnergy.WATT_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfEnergy.WATT_HOUR."""
|
"""Deprecated: please use UnitOfEnergy.WATT_HOUR."""
|
||||||
|
|
||||||
|
|
||||||
@ -672,9 +693,15 @@ class UnitOfElectricCurrent(StrEnum):
|
|||||||
AMPERE = "A"
|
AMPERE = "A"
|
||||||
|
|
||||||
|
|
||||||
ELECTRIC_CURRENT_MILLIAMPERE: Final = "mA"
|
_DEPRECATED_ELECTRIC_CURRENT_MILLIAMPERE: Final = (
|
||||||
|
UnitOfElectricCurrent.MILLIAMPERE,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfElectricCurrent.MILLIAMPERE."""
|
"""Deprecated: please use UnitOfElectricCurrent.MILLIAMPERE."""
|
||||||
ELECTRIC_CURRENT_AMPERE: Final = "A"
|
_DEPRECATED_ELECTRIC_CURRENT_AMPERE: Final = (
|
||||||
|
UnitOfElectricCurrent.AMPERE,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfElectricCurrent.AMPERE."""
|
"""Deprecated: please use UnitOfElectricCurrent.AMPERE."""
|
||||||
|
|
||||||
|
|
||||||
@ -686,9 +713,15 @@ class UnitOfElectricPotential(StrEnum):
|
|||||||
VOLT = "V"
|
VOLT = "V"
|
||||||
|
|
||||||
|
|
||||||
ELECTRIC_POTENTIAL_MILLIVOLT: Final = "mV"
|
_DEPRECATED_ELECTRIC_POTENTIAL_MILLIVOLT: Final = (
|
||||||
|
UnitOfElectricPotential.MILLIVOLT,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfElectricPotential.MILLIVOLT."""
|
"""Deprecated: please use UnitOfElectricPotential.MILLIVOLT."""
|
||||||
ELECTRIC_POTENTIAL_VOLT: Final = "V"
|
_DEPRECATED_ELECTRIC_POTENTIAL_VOLT: Final = (
|
||||||
|
UnitOfElectricPotential.VOLT,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfElectricPotential.VOLT."""
|
"""Deprecated: please use UnitOfElectricPotential.VOLT."""
|
||||||
|
|
||||||
# Degree units
|
# Degree units
|
||||||
@ -709,11 +742,20 @@ class UnitOfTemperature(StrEnum):
|
|||||||
KELVIN = "K"
|
KELVIN = "K"
|
||||||
|
|
||||||
|
|
||||||
TEMP_CELSIUS: Final = "°C"
|
_DEPRECATED_TEMP_CELSIUS: Final = (
|
||||||
|
UnitOfTemperature.CELSIUS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTemperature.CELSIUS"""
|
"""Deprecated: please use UnitOfTemperature.CELSIUS"""
|
||||||
TEMP_FAHRENHEIT: Final = "°F"
|
_DEPRECATED_TEMP_FAHRENHEIT: Final = (
|
||||||
|
UnitOfTemperature.FAHRENHEIT,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTemperature.FAHRENHEIT"""
|
"""Deprecated: please use UnitOfTemperature.FAHRENHEIT"""
|
||||||
TEMP_KELVIN: Final = "K"
|
_DEPRECATED_TEMP_KELVIN: Final = (
|
||||||
|
UnitOfTemperature.KELVIN,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTemperature.KELVIN"""
|
"""Deprecated: please use UnitOfTemperature.KELVIN"""
|
||||||
|
|
||||||
|
|
||||||
@ -732,23 +774,50 @@ class UnitOfTime(StrEnum):
|
|||||||
YEARS = "y"
|
YEARS = "y"
|
||||||
|
|
||||||
|
|
||||||
TIME_MICROSECONDS: Final = "μs"
|
_DEPRECATED_TIME_MICROSECONDS: Final = (
|
||||||
|
UnitOfTime.MICROSECONDS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.MICROSECONDS."""
|
"""Deprecated: please use UnitOfTime.MICROSECONDS."""
|
||||||
TIME_MILLISECONDS: Final = "ms"
|
_DEPRECATED_TIME_MILLISECONDS: Final = (
|
||||||
|
UnitOfTime.MILLISECONDS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.MILLISECONDS."""
|
"""Deprecated: please use UnitOfTime.MILLISECONDS."""
|
||||||
TIME_SECONDS: Final = "s"
|
_DEPRECATED_TIME_SECONDS: Final = (
|
||||||
|
UnitOfTime.SECONDS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.SECONDS."""
|
"""Deprecated: please use UnitOfTime.SECONDS."""
|
||||||
TIME_MINUTES: Final = "min"
|
_DEPRECATED_TIME_MINUTES: Final = (
|
||||||
|
UnitOfTime.MINUTES,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.MINUTES."""
|
"""Deprecated: please use UnitOfTime.MINUTES."""
|
||||||
TIME_HOURS: Final = "h"
|
_DEPRECATED_TIME_HOURS: Final = (
|
||||||
|
UnitOfTime.HOURS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.HOURS."""
|
"""Deprecated: please use UnitOfTime.HOURS."""
|
||||||
TIME_DAYS: Final = "d"
|
_DEPRECATED_TIME_DAYS: Final = (
|
||||||
|
UnitOfTime.DAYS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.DAYS."""
|
"""Deprecated: please use UnitOfTime.DAYS."""
|
||||||
TIME_WEEKS: Final = "w"
|
_DEPRECATED_TIME_WEEKS: Final = (
|
||||||
|
UnitOfTime.WEEKS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.WEEKS."""
|
"""Deprecated: please use UnitOfTime.WEEKS."""
|
||||||
TIME_MONTHS: Final = "m"
|
_DEPRECATED_TIME_MONTHS: Final = (
|
||||||
|
UnitOfTime.MONTHS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.MONTHS."""
|
"""Deprecated: please use UnitOfTime.MONTHS."""
|
||||||
TIME_YEARS: Final = "y"
|
_DEPRECATED_TIME_YEARS: Final = (
|
||||||
|
UnitOfTime.YEARS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfTime.YEARS."""
|
"""Deprecated: please use UnitOfTime.YEARS."""
|
||||||
|
|
||||||
|
|
||||||
@ -766,21 +835,45 @@ class UnitOfLength(StrEnum):
|
|||||||
MILES = "mi"
|
MILES = "mi"
|
||||||
|
|
||||||
|
|
||||||
LENGTH_MILLIMETERS: Final = "mm"
|
_DEPRECATED_LENGTH_MILLIMETERS: Final = (
|
||||||
|
UnitOfLength.MILLIMETERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.MILLIMETERS."""
|
"""Deprecated: please use UnitOfLength.MILLIMETERS."""
|
||||||
LENGTH_CENTIMETERS: Final = "cm"
|
_DEPRECATED_LENGTH_CENTIMETERS: Final = (
|
||||||
|
UnitOfLength.CENTIMETERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.CENTIMETERS."""
|
"""Deprecated: please use UnitOfLength.CENTIMETERS."""
|
||||||
LENGTH_METERS: Final = "m"
|
_DEPRECATED_LENGTH_METERS: Final = (
|
||||||
|
UnitOfLength.METERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.METERS."""
|
"""Deprecated: please use UnitOfLength.METERS."""
|
||||||
LENGTH_KILOMETERS: Final = "km"
|
_DEPRECATED_LENGTH_KILOMETERS: Final = (
|
||||||
|
UnitOfLength.KILOMETERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.KILOMETERS."""
|
"""Deprecated: please use UnitOfLength.KILOMETERS."""
|
||||||
LENGTH_INCHES: Final = "in"
|
_DEPRECATED_LENGTH_INCHES: Final = (
|
||||||
|
UnitOfLength.INCHES,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.INCHES."""
|
"""Deprecated: please use UnitOfLength.INCHES."""
|
||||||
LENGTH_FEET: Final = "ft"
|
_DEPRECATED_LENGTH_FEET: Final = (
|
||||||
|
UnitOfLength.FEET,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.FEET."""
|
"""Deprecated: please use UnitOfLength.FEET."""
|
||||||
LENGTH_YARD: Final = "yd"
|
_DEPRECATED_LENGTH_YARD: Final = (
|
||||||
|
UnitOfLength.YARDS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.YARDS."""
|
"""Deprecated: please use UnitOfLength.YARDS."""
|
||||||
LENGTH_MILES: Final = "mi"
|
_DEPRECATED_LENGTH_MILES: Final = (
|
||||||
|
UnitOfLength.MILES,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfLength.MILES."""
|
"""Deprecated: please use UnitOfLength.MILES."""
|
||||||
|
|
||||||
|
|
||||||
@ -794,13 +887,25 @@ class UnitOfFrequency(StrEnum):
|
|||||||
GIGAHERTZ = "GHz"
|
GIGAHERTZ = "GHz"
|
||||||
|
|
||||||
|
|
||||||
FREQUENCY_HERTZ: Final = "Hz"
|
_DEPRECATED_FREQUENCY_HERTZ: Final = (
|
||||||
|
UnitOfFrequency.HERTZ,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfFrequency.HERTZ"""
|
"""Deprecated: please use UnitOfFrequency.HERTZ"""
|
||||||
FREQUENCY_KILOHERTZ: Final = "kHz"
|
_DEPRECATED_FREQUENCY_KILOHERTZ: Final = (
|
||||||
|
UnitOfFrequency.KILOHERTZ,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfFrequency.KILOHERTZ"""
|
"""Deprecated: please use UnitOfFrequency.KILOHERTZ"""
|
||||||
FREQUENCY_MEGAHERTZ: Final = "MHz"
|
_DEPRECATED_FREQUENCY_MEGAHERTZ: Final = (
|
||||||
|
UnitOfFrequency.MEGAHERTZ,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfFrequency.MEGAHERTZ"""
|
"""Deprecated: please use UnitOfFrequency.MEGAHERTZ"""
|
||||||
FREQUENCY_GIGAHERTZ: Final = "GHz"
|
_DEPRECATED_FREQUENCY_GIGAHERTZ: Final = (
|
||||||
|
UnitOfFrequency.GIGAHERTZ,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfFrequency.GIGAHERTZ"""
|
"""Deprecated: please use UnitOfFrequency.GIGAHERTZ"""
|
||||||
|
|
||||||
|
|
||||||
@ -819,23 +924,50 @@ class UnitOfPressure(StrEnum):
|
|||||||
PSI = "psi"
|
PSI = "psi"
|
||||||
|
|
||||||
|
|
||||||
PRESSURE_PA: Final = "Pa"
|
_DEPRECATED_PRESSURE_PA: Final = (
|
||||||
|
UnitOfPressure.PA,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.PA"""
|
"""Deprecated: please use UnitOfPressure.PA"""
|
||||||
PRESSURE_HPA: Final = "hPa"
|
_DEPRECATED_PRESSURE_HPA: Final = (
|
||||||
|
UnitOfPressure.HPA,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.HPA"""
|
"""Deprecated: please use UnitOfPressure.HPA"""
|
||||||
PRESSURE_KPA: Final = "kPa"
|
_DEPRECATED_PRESSURE_KPA: Final = (
|
||||||
|
UnitOfPressure.KPA,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.KPA"""
|
"""Deprecated: please use UnitOfPressure.KPA"""
|
||||||
PRESSURE_BAR: Final = "bar"
|
_DEPRECATED_PRESSURE_BAR: Final = (
|
||||||
|
UnitOfPressure.BAR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.BAR"""
|
"""Deprecated: please use UnitOfPressure.BAR"""
|
||||||
PRESSURE_CBAR: Final = "cbar"
|
_DEPRECATED_PRESSURE_CBAR: Final = (
|
||||||
|
UnitOfPressure.CBAR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.CBAR"""
|
"""Deprecated: please use UnitOfPressure.CBAR"""
|
||||||
PRESSURE_MBAR: Final = "mbar"
|
_DEPRECATED_PRESSURE_MBAR: Final = (
|
||||||
|
UnitOfPressure.MBAR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.MBAR"""
|
"""Deprecated: please use UnitOfPressure.MBAR"""
|
||||||
PRESSURE_MMHG: Final = "mmHg"
|
_DEPRECATED_PRESSURE_MMHG: Final = (
|
||||||
|
UnitOfPressure.MMHG,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.MMHG"""
|
"""Deprecated: please use UnitOfPressure.MMHG"""
|
||||||
PRESSURE_INHG: Final = "inHg"
|
_DEPRECATED_PRESSURE_INHG: Final = (
|
||||||
|
UnitOfPressure.INHG,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.INHG"""
|
"""Deprecated: please use UnitOfPressure.INHG"""
|
||||||
PRESSURE_PSI: Final = "psi"
|
_DEPRECATED_PRESSURE_PSI: Final = (
|
||||||
|
UnitOfPressure.PSI,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPressure.PSI"""
|
"""Deprecated: please use UnitOfPressure.PSI"""
|
||||||
|
|
||||||
|
|
||||||
@ -847,9 +979,15 @@ class UnitOfSoundPressure(StrEnum):
|
|||||||
WEIGHTED_DECIBEL_A = "dBA"
|
WEIGHTED_DECIBEL_A = "dBA"
|
||||||
|
|
||||||
|
|
||||||
SOUND_PRESSURE_DB: Final = "dB"
|
_DEPRECATED_SOUND_PRESSURE_DB: Final = (
|
||||||
|
UnitOfSoundPressure.DECIBEL,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfSoundPressure.DECIBEL"""
|
"""Deprecated: please use UnitOfSoundPressure.DECIBEL"""
|
||||||
SOUND_PRESSURE_WEIGHTED_DBA: Final = "dBa"
|
_DEPRECATED_SOUND_PRESSURE_WEIGHTED_DBA: Final = (
|
||||||
|
UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfSoundPressure.WEIGHTED_DECIBEL_A"""
|
"""Deprecated: please use UnitOfSoundPressure.WEIGHTED_DECIBEL_A"""
|
||||||
|
|
||||||
|
|
||||||
@ -872,18 +1010,36 @@ class UnitOfVolume(StrEnum):
|
|||||||
British/Imperial fluid ounces are not yet supported"""
|
British/Imperial fluid ounces are not yet supported"""
|
||||||
|
|
||||||
|
|
||||||
VOLUME_LITERS: Final = "L"
|
_DEPRECATED_VOLUME_LITERS: Final = (
|
||||||
|
UnitOfVolume.LITERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolume.LITERS"""
|
"""Deprecated: please use UnitOfVolume.LITERS"""
|
||||||
VOLUME_MILLILITERS: Final = "mL"
|
_DEPRECATED_VOLUME_MILLILITERS: Final = (
|
||||||
|
UnitOfVolume.MILLILITERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolume.MILLILITERS"""
|
"""Deprecated: please use UnitOfVolume.MILLILITERS"""
|
||||||
VOLUME_CUBIC_METERS: Final = "m³"
|
_DEPRECATED_VOLUME_CUBIC_METERS: Final = (
|
||||||
|
UnitOfVolume.CUBIC_METERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolume.CUBIC_METERS"""
|
"""Deprecated: please use UnitOfVolume.CUBIC_METERS"""
|
||||||
VOLUME_CUBIC_FEET: Final = "ft³"
|
_DEPRECATED_VOLUME_CUBIC_FEET: Final = (
|
||||||
|
UnitOfVolume.CUBIC_FEET,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolume.CUBIC_FEET"""
|
"""Deprecated: please use UnitOfVolume.CUBIC_FEET"""
|
||||||
|
|
||||||
VOLUME_GALLONS: Final = "gal"
|
_DEPRECATED_VOLUME_GALLONS: Final = (
|
||||||
|
UnitOfVolume.GALLONS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolume.GALLONS"""
|
"""Deprecated: please use UnitOfVolume.GALLONS"""
|
||||||
VOLUME_FLUID_OUNCE: Final = "fl. oz."
|
_DEPRECATED_VOLUME_FLUID_OUNCE: Final = (
|
||||||
|
UnitOfVolume.FLUID_OUNCES,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolume.FLUID_OUNCES"""
|
"""Deprecated: please use UnitOfVolume.FLUID_OUNCES"""
|
||||||
|
|
||||||
|
|
||||||
@ -895,9 +1051,15 @@ class UnitOfVolumeFlowRate(StrEnum):
|
|||||||
CUBIC_FEET_PER_MINUTE = "ft³/m"
|
CUBIC_FEET_PER_MINUTE = "ft³/m"
|
||||||
|
|
||||||
|
|
||||||
VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR: Final = "m³/h"
|
_DEPRECATED_VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR: Final = (
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR"""
|
"""Deprecated: please use UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR"""
|
||||||
VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE: Final = "ft³/m"
|
_DEPRECATED_VOLUME_FLOW_RATE_CUBIC_FEET_PER_MINUTE: Final = (
|
||||||
|
UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE"""
|
"""Deprecated: please use UnitOfVolumeFlowRate.CUBIC_FEET_PER_MINUTE"""
|
||||||
|
|
||||||
# Area units
|
# Area units
|
||||||
@ -917,17 +1079,35 @@ class UnitOfMass(StrEnum):
|
|||||||
STONES = "st"
|
STONES = "st"
|
||||||
|
|
||||||
|
|
||||||
MASS_GRAMS: Final = "g"
|
_DEPRECATED_MASS_GRAMS: Final = (
|
||||||
|
UnitOfMass.GRAMS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfMass.GRAMS"""
|
"""Deprecated: please use UnitOfMass.GRAMS"""
|
||||||
MASS_KILOGRAMS: Final = "kg"
|
_DEPRECATED_MASS_KILOGRAMS: Final = (
|
||||||
|
UnitOfMass.KILOGRAMS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfMass.KILOGRAMS"""
|
"""Deprecated: please use UnitOfMass.KILOGRAMS"""
|
||||||
MASS_MILLIGRAMS: Final = "mg"
|
_DEPRECATED_MASS_MILLIGRAMS: Final = (
|
||||||
|
UnitOfMass.MILLIGRAMS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfMass.MILLIGRAMS"""
|
"""Deprecated: please use UnitOfMass.MILLIGRAMS"""
|
||||||
MASS_MICROGRAMS: Final = "µg"
|
_DEPRECATED_MASS_MICROGRAMS: Final = (
|
||||||
|
UnitOfMass.MICROGRAMS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfMass.MICROGRAMS"""
|
"""Deprecated: please use UnitOfMass.MICROGRAMS"""
|
||||||
MASS_OUNCES: Final = "oz"
|
_DEPRECATED_MASS_OUNCES: Final = (
|
||||||
|
UnitOfMass.OUNCES,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfMass.OUNCES"""
|
"""Deprecated: please use UnitOfMass.OUNCES"""
|
||||||
MASS_POUNDS: Final = "lb"
|
_DEPRECATED_MASS_POUNDS: Final = (
|
||||||
|
UnitOfMass.POUNDS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfMass.POUNDS"""
|
"""Deprecated: please use UnitOfMass.POUNDS"""
|
||||||
|
|
||||||
# Conductivity units
|
# Conductivity units
|
||||||
@ -955,9 +1135,15 @@ class UnitOfIrradiance(StrEnum):
|
|||||||
|
|
||||||
|
|
||||||
# Irradiation units
|
# Irradiation units
|
||||||
IRRADIATION_WATTS_PER_SQUARE_METER: Final = "W/m²"
|
_DEPRECATED_IRRADIATION_WATTS_PER_SQUARE_METER: Final = (
|
||||||
|
UnitOfIrradiance.WATTS_PER_SQUARE_METER,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfIrradiance.WATTS_PER_SQUARE_METER"""
|
"""Deprecated: please use UnitOfIrradiance.WATTS_PER_SQUARE_METER"""
|
||||||
IRRADIATION_BTUS_PER_HOUR_SQUARE_FOOT: Final = "BTU/(h×ft²)"
|
_DEPRECATED_IRRADIATION_BTUS_PER_HOUR_SQUARE_FOOT: Final = (
|
||||||
|
UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT"""
|
"""Deprecated: please use UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT"""
|
||||||
|
|
||||||
|
|
||||||
@ -999,13 +1185,22 @@ class UnitOfPrecipitationDepth(StrEnum):
|
|||||||
|
|
||||||
|
|
||||||
# Precipitation units
|
# Precipitation units
|
||||||
PRECIPITATION_INCHES: Final = "in"
|
_DEPRECATED_PRECIPITATION_INCHES: Final = (UnitOfPrecipitationDepth.INCHES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfPrecipitationDepth.INCHES"""
|
"""Deprecated: please use UnitOfPrecipitationDepth.INCHES"""
|
||||||
PRECIPITATION_MILLIMETERS: Final = "mm"
|
_DEPRECATED_PRECIPITATION_MILLIMETERS: Final = (
|
||||||
|
UnitOfPrecipitationDepth.MILLIMETERS,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfPrecipitationDepth.MILLIMETERS"""
|
"""Deprecated: please use UnitOfPrecipitationDepth.MILLIMETERS"""
|
||||||
PRECIPITATION_MILLIMETERS_PER_HOUR: Final = "mm/h"
|
_DEPRECATED_PRECIPITATION_MILLIMETERS_PER_HOUR: Final = (
|
||||||
|
UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR"""
|
"""Deprecated: please use UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR"""
|
||||||
PRECIPITATION_INCHES_PER_HOUR: Final = "in/h"
|
_DEPRECATED_PRECIPITATION_INCHES_PER_HOUR: Final = (
|
||||||
|
UnitOfVolumetricFlux.INCHES_PER_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolumetricFlux.INCHES_PER_HOUR"""
|
"""Deprecated: please use UnitOfVolumetricFlux.INCHES_PER_HOUR"""
|
||||||
|
|
||||||
# Concentration units
|
# Concentration units
|
||||||
@ -1028,24 +1223,36 @@ class UnitOfSpeed(StrEnum):
|
|||||||
MILES_PER_HOUR = "mph"
|
MILES_PER_HOUR = "mph"
|
||||||
|
|
||||||
|
|
||||||
SPEED_FEET_PER_SECOND: Final = "ft/s"
|
_DEPRECATED_SPEED_FEET_PER_SECOND: Final = (UnitOfSpeed.FEET_PER_SECOND, "2025.1")
|
||||||
"""Deprecated: please use UnitOfSpeed.FEET_PER_SECOND"""
|
"""Deprecated: please use UnitOfSpeed.FEET_PER_SECOND"""
|
||||||
SPEED_METERS_PER_SECOND: Final = "m/s"
|
_DEPRECATED_SPEED_METERS_PER_SECOND: Final = (UnitOfSpeed.METERS_PER_SECOND, "2025.1")
|
||||||
"""Deprecated: please use UnitOfSpeed.METERS_PER_SECOND"""
|
"""Deprecated: please use UnitOfSpeed.METERS_PER_SECOND"""
|
||||||
SPEED_KILOMETERS_PER_HOUR: Final = "km/h"
|
_DEPRECATED_SPEED_KILOMETERS_PER_HOUR: Final = (
|
||||||
|
UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfSpeed.KILOMETERS_PER_HOUR"""
|
"""Deprecated: please use UnitOfSpeed.KILOMETERS_PER_HOUR"""
|
||||||
SPEED_KNOTS: Final = "kn"
|
_DEPRECATED_SPEED_KNOTS: Final = (UnitOfSpeed.KNOTS, "2025.1")
|
||||||
"""Deprecated: please use UnitOfSpeed.KNOTS"""
|
"""Deprecated: please use UnitOfSpeed.KNOTS"""
|
||||||
SPEED_MILES_PER_HOUR: Final = "mph"
|
_DEPRECATED_SPEED_MILES_PER_HOUR: Final = (UnitOfSpeed.MILES_PER_HOUR, "2025.1")
|
||||||
"""Deprecated: please use UnitOfSpeed.MILES_PER_HOUR"""
|
"""Deprecated: please use UnitOfSpeed.MILES_PER_HOUR"""
|
||||||
|
|
||||||
SPEED_MILLIMETERS_PER_DAY: Final = "mm/d"
|
_DEPRECATED_SPEED_MILLIMETERS_PER_DAY: Final = (
|
||||||
|
UnitOfVolumetricFlux.MILLIMETERS_PER_DAY,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolumetricFlux.MILLIMETERS_PER_DAY"""
|
"""Deprecated: please use UnitOfVolumetricFlux.MILLIMETERS_PER_DAY"""
|
||||||
|
|
||||||
SPEED_INCHES_PER_DAY: Final = "in/d"
|
_DEPRECATED_SPEED_INCHES_PER_DAY: Final = (
|
||||||
|
UnitOfVolumetricFlux.INCHES_PER_DAY,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolumetricFlux.INCHES_PER_DAY"""
|
"""Deprecated: please use UnitOfVolumetricFlux.INCHES_PER_DAY"""
|
||||||
|
|
||||||
SPEED_INCHES_PER_HOUR: Final = "in/h"
|
_DEPRECATED_SPEED_INCHES_PER_HOUR: Final = (
|
||||||
|
UnitOfVolumetricFlux.INCHES_PER_HOUR,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfVolumetricFlux.INCHES_PER_HOUR"""
|
"""Deprecated: please use UnitOfVolumetricFlux.INCHES_PER_HOUR"""
|
||||||
|
|
||||||
|
|
||||||
@ -1081,47 +1288,47 @@ class UnitOfInformation(StrEnum):
|
|||||||
YOBIBYTES = "YiB"
|
YOBIBYTES = "YiB"
|
||||||
|
|
||||||
|
|
||||||
DATA_BITS: Final = "bit"
|
_DEPRECATED_DATA_BITS: Final = (UnitOfInformation.BITS, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.BITS"""
|
"""Deprecated: please use UnitOfInformation.BITS"""
|
||||||
DATA_KILOBITS: Final = "kbit"
|
_DEPRECATED_DATA_KILOBITS: Final = (UnitOfInformation.KILOBITS, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.KILOBITS"""
|
"""Deprecated: please use UnitOfInformation.KILOBITS"""
|
||||||
DATA_MEGABITS: Final = "Mbit"
|
_DEPRECATED_DATA_MEGABITS: Final = (UnitOfInformation.MEGABITS, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.MEGABITS"""
|
"""Deprecated: please use UnitOfInformation.MEGABITS"""
|
||||||
DATA_GIGABITS: Final = "Gbit"
|
_DEPRECATED_DATA_GIGABITS: Final = (UnitOfInformation.GIGABITS, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.GIGABITS"""
|
"""Deprecated: please use UnitOfInformation.GIGABITS"""
|
||||||
DATA_BYTES: Final = "B"
|
_DEPRECATED_DATA_BYTES: Final = (UnitOfInformation.BYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.BYTES"""
|
"""Deprecated: please use UnitOfInformation.BYTES"""
|
||||||
DATA_KILOBYTES: Final = "kB"
|
_DEPRECATED_DATA_KILOBYTES: Final = (UnitOfInformation.KILOBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.KILOBYTES"""
|
"""Deprecated: please use UnitOfInformation.KILOBYTES"""
|
||||||
DATA_MEGABYTES: Final = "MB"
|
_DEPRECATED_DATA_MEGABYTES: Final = (UnitOfInformation.MEGABYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.MEGABYTES"""
|
"""Deprecated: please use UnitOfInformation.MEGABYTES"""
|
||||||
DATA_GIGABYTES: Final = "GB"
|
_DEPRECATED_DATA_GIGABYTES: Final = (UnitOfInformation.GIGABYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.GIGABYTES"""
|
"""Deprecated: please use UnitOfInformation.GIGABYTES"""
|
||||||
DATA_TERABYTES: Final = "TB"
|
_DEPRECATED_DATA_TERABYTES: Final = (UnitOfInformation.TERABYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.TERABYTES"""
|
"""Deprecated: please use UnitOfInformation.TERABYTES"""
|
||||||
DATA_PETABYTES: Final = "PB"
|
_DEPRECATED_DATA_PETABYTES: Final = (UnitOfInformation.PETABYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.PETABYTES"""
|
"""Deprecated: please use UnitOfInformation.PETABYTES"""
|
||||||
DATA_EXABYTES: Final = "EB"
|
_DEPRECATED_DATA_EXABYTES: Final = (UnitOfInformation.EXABYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.EXABYTES"""
|
"""Deprecated: please use UnitOfInformation.EXABYTES"""
|
||||||
DATA_ZETTABYTES: Final = "ZB"
|
_DEPRECATED_DATA_ZETTABYTES: Final = (UnitOfInformation.ZETTABYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.ZETTABYTES"""
|
"""Deprecated: please use UnitOfInformation.ZETTABYTES"""
|
||||||
DATA_YOTTABYTES: Final = "YB"
|
_DEPRECATED_DATA_YOTTABYTES: Final = (UnitOfInformation.YOTTABYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.YOTTABYTES"""
|
"""Deprecated: please use UnitOfInformation.YOTTABYTES"""
|
||||||
DATA_KIBIBYTES: Final = "KiB"
|
_DEPRECATED_DATA_KIBIBYTES: Final = (UnitOfInformation.KIBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.KIBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.KIBIBYTES"""
|
||||||
DATA_MEBIBYTES: Final = "MiB"
|
_DEPRECATED_DATA_MEBIBYTES: Final = (UnitOfInformation.MEBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.MEBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.MEBIBYTES"""
|
||||||
DATA_GIBIBYTES: Final = "GiB"
|
_DEPRECATED_DATA_GIBIBYTES: Final = (UnitOfInformation.GIBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.GIBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.GIBIBYTES"""
|
||||||
DATA_TEBIBYTES: Final = "TiB"
|
_DEPRECATED_DATA_TEBIBYTES: Final = (UnitOfInformation.TEBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.TEBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.TEBIBYTES"""
|
||||||
DATA_PEBIBYTES: Final = "PiB"
|
_DEPRECATED_DATA_PEBIBYTES: Final = (UnitOfInformation.PEBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.PEBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.PEBIBYTES"""
|
||||||
DATA_EXBIBYTES: Final = "EiB"
|
_DEPRECATED_DATA_EXBIBYTES: Final = (UnitOfInformation.EXBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.EXBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.EXBIBYTES"""
|
||||||
DATA_ZEBIBYTES: Final = "ZiB"
|
_DEPRECATED_DATA_ZEBIBYTES: Final = (UnitOfInformation.ZEBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.ZEBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.ZEBIBYTES"""
|
||||||
DATA_YOBIBYTES: Final = "YiB"
|
_DEPRECATED_DATA_YOBIBYTES: Final = (UnitOfInformation.YOBIBYTES, "2025.1")
|
||||||
"""Deprecated: please use UnitOfInformation.YOBIBYTES"""
|
"""Deprecated: please use UnitOfInformation.YOBIBYTES"""
|
||||||
|
|
||||||
|
|
||||||
@ -1142,27 +1349,60 @@ class UnitOfDataRate(StrEnum):
|
|||||||
GIBIBYTES_PER_SECOND = "GiB/s"
|
GIBIBYTES_PER_SECOND = "GiB/s"
|
||||||
|
|
||||||
|
|
||||||
DATA_RATE_BITS_PER_SECOND: Final = "bit/s"
|
_DEPRECATED_DATA_RATE_BITS_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.BITS_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.BITS_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.BITS_PER_SECOND"""
|
||||||
DATA_RATE_KILOBITS_PER_SECOND: Final = "kbit/s"
|
_DEPRECATED_DATA_RATE_KILOBITS_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.KILOBITS_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.KILOBITS_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.KILOBITS_PER_SECOND"""
|
||||||
DATA_RATE_MEGABITS_PER_SECOND: Final = "Mbit/s"
|
_DEPRECATED_DATA_RATE_MEGABITS_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.MEGABITS_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.MEGABITS_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.MEGABITS_PER_SECOND"""
|
||||||
DATA_RATE_GIGABITS_PER_SECOND: Final = "Gbit/s"
|
_DEPRECATED_DATA_RATE_GIGABITS_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.GIGABITS_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.GIGABITS_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.GIGABITS_PER_SECOND"""
|
||||||
DATA_RATE_BYTES_PER_SECOND: Final = "B/s"
|
_DEPRECATED_DATA_RATE_BYTES_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.BYTES_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.BYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.BYTES_PER_SECOND"""
|
||||||
DATA_RATE_KILOBYTES_PER_SECOND: Final = "kB/s"
|
_DEPRECATED_DATA_RATE_KILOBYTES_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.KILOBYTES_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.KILOBYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.KILOBYTES_PER_SECOND"""
|
||||||
DATA_RATE_MEGABYTES_PER_SECOND: Final = "MB/s"
|
_DEPRECATED_DATA_RATE_MEGABYTES_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.MEGABYTES_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.MEGABYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.MEGABYTES_PER_SECOND"""
|
||||||
DATA_RATE_GIGABYTES_PER_SECOND: Final = "GB/s"
|
_DEPRECATED_DATA_RATE_GIGABYTES_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.GIGABYTES_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.GIGABYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.GIGABYTES_PER_SECOND"""
|
||||||
DATA_RATE_KIBIBYTES_PER_SECOND: Final = "KiB/s"
|
_DEPRECATED_DATA_RATE_KIBIBYTES_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.KIBIBYTES_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.KIBIBYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.KIBIBYTES_PER_SECOND"""
|
||||||
DATA_RATE_MEBIBYTES_PER_SECOND: Final = "MiB/s"
|
_DEPRECATED_DATA_RATE_MEBIBYTES_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.MEBIBYTES_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.MEBIBYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.MEBIBYTES_PER_SECOND"""
|
||||||
DATA_RATE_GIBIBYTES_PER_SECOND: Final = "GiB/s"
|
_DEPRECATED_DATA_RATE_GIBIBYTES_PER_SECOND: Final = (
|
||||||
|
UnitOfDataRate.GIBIBYTES_PER_SECOND,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
"""Deprecated: please use UnitOfDataRate.GIBIBYTES_PER_SECOND"""
|
"""Deprecated: please use UnitOfDataRate.GIBIBYTES_PER_SECOND"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,10 +67,10 @@ from .const import (
|
|||||||
EVENT_SERVICE_REGISTERED,
|
EVENT_SERVICE_REGISTERED,
|
||||||
EVENT_SERVICE_REMOVED,
|
EVENT_SERVICE_REMOVED,
|
||||||
EVENT_STATE_CHANGED,
|
EVENT_STATE_CHANGED,
|
||||||
LENGTH_METERS,
|
|
||||||
MATCH_ALL,
|
MATCH_ALL,
|
||||||
MAX_LENGTH_EVENT_EVENT_TYPE,
|
MAX_LENGTH_EVENT_EVENT_TYPE,
|
||||||
MAX_LENGTH_STATE_STATE,
|
MAX_LENGTH_STATE_STATE,
|
||||||
|
UnitOfLength,
|
||||||
__version__,
|
__version__,
|
||||||
)
|
)
|
||||||
from .exceptions import (
|
from .exceptions import (
|
||||||
@ -2275,7 +2275,8 @@ class Config:
|
|||||||
Async friendly.
|
Async friendly.
|
||||||
"""
|
"""
|
||||||
return self.units.length(
|
return self.units.length(
|
||||||
location.distance(self.latitude, self.longitude, lat, lon), LENGTH_METERS
|
location.distance(self.latitude, self.longitude, lat, lon),
|
||||||
|
UnitOfLength.METERS,
|
||||||
)
|
)
|
||||||
|
|
||||||
def path(self, *path: str) -> str:
|
def path(self, *path: str) -> str:
|
||||||
|
@ -20,7 +20,7 @@ from homeassistant.const import (
|
|||||||
CONF_RADIUS,
|
CONF_RADIUS,
|
||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
CONF_URL,
|
CONF_URL,
|
||||||
LENGTH_KILOMETERS,
|
UnitOfLength,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@ -77,7 +77,7 @@ async def test_entity_lifecycle(
|
|||||||
ATTR_LATITUDE: -31.0,
|
ATTR_LATITUDE: -31.0,
|
||||||
ATTR_LONGITUDE: 150.0,
|
ATTR_LONGITUDE: 150.0,
|
||||||
ATTR_FRIENDLY_NAME: "Title 1",
|
ATTR_FRIENDLY_NAME: "Title 1",
|
||||||
ATTR_UNIT_OF_MEASUREMENT: LENGTH_KILOMETERS,
|
ATTR_UNIT_OF_MEASUREMENT: UnitOfLength.KILOMETERS,
|
||||||
ATTR_SOURCE: "geo_json_events",
|
ATTR_SOURCE: "geo_json_events",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 15.5), 7) == 0
|
assert round(abs(float(state.state) - 15.5), 7) == 0
|
||||||
@ -90,7 +90,7 @@ async def test_entity_lifecycle(
|
|||||||
ATTR_LATITUDE: -31.1,
|
ATTR_LATITUDE: -31.1,
|
||||||
ATTR_LONGITUDE: 150.1,
|
ATTR_LONGITUDE: 150.1,
|
||||||
ATTR_FRIENDLY_NAME: "Title 2",
|
ATTR_FRIENDLY_NAME: "Title 2",
|
||||||
ATTR_UNIT_OF_MEASUREMENT: LENGTH_KILOMETERS,
|
ATTR_UNIT_OF_MEASUREMENT: UnitOfLength.KILOMETERS,
|
||||||
ATTR_SOURCE: "geo_json_events",
|
ATTR_SOURCE: "geo_json_events",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 20.5), 7) == 0
|
assert round(abs(float(state.state) - 20.5), 7) == 0
|
||||||
@ -103,7 +103,7 @@ async def test_entity_lifecycle(
|
|||||||
ATTR_LATITUDE: -31.2,
|
ATTR_LATITUDE: -31.2,
|
||||||
ATTR_LONGITUDE: 150.2,
|
ATTR_LONGITUDE: 150.2,
|
||||||
ATTR_FRIENDLY_NAME: "Title 3",
|
ATTR_FRIENDLY_NAME: "Title 3",
|
||||||
ATTR_UNIT_OF_MEASUREMENT: LENGTH_KILOMETERS,
|
ATTR_UNIT_OF_MEASUREMENT: UnitOfLength.KILOMETERS,
|
||||||
ATTR_SOURCE: "geo_json_events",
|
ATTR_SOURCE: "geo_json_events",
|
||||||
}
|
}
|
||||||
assert round(abs(float(state.state) - 25.5), 7) == 0
|
assert round(abs(float(state.state) - 25.5), 7) == 0
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
"""Make sure that ConnectSense Smart Outlet2 / In-Wall Outlet is enumerated properly."""
|
"""Make sure that ConnectSense Smart Outlet2 / In-Wall Outlet is enumerated properly."""
|
||||||
from homeassistant.components.sensor import SensorStateClass
|
from homeassistant.components.sensor import SensorStateClass
|
||||||
from homeassistant.const import (
|
from homeassistant.const import UnitOfElectricCurrent, UnitOfEnergy, UnitOfPower
|
||||||
ELECTRIC_CURRENT_AMPERE,
|
|
||||||
ENERGY_KILO_WATT_HOUR,
|
|
||||||
POWER_WATT,
|
|
||||||
)
|
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from ..common import (
|
from ..common import (
|
||||||
@ -39,7 +35,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Current",
|
friendly_name="InWall Outlet-0394DE Current",
|
||||||
unique_id="00:00:00:00:00:00_1_13_18",
|
unique_id="00:00:00:00:00:00_1_13_18",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
state="0.03",
|
state="0.03",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -47,7 +43,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Power",
|
friendly_name="InWall Outlet-0394DE Power",
|
||||||
unique_id="00:00:00:00:00:00_1_13_19",
|
unique_id="00:00:00:00:00:00_1_13_19",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=POWER_WATT,
|
unit_of_measurement=UnitOfPower.WATT,
|
||||||
state="0.8",
|
state="0.8",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -55,7 +51,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Energy kWh",
|
friendly_name="InWall Outlet-0394DE Energy kWh",
|
||||||
unique_id="00:00:00:00:00:00_1_13_20",
|
unique_id="00:00:00:00:00:00_1_13_20",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
state="379.69299",
|
state="379.69299",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -69,7 +65,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Current",
|
friendly_name="InWall Outlet-0394DE Current",
|
||||||
unique_id="00:00:00:00:00:00_1_25_30",
|
unique_id="00:00:00:00:00:00_1_25_30",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
state="0.05",
|
state="0.05",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -77,7 +73,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Power",
|
friendly_name="InWall Outlet-0394DE Power",
|
||||||
unique_id="00:00:00:00:00:00_1_25_31",
|
unique_id="00:00:00:00:00:00_1_25_31",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=POWER_WATT,
|
unit_of_measurement=UnitOfPower.WATT,
|
||||||
state="0.8",
|
state="0.8",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -85,7 +81,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Energy kWh",
|
friendly_name="InWall Outlet-0394DE Energy kWh",
|
||||||
unique_id="00:00:00:00:00:00_1_25_32",
|
unique_id="00:00:00:00:00:00_1_25_32",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
state="175.85001",
|
state="175.85001",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -118,7 +114,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Current",
|
friendly_name="InWall Outlet-0394DE Current",
|
||||||
unique_id="00:00:00:00:00:00_1_13_18",
|
unique_id="00:00:00:00:00:00_1_13_18",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
state="0.03",
|
state="0.03",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -126,7 +122,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Power",
|
friendly_name="InWall Outlet-0394DE Power",
|
||||||
unique_id="00:00:00:00:00:00_1_13_19",
|
unique_id="00:00:00:00:00:00_1_13_19",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=POWER_WATT,
|
unit_of_measurement=UnitOfPower.WATT,
|
||||||
state="0.8",
|
state="0.8",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -134,7 +130,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Energy kWh",
|
friendly_name="InWall Outlet-0394DE Energy kWh",
|
||||||
unique_id="00:00:00:00:00:00_1_13_20",
|
unique_id="00:00:00:00:00:00_1_13_20",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
state="379.69299",
|
state="379.69299",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -148,7 +144,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Current",
|
friendly_name="InWall Outlet-0394DE Current",
|
||||||
unique_id="00:00:00:00:00:00_1_25_30",
|
unique_id="00:00:00:00:00:00_1_25_30",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ELECTRIC_CURRENT_AMPERE,
|
unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||||
state="0.05",
|
state="0.05",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -156,7 +152,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Power",
|
friendly_name="InWall Outlet-0394DE Power",
|
||||||
unique_id="00:00:00:00:00:00_1_25_31",
|
unique_id="00:00:00:00:00:00_1_25_31",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=POWER_WATT,
|
unit_of_measurement=UnitOfPower.WATT,
|
||||||
state="0.8",
|
state="0.8",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
@ -164,7 +160,7 @@ async def test_connectsense_setup(hass: HomeAssistant) -> None:
|
|||||||
friendly_name="InWall Outlet-0394DE Energy kWh",
|
friendly_name="InWall Outlet-0394DE Energy kWh",
|
||||||
unique_id="00:00:00:00:00:00_1_25_32",
|
unique_id="00:00:00:00:00:00_1_25_32",
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
unit_of_measurement=ENERGY_KILO_WATT_HOUR,
|
unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
state="175.85001",
|
state="175.85001",
|
||||||
),
|
),
|
||||||
EntityTestInfo(
|
EntityTestInfo(
|
||||||
|
@ -5,7 +5,7 @@ This Koogeek device has a custom power sensor that extra handling.
|
|||||||
It should have 2 entities - the actual switch and a sensor for power usage.
|
It should have 2 entities - the actual switch and a sensor for power usage.
|
||||||
"""
|
"""
|
||||||
from homeassistant.components.sensor import SensorStateClass
|
from homeassistant.components.sensor import SensorStateClass
|
||||||
from homeassistant.const import POWER_WATT
|
from homeassistant.const import UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from ..common import (
|
from ..common import (
|
||||||
@ -51,7 +51,7 @@ async def test_koogeek_sw2_setup(hass: HomeAssistant) -> None:
|
|||||||
entity_id="sensor.koogeek_sw2_187a91_power",
|
entity_id="sensor.koogeek_sw2_187a91_power",
|
||||||
friendly_name="Koogeek-SW2-187A91 Power",
|
friendly_name="Koogeek-SW2-187A91 Power",
|
||||||
unique_id="00:00:00:00:00:00_1_14_18",
|
unique_id="00:00:00:00:00:00_1_14_18",
|
||||||
unit_of_measurement=POWER_WATT,
|
unit_of_measurement=UnitOfPower.WATT,
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
state="0",
|
state="0",
|
||||||
),
|
),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Make sure that existing VOCOlinc VP3 support isn't broken."""
|
"""Make sure that existing VOCOlinc VP3 support isn't broken."""
|
||||||
from homeassistant.components.sensor import SensorStateClass
|
from homeassistant.components.sensor import SensorStateClass
|
||||||
from homeassistant.const import POWER_WATT
|
from homeassistant.const import UnitOfPower
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ async def test_vocolinc_vp3_setup(
|
|||||||
entity_id="sensor.original_vocolinc_vp3_power",
|
entity_id="sensor.original_vocolinc_vp3_power",
|
||||||
friendly_name="VOCOlinc-VP3-123456 Power",
|
friendly_name="VOCOlinc-VP3-123456 Power",
|
||||||
unique_id="00:00:00:00:00:00_1_48_97",
|
unique_id="00:00:00:00:00:00_1_48_97",
|
||||||
unit_of_measurement=POWER_WATT,
|
unit_of_measurement=UnitOfPower.WATT,
|
||||||
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
capabilities={"state_class": SensorStateClass.MEASUREMENT},
|
||||||
state="0",
|
state="0",
|
||||||
),
|
),
|
||||||
|
@ -22,13 +22,13 @@ from homeassistant.const import (
|
|||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
VOLUME_LITERS,
|
|
||||||
UnitOfLength,
|
UnitOfLength,
|
||||||
UnitOfMass,
|
UnitOfMass,
|
||||||
UnitOfPrecipitationDepth,
|
UnitOfPrecipitationDepth,
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
UnitOfSpeed,
|
UnitOfSpeed,
|
||||||
UnitOfTemperature,
|
UnitOfTemperature,
|
||||||
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import TemplateError
|
from homeassistant.exceptions import TemplateError
|
||||||
@ -60,7 +60,7 @@ def _set_up_units(hass: HomeAssistant) -> None:
|
|||||||
mass=UnitOfMass.GRAMS,
|
mass=UnitOfMass.GRAMS,
|
||||||
pressure=UnitOfPressure.PA,
|
pressure=UnitOfPressure.PA,
|
||||||
temperature=UnitOfTemperature.CELSIUS,
|
temperature=UnitOfTemperature.CELSIUS,
|
||||||
volume=VOLUME_LITERS,
|
volume=UnitOfVolume.LITERS,
|
||||||
wind_speed=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
wind_speed=UnitOfSpeed.KILOMETERS_PER_HOUR,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,7 +8,10 @@ import pytest
|
|||||||
from homeassistant import const
|
from homeassistant import const
|
||||||
from homeassistant.components import sensor
|
from homeassistant.components import sensor
|
||||||
|
|
||||||
from tests.common import import_and_test_deprecated_constant_enum
|
from tests.common import (
|
||||||
|
import_and_test_deprecated_constant,
|
||||||
|
import_and_test_deprecated_constant_enum,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _create_tuples(
|
def _create_tuples(
|
||||||
@ -55,7 +58,78 @@ def _create_tuples(
|
|||||||
sensor.SensorDeviceClass.VOLTAGE,
|
sensor.SensorDeviceClass.VOLTAGE,
|
||||||
],
|
],
|
||||||
"DEVICE_CLASS_",
|
"DEVICE_CLASS_",
|
||||||
),
|
)
|
||||||
|
+ _create_tuples(const.UnitOfApparentPower, "POWER_")
|
||||||
|
+ _create_tuples(const.UnitOfPower, "POWER_")
|
||||||
|
+ _create_tuples(
|
||||||
|
[
|
||||||
|
const.UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
|
const.UnitOfEnergy.MEGA_WATT_HOUR,
|
||||||
|
const.UnitOfEnergy.WATT_HOUR,
|
||||||
|
],
|
||||||
|
"ENERGY_",
|
||||||
|
)
|
||||||
|
+ _create_tuples(const.UnitOfElectricCurrent, "ELECTRIC_CURRENT_")
|
||||||
|
+ _create_tuples(const.UnitOfElectricPotential, "ELECTRIC_POTENTIAL_")
|
||||||
|
+ _create_tuples(const.UnitOfTemperature, "TEMP_")
|
||||||
|
+ _create_tuples(const.UnitOfTime, "TIME_")
|
||||||
|
+ _create_tuples(
|
||||||
|
[
|
||||||
|
const.UnitOfLength.MILLIMETERS,
|
||||||
|
const.UnitOfLength.CENTIMETERS,
|
||||||
|
const.UnitOfLength.METERS,
|
||||||
|
const.UnitOfLength.KILOMETERS,
|
||||||
|
const.UnitOfLength.INCHES,
|
||||||
|
const.UnitOfLength.FEET,
|
||||||
|
const.UnitOfLength.MILES,
|
||||||
|
],
|
||||||
|
"LENGTH_",
|
||||||
|
)
|
||||||
|
+ _create_tuples(const.UnitOfFrequency, "FREQUENCY_")
|
||||||
|
+ _create_tuples(const.UnitOfPressure, "PRESSURE_")
|
||||||
|
+ _create_tuples(
|
||||||
|
[
|
||||||
|
const.UnitOfVolume.CUBIC_FEET,
|
||||||
|
const.UnitOfVolume.CUBIC_METERS,
|
||||||
|
const.UnitOfVolume.LITERS,
|
||||||
|
const.UnitOfVolume.MILLILITERS,
|
||||||
|
const.UnitOfVolume.GALLONS,
|
||||||
|
],
|
||||||
|
"VOLUME_",
|
||||||
|
)
|
||||||
|
+ _create_tuples(const.UnitOfVolumeFlowRate, "VOLUME_FLOW_RATE_")
|
||||||
|
+ _create_tuples(
|
||||||
|
[
|
||||||
|
const.UnitOfMass.GRAMS,
|
||||||
|
const.UnitOfMass.KILOGRAMS,
|
||||||
|
const.UnitOfMass.MILLIGRAMS,
|
||||||
|
const.UnitOfMass.MICROGRAMS,
|
||||||
|
const.UnitOfMass.OUNCES,
|
||||||
|
const.UnitOfMass.POUNDS,
|
||||||
|
],
|
||||||
|
"MASS_",
|
||||||
|
)
|
||||||
|
+ _create_tuples(const.UnitOfIrradiance, "IRRADIATION_")
|
||||||
|
+ _create_tuples(
|
||||||
|
[
|
||||||
|
const.UnitOfPrecipitationDepth.INCHES,
|
||||||
|
const.UnitOfPrecipitationDepth.MILLIMETERS,
|
||||||
|
const.UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
|
||||||
|
const.UnitOfVolumetricFlux.INCHES_PER_HOUR,
|
||||||
|
],
|
||||||
|
"PRECIPITATION_",
|
||||||
|
)
|
||||||
|
+ _create_tuples(const.UnitOfSpeed, "SPEED_")
|
||||||
|
+ _create_tuples(
|
||||||
|
[
|
||||||
|
const.UnitOfVolumetricFlux.MILLIMETERS_PER_DAY,
|
||||||
|
const.UnitOfVolumetricFlux.INCHES_PER_DAY,
|
||||||
|
const.UnitOfVolumetricFlux.INCHES_PER_HOUR,
|
||||||
|
],
|
||||||
|
"SPEED_",
|
||||||
|
)
|
||||||
|
+ _create_tuples(const.UnitOfInformation, "DATA_")
|
||||||
|
+ _create_tuples(const.UnitOfDataRate, "DATA_RATE_"),
|
||||||
)
|
)
|
||||||
def test_deprecated_constants(
|
def test_deprecated_constants(
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
@ -66,3 +140,28 @@ def test_deprecated_constants(
|
|||||||
import_and_test_deprecated_constant_enum(
|
import_and_test_deprecated_constant_enum(
|
||||||
caplog, const, enum, constant_prefix, "2025.1"
|
caplog, const, enum, constant_prefix, "2025.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("replacement", "constant_name"),
|
||||||
|
[
|
||||||
|
(const.UnitOfLength.YARDS, "LENGTH_YARD"),
|
||||||
|
(const.UnitOfSoundPressure.DECIBEL, "SOUND_PRESSURE_DB"),
|
||||||
|
(const.UnitOfSoundPressure.WEIGHTED_DECIBEL_A, "SOUND_PRESSURE_WEIGHTED_DBA"),
|
||||||
|
(const.UnitOfVolume.FLUID_OUNCES, "VOLUME_FLUID_OUNCE"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_deprecated_constant_name_changes(
|
||||||
|
caplog: pytest.LogCaptureFixture,
|
||||||
|
replacement: Enum,
|
||||||
|
constant_name: str,
|
||||||
|
) -> None:
|
||||||
|
"""Test deprecated constants, where the name is not the same as the enum value."""
|
||||||
|
import_and_test_deprecated_constant(
|
||||||
|
caplog,
|
||||||
|
const,
|
||||||
|
constant_name,
|
||||||
|
f"{replacement.__class__.__name__}.{replacement.name}",
|
||||||
|
replacement,
|
||||||
|
"2025.1",
|
||||||
|
)
|
||||||
|
@ -11,14 +11,14 @@ from homeassistant.components.sensor import (
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
FREQUENCY_GIGAHERTZ,
|
|
||||||
LIGHT_LUX,
|
LIGHT_LUX,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
POWER_VOLT_AMPERE,
|
|
||||||
POWER_VOLT_AMPERE_REACTIVE,
|
POWER_VOLT_AMPERE_REACTIVE,
|
||||||
SIGNAL_STRENGTH_DECIBELS,
|
SIGNAL_STRENGTH_DECIBELS,
|
||||||
VOLUME_CUBIC_METERS,
|
UnitOfApparentPower,
|
||||||
|
UnitOfFrequency,
|
||||||
UnitOfPressure,
|
UnitOfPressure,
|
||||||
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
|
|
||||||
from tests.common import MockEntity
|
from tests.common import MockEntity
|
||||||
@ -26,7 +26,7 @@ from tests.common import MockEntity
|
|||||||
DEVICE_CLASSES.append("none")
|
DEVICE_CLASSES.append("none")
|
||||||
|
|
||||||
UNITS_OF_MEASUREMENT = {
|
UNITS_OF_MEASUREMENT = {
|
||||||
SensorDeviceClass.APPARENT_POWER: POWER_VOLT_AMPERE, # apparent power (VA)
|
SensorDeviceClass.APPARENT_POWER: UnitOfApparentPower.VOLT_AMPERE, # apparent power (VA)
|
||||||
SensorDeviceClass.BATTERY: PERCENTAGE, # % of battery that is left
|
SensorDeviceClass.BATTERY: PERCENTAGE, # % of battery that is left
|
||||||
SensorDeviceClass.CO: CONCENTRATION_PARTS_PER_MILLION, # ppm of CO concentration
|
SensorDeviceClass.CO: CONCENTRATION_PARTS_PER_MILLION, # ppm of CO concentration
|
||||||
SensorDeviceClass.CO2: CONCENTRATION_PARTS_PER_MILLION, # ppm of CO2 concentration
|
SensorDeviceClass.CO2: CONCENTRATION_PARTS_PER_MILLION, # ppm of CO2 concentration
|
||||||
@ -47,12 +47,12 @@ UNITS_OF_MEASUREMENT = {
|
|||||||
SensorDeviceClass.POWER: "kW", # power (W/kW)
|
SensorDeviceClass.POWER: "kW", # power (W/kW)
|
||||||
SensorDeviceClass.CURRENT: "A", # current (A)
|
SensorDeviceClass.CURRENT: "A", # current (A)
|
||||||
SensorDeviceClass.ENERGY: "kWh", # energy (Wh/kWh/MWh)
|
SensorDeviceClass.ENERGY: "kWh", # energy (Wh/kWh/MWh)
|
||||||
SensorDeviceClass.FREQUENCY: FREQUENCY_GIGAHERTZ, # energy (Hz/kHz/MHz/GHz)
|
SensorDeviceClass.FREQUENCY: UnitOfFrequency.GIGAHERTZ, # energy (Hz/kHz/MHz/GHz)
|
||||||
SensorDeviceClass.POWER_FACTOR: PERCENTAGE, # power factor (no unit, min: -1.0, max: 1.0)
|
SensorDeviceClass.POWER_FACTOR: PERCENTAGE, # power factor (no unit, min: -1.0, max: 1.0)
|
||||||
SensorDeviceClass.REACTIVE_POWER: POWER_VOLT_AMPERE_REACTIVE, # reactive power (var)
|
SensorDeviceClass.REACTIVE_POWER: POWER_VOLT_AMPERE_REACTIVE, # reactive power (var)
|
||||||
SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, # µg/m³ of vocs
|
SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS: CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, # µg/m³ of vocs
|
||||||
SensorDeviceClass.VOLTAGE: "V", # voltage (V)
|
SensorDeviceClass.VOLTAGE: "V", # voltage (V)
|
||||||
SensorDeviceClass.GAS: VOLUME_CUBIC_METERS, # gas (m³)
|
SensorDeviceClass.GAS: UnitOfVolume.CUBIC_METERS, # gas (m³)
|
||||||
}
|
}
|
||||||
|
|
||||||
ENTITIES = {}
|
ENTITIES = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user