Add number + sensor device class volume storage (#88312)

* Add number + sensor device class volume storage

* Fix typo

* Format code

* Update device automations
This commit is contained in:
Erik Montnemery
2023-03-01 11:22:57 +01:00
committed by GitHub
parent 29b049fc57
commit fca5cc6ea3
6 changed files with 33 additions and 0 deletions

View File

@@ -324,6 +324,18 @@ class NumberDeviceClass(StrEnum):
USCS/imperial units are currently assumed to be US volumes)
"""
VOLUME_STORAGE = "volume_storage"
"""Generic stored volume.
Use this device class for sensors measuring stored volume, for example the amount
of fuel in a fuel tank.
Unit of measurement: `VOLUME_*` units
- SI / metric: `mL`, `L`, `m³`
- USCS / imperial: `ft³`, `CCF`, `fl. oz.`, `gal` (warning: volumes expressed in
USCS/imperial units are currently assumed to be US volumes)
"""
WATER = "water"
"""Water.
@@ -411,6 +423,7 @@ DEVICE_CLASS_UNITS: dict[NumberDeviceClass, set[type[StrEnum] | str | None]] = {
},
NumberDeviceClass.VOLTAGE: set(UnitOfElectricPotential),
NumberDeviceClass.VOLUME: set(UnitOfVolume),
NumberDeviceClass.VOLUME_STORAGE: set(UnitOfVolume),
NumberDeviceClass.WATER: {
UnitOfVolume.CENTUM_CUBIC_FEET,
UnitOfVolume.CUBIC_FEET,