mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 02:24:51 -05:00
change suez price to price / m³ (#176611)
This commit is contained in:
@@ -10,6 +10,7 @@ from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.const import CURRENCY_EURO, UnitOfVolume
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -41,8 +42,8 @@ SENSORS: tuple[SuezWaterSensorEntityDescription, ...] = (
|
||||
SuezWaterSensorEntityDescription(
|
||||
key="water_price",
|
||||
translation_key="water_price",
|
||||
native_unit_of_measurement=CURRENCY_EURO,
|
||||
device_class=SensorDeviceClass.MONETARY,
|
||||
native_unit_of_measurement=f"{CURRENCY_EURO}/{UnitOfVolume.CUBIC_METERS}",
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
value_fn=lambda suez_data: suez_data.price,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
@@ -24,7 +26,7 @@
|
||||
'object_id_base': 'Water price',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.MONETARY: 'monetary'>,
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Water price',
|
||||
'platform': 'suez_water',
|
||||
@@ -33,16 +35,16 @@
|
||||
'supported_features': 0,
|
||||
'translation_key': 'water_price',
|
||||
'unique_id': '123456_water_price',
|
||||
'unit_of_measurement': '€',
|
||||
'unit_of_measurement': '€/m³',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors_valid_state[sensor.suez_mock_device_water_price-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ATTRIBUTION: 'attribution'>: 'Data provided by toutsurmoneau.fr',
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'monetary',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Suez mock device Water price',
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: '€',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: '€/m³',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.suez_mock_device_water_price',
|
||||
|
||||
Reference in New Issue
Block a user