Add volume to SensorDeviceClass (#77960)

* Add volume to SensorDeviceClass

* Adjust recorder

* Adjust tests

* Adjust sensor UNIT_CONVERTERS

* Adjust recorder

* Update strings.json
This commit is contained in:
epenet 2022-09-27 18:37:52 +01:00 committed by GitHub
parent d8a15f3dda
commit 12e4d18038
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 113 additions and 23 deletions

View file

@ -23,6 +23,10 @@ from homeassistant.const import (
STATE_UNKNOWN,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
VOLUME_CUBIC_FEET,
VOLUME_CUBIC_METERS,
VOLUME_FLUID_OUNCE,
VOLUME_LITERS,
)
from homeassistant.core import State
from homeassistant.helpers import entity_registry as er
@ -549,6 +553,31 @@ async def test_custom_unit(
100,
SensorDeviceClass.SPEED,
),
# Volume
(
VOLUME_CUBIC_METERS,
VOLUME_CUBIC_FEET,
VOLUME_CUBIC_FEET,
100,
3531,
SensorDeviceClass.VOLUME,
),
(
VOLUME_FLUID_OUNCE,
VOLUME_LITERS,
VOLUME_LITERS,
78,
2.3,
SensorDeviceClass.VOLUME,
),
(
VOLUME_CUBIC_METERS,
"peer_distance",
VOLUME_CUBIC_METERS,
100,
100,
SensorDeviceClass.VOLUME,
),
],
)
async def test_custom_unit_change(