diff --git a/homeassistant/components/comfoconnect/sensor.py b/homeassistant/components/comfoconnect/sensor.py index 14590fc1445..2503fb27583 100644 --- a/homeassistant/components/comfoconnect/sensor.py +++ b/homeassistant/components/comfoconnect/sensor.py @@ -29,17 +29,13 @@ import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, - STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL_INCREASING, + SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.const import ( CONF_RESOURCES, - DEVICE_CLASS_ENERGY, - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_POWER, - DEVICE_CLASS_TEMPERATURE, ENERGY_KILO_WATT_HOUR, PERCENTAGE, POWER_WATT, @@ -96,8 +92,8 @@ class ComfoconnectSensorEntityDescription( SENSOR_TYPES = ( ComfoconnectSensorEntityDescription( key=ATTR_CURRENT_TEMPERATURE, - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, name="Inside temperature", native_unit_of_measurement=TEMP_CELSIUS, sensor_id=SENSOR_TEMPERATURE_EXTRACT, @@ -105,16 +101,16 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_CURRENT_HUMIDITY, - device_class=DEVICE_CLASS_HUMIDITY, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, name="Inside humidity", native_unit_of_measurement=PERCENTAGE, sensor_id=SENSOR_HUMIDITY_EXTRACT, ), ComfoconnectSensorEntityDescription( key=ATTR_CURRENT_RMOT, - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, name="Current RMOT", native_unit_of_measurement=TEMP_CELSIUS, sensor_id=SENSOR_CURRENT_RMOT, @@ -122,8 +118,8 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_OUTSIDE_TEMPERATURE, - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, name="Outside temperature", native_unit_of_measurement=TEMP_CELSIUS, sensor_id=SENSOR_TEMPERATURE_OUTDOOR, @@ -131,16 +127,16 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_OUTSIDE_HUMIDITY, - device_class=DEVICE_CLASS_HUMIDITY, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, name="Outside humidity", native_unit_of_measurement=PERCENTAGE, sensor_id=SENSOR_HUMIDITY_OUTDOOR, ), ComfoconnectSensorEntityDescription( key=ATTR_SUPPLY_TEMPERATURE, - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, name="Supply temperature", native_unit_of_measurement=TEMP_CELSIUS, sensor_id=SENSOR_TEMPERATURE_SUPPLY, @@ -148,15 +144,15 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_SUPPLY_HUMIDITY, - device_class=DEVICE_CLASS_HUMIDITY, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, name="Supply humidity", native_unit_of_measurement=PERCENTAGE, sensor_id=SENSOR_HUMIDITY_SUPPLY, ), ComfoconnectSensorEntityDescription( key=ATTR_SUPPLY_FAN_SPEED, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Supply fan speed", native_unit_of_measurement="rpm", icon="mdi:fan-plus", @@ -164,7 +160,7 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_SUPPLY_FAN_DUTY, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Supply fan duty", native_unit_of_measurement=PERCENTAGE, icon="mdi:fan-plus", @@ -172,7 +168,7 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_EXHAUST_FAN_SPEED, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Exhaust fan speed", native_unit_of_measurement="rpm", icon="mdi:fan-minus", @@ -180,7 +176,7 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_EXHAUST_FAN_DUTY, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Exhaust fan duty", native_unit_of_measurement=PERCENTAGE, icon="mdi:fan-minus", @@ -188,8 +184,8 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_EXHAUST_TEMPERATURE, - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, name="Exhaust temperature", native_unit_of_measurement=TEMP_CELSIUS, sensor_id=SENSOR_TEMPERATURE_EXHAUST, @@ -197,15 +193,15 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_EXHAUST_HUMIDITY, - device_class=DEVICE_CLASS_HUMIDITY, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, name="Exhaust humidity", native_unit_of_measurement=PERCENTAGE, sensor_id=SENSOR_HUMIDITY_EXHAUST, ), ComfoconnectSensorEntityDescription( key=ATTR_AIR_FLOW_SUPPLY, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Supply airflow", native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR, icon="mdi:fan-plus", @@ -213,7 +209,7 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_AIR_FLOW_EXHAUST, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Exhaust airflow", native_unit_of_measurement=VOLUME_FLOW_RATE_CUBIC_METERS_PER_HOUR, icon="mdi:fan-minus", @@ -221,7 +217,7 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_BYPASS_STATE, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Bypass state", native_unit_of_measurement=PERCENTAGE, icon="mdi:camera-iris", @@ -236,32 +232,32 @@ SENSOR_TYPES = ( ), ComfoconnectSensorEntityDescription( key=ATTR_POWER_CURRENT, - device_class=DEVICE_CLASS_POWER, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, name="Power usage", native_unit_of_measurement=POWER_WATT, sensor_id=SENSOR_POWER_CURRENT, ), ComfoconnectSensorEntityDescription( key=ATTR_POWER_TOTAL, - device_class=DEVICE_CLASS_ENERGY, - state_class=STATE_CLASS_TOTAL_INCREASING, + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, name="Energy total", native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, sensor_id=SENSOR_POWER_TOTAL, ), ComfoconnectSensorEntityDescription( key=ATTR_PREHEATER_POWER_CURRENT, - device_class=DEVICE_CLASS_POWER, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, name="Preheater power usage", native_unit_of_measurement=POWER_WATT, sensor_id=SENSOR_PREHEATER_POWER_CURRENT, ), ComfoconnectSensorEntityDescription( key=ATTR_PREHEATER_POWER_TOTAL, - device_class=DEVICE_CLASS_ENERGY, - state_class=STATE_CLASS_TOTAL_INCREASING, + device_class=SensorDeviceClass.ENERGY, + state_class=SensorStateClass.TOTAL_INCREASING, name="Preheater energy total", native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, sensor_id=SENSOR_PREHEATER_POWER_TOTAL,