Add support for entity categories to NUT entities (#57689)

This commit is contained in:
Michael 2021-10-14 22:51:31 +02:00 committed by GitHub
parent 7104750008
commit 997d014111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,8 @@ from homeassistant.components.sensor import (
from homeassistant.const import (
ELECTRIC_CURRENT_AMPERE,
ELECTRIC_POTENTIAL_VOLT,
ENTITY_CATEGORY_CONFIG,
ENTITY_CATEGORY_DIAGNOSTIC,
FREQUENCY_HERTZ,
PERCENTAGE,
POWER_VOLT_AMPERE,
@ -68,6 +70,7 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"ups.load": SensorEntityDescription(
key="ups.load",
@ -81,6 +84,7 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
name="Overload Setting",
native_unit_of_measurement=PERCENTAGE,
icon="mdi:gauge",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"ups.id": SensorEntityDescription(
key="ups.id",
@ -92,18 +96,21 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
name="Load Restart Delay",
native_unit_of_measurement=TIME_SECONDS,
icon="mdi:timer-outline",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"ups.delay.reboot": SensorEntityDescription(
key="ups.delay.reboot",
name="UPS Reboot Delay",
native_unit_of_measurement=TIME_SECONDS,
icon="mdi:timer-outline",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"ups.delay.shutdown": SensorEntityDescription(
key="ups.delay.shutdown",
name="UPS Shutdown Delay",
native_unit_of_measurement=TIME_SECONDS,
icon="mdi:timer-outline",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"ups.timer.start": SensorEntityDescription(
key="ups.timer.start",
@ -128,16 +135,19 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
name="Self-Test Interval",
native_unit_of_measurement=TIME_SECONDS,
icon="mdi:timer-outline",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"ups.test.result": SensorEntityDescription(
key="ups.test.result",
name="Self-Test Result",
icon="mdi:information-outline",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"ups.test.date": SensorEntityDescription(
key="ups.test.date",
name="Self-Test Date",
icon="mdi:calendar",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"ups.display.language": SensorEntityDescription(
key="ups.display.language",
@ -196,6 +206,7 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
key="ups.watchdog.status",
name="Watchdog Status",
icon="mdi:information-outline",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"ups.start.auto": SensorEntityDescription(
key="ups.start.auto",
@ -229,6 +240,7 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
name="Low Battery Setpoint",
native_unit_of_measurement=PERCENTAGE,
icon="mdi:gauge",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"battery.charge.restart": SensorEntityDescription(
key="battery.charge.restart",
@ -241,6 +253,7 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
name="Warning Battery Setpoint",
native_unit_of_measurement=PERCENTAGE,
icon="mdi:gauge",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"battery.charger.status": SensorEntityDescription(
key="battery.charger.status",
@ -297,12 +310,14 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"battery.runtime": SensorEntityDescription(
key="battery.runtime",
name="Battery Runtime",
native_unit_of_measurement=TIME_SECONDS,
icon="mdi:timer-outline",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"battery.runtime.low": SensorEntityDescription(
key="battery.runtime.low",
@ -320,6 +335,7 @@ SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
key="battery.alarm.threshold",
name="Battery Alarm Threshold",
icon="mdi:information-outline",
entity_category=ENTITY_CATEGORY_CONFIG,
),
"battery.date": SensorEntityDescription(
key="battery.date",