Add entity_category to oncue sensors (#63231)

This commit is contained in:
J. Nick Koston 2022-01-02 10:06:27 -10:00 committed by GitHub
parent f14e162610
commit 1483d394be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@ from homeassistant.const import (
TEMP_FAHRENHEIT, TEMP_FAHRENHEIT,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo, EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import ( from homeassistant.helpers.update_coordinator import (
CoordinatorEntity, CoordinatorEntity,
@ -33,70 +33,99 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key="LatestFirmware", key="LatestFirmware",
icon="mdi:update", icon="mdi:update",
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="EngineSpeed",
icon="mdi:speedometer",
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription(key="EngineSpeed", icon="mdi:speedometer"),
SensorEntityDescription( SensorEntityDescription(
key="EngineOilPressure", key="EngineOilPressure",
native_unit_of_measurement=PRESSURE_PSI, native_unit_of_measurement=PRESSURE_PSI,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="EngineCoolantTemperature", key="EngineCoolantTemperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="BatteryVoltage", key="BatteryVoltage",
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT, native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="LubeOilTemperature", key="LubeOilTemperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="GensetControllerTemperature", key="GensetControllerTemperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="EngineCompartmentTemperature", key="EngineCompartmentTemperature",
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="GeneratorTrueTotalPower", key="GeneratorTrueTotalPower",
native_unit_of_measurement=POWER_WATT, native_unit_of_measurement=POWER_WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="GeneratorTruePercentOfRatedPower", key="GeneratorTruePercentOfRatedPower",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="GeneratorVoltageAverageLineToLine", key="GeneratorVoltageAverageLineToLine",
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT, native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription( SensorEntityDescription(
key="GeneratorFrequency", key="GeneratorFrequency",
native_unit_of_measurement=FREQUENCY_HERTZ, native_unit_of_measurement=FREQUENCY_HERTZ,
device_class=SensorDeviceClass.FREQUENCY, device_class=SensorDeviceClass.FREQUENCY,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription(key="GensetState", icon="mdi:home-lightning-bolt"), SensorEntityDescription(key="GensetState", icon="mdi:home-lightning-bolt"),
SensorEntityDescription( SensorEntityDescription(
key="GensetControllerTotalOperationTime", icon="mdi:hours-24" key="GensetControllerTotalOperationTime",
icon="mdi:hours-24",
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="EngineTotalRunTime",
icon="mdi:hours-24",
entity_category=EntityCategory.DIAGNOSTIC,
), ),
SensorEntityDescription(key="EngineTotalRunTime", icon="mdi:hours-24"),
SensorEntityDescription(key="AtsContactorPosition", icon="mdi:electric-switch"), SensorEntityDescription(key="AtsContactorPosition", icon="mdi:electric-switch"),
SensorEntityDescription(key="IPAddress", icon="mdi:ip-network"), SensorEntityDescription(
SensorEntityDescription(key="ConnectedServerIPAddress", icon="mdi:server-network"), key="IPAddress",
icon="mdi:ip-network",
entity_category=EntityCategory.DIAGNOSTIC,
),
SensorEntityDescription(
key="ConnectedServerIPAddress",
icon="mdi:server-network",
entity_category=EntityCategory.DIAGNOSTIC,
),
) )
SENSOR_MAP = {description.key: description for description in SENSOR_TYPES} SENSOR_MAP = {description.key: description for description in SENSOR_TYPES}