From b63359b186014a353f8a5ff86774a66034fdb76d Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 9 Dec 2022 16:39:40 +0100 Subject: [PATCH] Use UnitOfVolume in energy integration (#83641) --- homeassistant/components/energy/sensor.py | 24 ++++++++--------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/energy/sensor.py b/homeassistant/components/energy/sensor.py index 71e385f2fec..08076ef2061 100644 --- a/homeassistant/components/energy/sensor.py +++ b/homeassistant/components/energy/sensor.py @@ -16,15 +16,7 @@ from homeassistant.components.sensor import ( SensorStateClass, ) from homeassistant.components.sensor.recorder import reset_detected -from homeassistant.const import ( - ATTR_UNIT_OF_MEASUREMENT, - VOLUME_CUBIC_FEET, - VOLUME_CUBIC_METERS, - VOLUME_GALLONS, - VOLUME_LITERS, - UnitOfEnergy, - UnitOfVolume, -) +from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, UnitOfEnergy, UnitOfVolume from homeassistant.core import ( HomeAssistant, State, @@ -55,15 +47,15 @@ VALID_ENERGY_UNITS: set[str] = { UnitOfEnergy.GIGA_JOULE, } VALID_ENERGY_UNITS_GAS = { - VOLUME_CUBIC_FEET, - VOLUME_CUBIC_METERS, + UnitOfVolume.CUBIC_FEET, + UnitOfVolume.CUBIC_METERS, *VALID_ENERGY_UNITS, } -VALID_VOLUME_UNITS_WATER = { - VOLUME_CUBIC_FEET, - VOLUME_CUBIC_METERS, - VOLUME_GALLONS, - VOLUME_LITERS, +VALID_VOLUME_UNITS_WATER: set[str] = { + UnitOfVolume.CUBIC_FEET, + UnitOfVolume.CUBIC_METERS, + UnitOfVolume.GALLONS, + UnitOfVolume.LITERS, } _LOGGER = logging.getLogger(__name__)