mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use UnitOfVolume in dsmr_reader (#84226)
This commit is contained in:
parent
cce438951d
commit
429dbd4215
@ -12,16 +12,16 @@ from homeassistant.components.sensor import (
|
|||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CURRENCY_EURO,
|
CURRENCY_EURO,
|
||||||
VOLUME_CUBIC_METERS,
|
|
||||||
UnitOfElectricCurrent,
|
UnitOfElectricCurrent,
|
||||||
UnitOfElectricPotential,
|
UnitOfElectricPotential,
|
||||||
UnitOfEnergy,
|
UnitOfEnergy,
|
||||||
UnitOfPower,
|
UnitOfPower,
|
||||||
|
UnitOfVolume,
|
||||||
)
|
)
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
PRICE_EUR_KWH: Final = f"EUR/{UnitOfEnergy.KILO_WATT_HOUR}"
|
PRICE_EUR_KWH: Final = f"EUR/{UnitOfEnergy.KILO_WATT_HOUR}"
|
||||||
PRICE_EUR_M3: Final = f"EUR/{VOLUME_CUBIC_METERS}"
|
PRICE_EUR_M3: Final = f"EUR/{UnitOfVolume.CUBIC_METERS}"
|
||||||
|
|
||||||
|
|
||||||
def dsmr_transform(value):
|
def dsmr_transform(value):
|
||||||
@ -141,7 +141,7 @@ SENSORS: tuple[DSMRReaderSensorEntityDescription, ...] = (
|
|||||||
name="Gas meter usage",
|
name="Gas meter usage",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
icon="mdi:fire",
|
icon="mdi:fire",
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
DSMRReaderSensorEntityDescription(
|
DSMRReaderSensorEntityDescription(
|
||||||
@ -203,14 +203,14 @@ SENSORS: tuple[DSMRReaderSensorEntityDescription, ...] = (
|
|||||||
key="dsmr/consumption/gas/delivered",
|
key="dsmr/consumption/gas/delivered",
|
||||||
name="Gas usage",
|
name="Gas usage",
|
||||||
device_class=SensorDeviceClass.GAS,
|
device_class=SensorDeviceClass.GAS,
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
DSMRReaderSensorEntityDescription(
|
DSMRReaderSensorEntityDescription(
|
||||||
key="dsmr/consumption/gas/currently_delivered",
|
key="dsmr/consumption/gas/currently_delivered",
|
||||||
name="Current gas usage",
|
name="Current gas usage",
|
||||||
device_class=SensorDeviceClass.GAS,
|
device_class=SensorDeviceClass.GAS,
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
DSMRReaderSensorEntityDescription(
|
DSMRReaderSensorEntityDescription(
|
||||||
@ -278,7 +278,7 @@ SENSORS: tuple[DSMRReaderSensorEntityDescription, ...] = (
|
|||||||
key="dsmr/day-consumption/gas",
|
key="dsmr/day-consumption/gas",
|
||||||
name="Gas usage",
|
name="Gas usage",
|
||||||
icon="mdi:counter",
|
icon="mdi:counter",
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
),
|
),
|
||||||
DSMRReaderSensorEntityDescription(
|
DSMRReaderSensorEntityDescription(
|
||||||
key="dsmr/day-consumption/gas_cost",
|
key="dsmr/day-consumption/gas_cost",
|
||||||
@ -453,7 +453,7 @@ SENSORS: tuple[DSMRReaderSensorEntityDescription, ...] = (
|
|||||||
key="dsmr/current-month/gas",
|
key="dsmr/current-month/gas",
|
||||||
name="Current month gas usage",
|
name="Current month gas usage",
|
||||||
icon="mdi:counter",
|
icon="mdi:counter",
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
),
|
),
|
||||||
DSMRReaderSensorEntityDescription(
|
DSMRReaderSensorEntityDescription(
|
||||||
key="dsmr/current-month/gas_cost",
|
key="dsmr/current-month/gas_cost",
|
||||||
@ -531,7 +531,7 @@ SENSORS: tuple[DSMRReaderSensorEntityDescription, ...] = (
|
|||||||
key="dsmr/current-year/gas",
|
key="dsmr/current-year/gas",
|
||||||
name="Current year gas usage",
|
name="Current year gas usage",
|
||||||
icon="mdi:counter",
|
icon="mdi:counter",
|
||||||
native_unit_of_measurement=VOLUME_CUBIC_METERS,
|
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
|
||||||
),
|
),
|
||||||
DSMRReaderSensorEntityDescription(
|
DSMRReaderSensorEntityDescription(
|
||||||
key="dsmr/current-year/gas_cost",
|
key="dsmr/current-year/gas_cost",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user