Use enums in repetier (#62038)

This commit is contained in:
Robert Hillis
2021-12-16 08:33:23 -05:00
committed by GitHub
parent 4983a8f218
commit 18ae4a9420
2 changed files with 7 additions and 9 deletions

View File

@@ -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",

View File

@@ -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."""