From 18ae4a9420eecc580f0d458820aac87f3846976a Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Thu, 16 Dec 2021 08:33:23 -0500 Subject: [PATCH] Use enums in repetier (#62038) --- homeassistant/components/repetier/__init__.py | 9 ++++----- homeassistant/components/repetier/sensor.py | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/repetier/__init__.py b/homeassistant/components/repetier/__init__.py index 4c5534d1a28..54acbc07449 100644 --- a/homeassistant/components/repetier/__init__.py +++ b/homeassistant/components/repetier/__init__.py @@ -8,7 +8,7 @@ import logging import pyrepetier import voluptuous as vol -from homeassistant.components.sensor import SensorEntityDescription +from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription from homeassistant.const import ( CONF_API_KEY, CONF_HOST, @@ -16,7 +16,6 @@ from homeassistant.const import ( CONF_NAME, CONF_PORT, CONF_SENSORS, - DEVICE_CLASS_TEMPERATURE, PERCENTAGE, TEMP_CELSIUS, ) @@ -143,21 +142,21 @@ SENSOR_TYPES: dict[str, RepetierSensorEntityDescription] = { type="temperature", native_unit_of_measurement=TEMP_CELSIUS, name="_bed_", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, ), "extruder_temperature": RepetierSensorEntityDescription( key="extruder_temperature", type="temperature", native_unit_of_measurement=TEMP_CELSIUS, name="_extruder_", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, ), "chamber_temperature": RepetierSensorEntityDescription( key="chamber_temperature", type="temperature", native_unit_of_measurement=TEMP_CELSIUS, name="_chamber_", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, ), "current_state": RepetierSensorEntityDescription( key="current_state", diff --git a/homeassistant/components/repetier/sensor.py b/homeassistant/components/repetier/sensor.py index 25c70cc2960..8ab05ee058c 100644 --- a/homeassistant/components/repetier/sensor.py +++ b/homeassistant/components/repetier/sensor.py @@ -3,8 +3,7 @@ from datetime import datetime import logging import time -from homeassistant.components.sensor import SensorEntity -from homeassistant.const import DEVICE_CLASS_TIMESTAMP +from homeassistant.components.sensor import SensorDeviceClass, SensorEntity from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -149,7 +148,7 @@ class RepetierJobSensor(RepetierSensor): class RepetierJobEndSensor(RepetierSensor): """Class to create and populate a Repetier Job End timestamp Sensor.""" - _attr_device_class = DEVICE_CLASS_TIMESTAMP + _attr_device_class = SensorDeviceClass.TIMESTAMP def update(self): """Update the sensor.""" @@ -173,7 +172,7 @@ class RepetierJobEndSensor(RepetierSensor): class RepetierJobStartSensor(RepetierSensor): """Class to create and populate a Repetier Job Start timestamp Sensor.""" - _attr_device_class = DEVICE_CLASS_TIMESTAMP + _attr_device_class = SensorDeviceClass.TIMESTAMP def update(self): """Update the sensor."""