mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Use enums in repetier (#62038)
This commit is contained in:
parent
4983a8f218
commit
18ae4a9420
@ -8,7 +8,7 @@ import logging
|
|||||||
import pyrepetier
|
import pyrepetier
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntityDescription
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -16,7 +16,6 @@ from homeassistant.const import (
|
|||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
@ -143,21 +142,21 @@ SENSOR_TYPES: dict[str, RepetierSensorEntityDescription] = {
|
|||||||
type="temperature",
|
type="temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
name="_bed_",
|
name="_bed_",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
),
|
),
|
||||||
"extruder_temperature": RepetierSensorEntityDescription(
|
"extruder_temperature": RepetierSensorEntityDescription(
|
||||||
key="extruder_temperature",
|
key="extruder_temperature",
|
||||||
type="temperature",
|
type="temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
name="_extruder_",
|
name="_extruder_",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
),
|
),
|
||||||
"chamber_temperature": RepetierSensorEntityDescription(
|
"chamber_temperature": RepetierSensorEntityDescription(
|
||||||
key="chamber_temperature",
|
key="chamber_temperature",
|
||||||
type="temperature",
|
type="temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
name="_chamber_",
|
name="_chamber_",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
),
|
),
|
||||||
"current_state": RepetierSensorEntityDescription(
|
"current_state": RepetierSensorEntityDescription(
|
||||||
key="current_state",
|
key="current_state",
|
||||||
|
@ -3,8 +3,7 @@ from datetime import datetime
|
|||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
||||||
@ -149,7 +148,7 @@ class RepetierJobSensor(RepetierSensor):
|
|||||||
class RepetierJobEndSensor(RepetierSensor):
|
class RepetierJobEndSensor(RepetierSensor):
|
||||||
"""Class to create and populate a Repetier Job End timestamp Sensor."""
|
"""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):
|
def update(self):
|
||||||
"""Update the sensor."""
|
"""Update the sensor."""
|
||||||
@ -173,7 +172,7 @@ class RepetierJobEndSensor(RepetierSensor):
|
|||||||
class RepetierJobStartSensor(RepetierSensor):
|
class RepetierJobStartSensor(RepetierSensor):
|
||||||
"""Class to create and populate a Repetier Job Start timestamp Sensor."""
|
"""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):
|
def update(self):
|
||||||
"""Update the sensor."""
|
"""Update the sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user