Add more unit-based sensor descriptions to myuplink (#113104)

* Add more unit-based sensor descriptions

* Move late addition to icon translations
This commit is contained in:
Åke Strandberg 2024-06-05 17:45:52 +02:00 committed by GitHub
parent 0487b38ed3
commit e2dd88be6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 46 additions and 0 deletions

View file

@ -26,6 +26,9 @@
"priority": {
"default": "mdi:priority-high"
},
"rpm": {
"default": "mdi:rotate-right"
},
"status_compressor": {
"default": "mdi:heat-pump-outline"
}

View file

@ -10,6 +10,7 @@ from homeassistant.components.sensor import (
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
REVOLUTIONS_PER_MINUTE,
Platform,
UnitOfElectricCurrent,
UnitOfEnergy,
@ -54,6 +55,13 @@ DEVICE_POINT_UNIT_DESCRIPTIONS: dict[str, SensorEntityDescription] = {
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPressure.BAR,
),
"days": SensorEntityDescription(
key="days",
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.DAYS,
suggested_display_precision=0,
),
"h": SensorEntityDescription(
key="hours",
device_class=SensorDeviceClass.DURATION,
@ -61,6 +69,13 @@ DEVICE_POINT_UNIT_DESCRIPTIONS: dict[str, SensorEntityDescription] = {
native_unit_of_measurement=UnitOfTime.HOURS,
suggested_display_precision=1,
),
"hrs": SensorEntityDescription(
key="hours_hrs",
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.HOURS,
suggested_display_precision=1,
),
"Hz": SensorEntityDescription(
key="hertz",
device_class=SensorDeviceClass.FREQUENCY,
@ -86,6 +101,27 @@ DEVICE_POINT_UNIT_DESCRIPTIONS: dict[str, SensorEntityDescription] = {
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
),
"min": SensorEntityDescription(
key="minutes",
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.MINUTES,
suggested_display_precision=0,
),
"Pa": SensorEntityDescription(
key="pressure_pa",
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPressure.PA,
suggested_display_precision=0,
),
"rpm": SensorEntityDescription(
key="rpm",
translation_key="rpm",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=REVOLUTIONS_PER_MINUTE,
suggested_display_precision=0,
),
"s": SensorEntityDescription(
key="seconds",
device_class=SensorDeviceClass.DURATION,
@ -93,6 +129,13 @@ DEVICE_POINT_UNIT_DESCRIPTIONS: dict[str, SensorEntityDescription] = {
native_unit_of_measurement=UnitOfTime.SECONDS,
suggested_display_precision=0,
),
"sec": SensorEntityDescription(
key="seconds_sec",
device_class=SensorDeviceClass.DURATION,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.SECONDS,
suggested_display_precision=0,
),
}
MARKER_FOR_UNKNOWN_VALUE = -32768