Use enums in vallox (#61992)

This commit is contained in:
Robert Hillis 2021-12-16 03:12:57 -05:00 committed by GitHub
parent 701699350d
commit 868e5db47a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,16 +5,13 @@ from dataclasses import dataclass
from datetime import datetime, timedelta from datetime import datetime, timedelta
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT, SensorDeviceClass,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
SensorStateClass,
) )
from homeassistant.const import ( from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION, CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_CO2,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_TIMESTAMP,
PERCENTAGE, PERCENTAGE,
TEMP_CELSIUS, TEMP_CELSIUS,
) )
@ -144,7 +141,7 @@ SENSORS: tuple[ValloxSensorEntityDescription, ...] = (
name="Fan Speed", name="Fan Speed",
metric_key="A_CYC_FAN_SPEED", metric_key="A_CYC_FAN_SPEED",
icon="mdi:fan", icon="mdi:fan",
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
sensor_type=ValloxFanSpeedSensor, sensor_type=ValloxFanSpeedSensor,
), ),
@ -152,7 +149,7 @@ SENSORS: tuple[ValloxSensorEntityDescription, ...] = (
key="remaining_time_for_filter", key="remaining_time_for_filter",
name="Remaining Time For Filter", name="Remaining Time For Filter",
metric_key="A_CYC_REMAINING_TIME_FOR_FILTER", metric_key="A_CYC_REMAINING_TIME_FOR_FILTER",
device_class=DEVICE_CLASS_TIMESTAMP, device_class=SensorDeviceClass.TIMESTAMP,
sensor_type=ValloxFilterRemainingSensor, sensor_type=ValloxFilterRemainingSensor,
), ),
ValloxSensorEntityDescription( ValloxSensorEntityDescription(
@ -166,40 +163,40 @@ SENSORS: tuple[ValloxSensorEntityDescription, ...] = (
key="extract_air", key="extract_air",
name="Extract Air", name="Extract Air",
metric_key="A_CYC_TEMP_EXTRACT_AIR", metric_key="A_CYC_TEMP_EXTRACT_AIR",
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
), ),
ValloxSensorEntityDescription( ValloxSensorEntityDescription(
key="exhaust_air", key="exhaust_air",
name="Exhaust Air", name="Exhaust Air",
metric_key="A_CYC_TEMP_EXHAUST_AIR", metric_key="A_CYC_TEMP_EXHAUST_AIR",
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
), ),
ValloxSensorEntityDescription( ValloxSensorEntityDescription(
key="outdoor_air", key="outdoor_air",
name="Outdoor Air", name="Outdoor Air",
metric_key="A_CYC_TEMP_OUTDOOR_AIR", metric_key="A_CYC_TEMP_OUTDOOR_AIR",
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
), ),
ValloxSensorEntityDescription( ValloxSensorEntityDescription(
key="supply_air", key="supply_air",
name="Supply Air", name="Supply Air",
metric_key="A_CYC_TEMP_SUPPLY_AIR", metric_key="A_CYC_TEMP_SUPPLY_AIR",
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
), ),
ValloxSensorEntityDescription( ValloxSensorEntityDescription(
key="humidity", key="humidity",
name="Humidity", name="Humidity",
metric_key="A_CYC_RH_VALUE", metric_key="A_CYC_RH_VALUE",
device_class=DEVICE_CLASS_HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
), ),
ValloxSensorEntityDescription( ValloxSensorEntityDescription(
@ -207,15 +204,15 @@ SENSORS: tuple[ValloxSensorEntityDescription, ...] = (
name="Efficiency", name="Efficiency",
metric_key="A_CYC_EXTRACT_EFFICIENCY", metric_key="A_CYC_EXTRACT_EFFICIENCY",
icon="mdi:gauge", icon="mdi:gauge",
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
), ),
ValloxSensorEntityDescription( ValloxSensorEntityDescription(
key="co2", key="co2",
name="CO2", name="CO2",
metric_key="A_CYC_CO2_VALUE", metric_key="A_CYC_CO2_VALUE",
device_class=DEVICE_CLASS_CO2, device_class=SensorDeviceClass.CO2,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
), ),
) )