mirror of
https://github.com/home-assistant/core.git
synced 2025-07-29 18:28:14 +02:00
Add new atmospheric pressure device class (#83455)
* Add new atmospheric pressure device class * Translations * Automatic conversion * Convert all pressure units
This commit is contained in:
@ -250,6 +250,12 @@ METRIC_SYSTEM = UnitSystem(
|
||||
_CONF_UNIT_SYSTEM_METRIC,
|
||||
accumulated_precipitation=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||
conversions={
|
||||
# Force atmospheric pressures to hPa
|
||||
**{
|
||||
("atmospheric_pressure", unit): UnitOfPressure.HPA
|
||||
for unit in UnitOfPressure
|
||||
if unit != UnitOfPressure.HPA
|
||||
},
|
||||
# Convert non-metric distances
|
||||
("distance", UnitOfLength.FEET): UnitOfLength.METERS,
|
||||
("distance", UnitOfLength.INCHES): UnitOfLength.MILLIMETERS,
|
||||
@ -282,6 +288,12 @@ US_CUSTOMARY_SYSTEM = UnitSystem(
|
||||
_CONF_UNIT_SYSTEM_US_CUSTOMARY,
|
||||
accumulated_precipitation=UnitOfPrecipitationDepth.INCHES,
|
||||
conversions={
|
||||
# Force atmospheric pressures to inHg
|
||||
**{
|
||||
("atmospheric_pressure", unit): UnitOfPressure.INHG
|
||||
for unit in UnitOfPressure
|
||||
if unit != UnitOfPressure.INHG
|
||||
},
|
||||
# Convert non-USCS distances
|
||||
("distance", UnitOfLength.CENTIMETERS): UnitOfLength.INCHES,
|
||||
("distance", UnitOfLength.KILOMETERS): UnitOfLength.MILES,
|
||||
|
Reference in New Issue
Block a user