From ae3162bb6ee85af80dcfee04de8bb689133fa9e5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 20 Dec 2021 17:55:37 +0100 Subject: [PATCH] Use new enums in starline (#62407) Co-authored-by: epenet --- .../components/starline/binary_sensor.py | 15 ++++++--------- homeassistant/components/starline/sensor.py | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/starline/binary_sensor.py b/homeassistant/components/starline/binary_sensor.py index e2e3d7ea4fa..c5a96322d43 100644 --- a/homeassistant/components/starline/binary_sensor.py +++ b/homeassistant/components/starline/binary_sensor.py @@ -4,10 +4,7 @@ from __future__ import annotations from dataclasses import dataclass from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_DOOR, - DEVICE_CLASS_LOCK, - DEVICE_CLASS_POWER, - DEVICE_CLASS_PROBLEM, + BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription, ) @@ -35,27 +32,27 @@ BINARY_SENSOR_TYPES: tuple[StarlineBinarySensorEntityDescription, ...] = ( StarlineBinarySensorEntityDescription( key="hbrake", name_="Hand Brake", - device_class=DEVICE_CLASS_POWER, + device_class=BinarySensorDeviceClass.POWER, ), StarlineBinarySensorEntityDescription( key="hood", name_="Hood", - device_class=DEVICE_CLASS_DOOR, + device_class=BinarySensorDeviceClass.DOOR, ), StarlineBinarySensorEntityDescription( key="trunk", name_="Trunk", - device_class=DEVICE_CLASS_DOOR, + device_class=BinarySensorDeviceClass.DOOR, ), StarlineBinarySensorEntityDescription( key="alarm", name_="Alarm", - device_class=DEVICE_CLASS_PROBLEM, + device_class=BinarySensorDeviceClass.PROBLEM, ), StarlineBinarySensorEntityDescription( key="door", name_="Doors", - device_class=DEVICE_CLASS_LOCK, + device_class=BinarySensorDeviceClass.LOCK, ), ) diff --git a/homeassistant/components/starline/sensor.py b/homeassistant/components/starline/sensor.py index 9ce3aa3bc08..472faa44195 100644 --- a/homeassistant/components/starline/sensor.py +++ b/homeassistant/components/starline/sensor.py @@ -4,7 +4,7 @@ from __future__ import annotations from dataclasses import dataclass from homeassistant.components.sensor import ( - DEVICE_CLASS_TEMPERATURE, + SensorDeviceClass, SensorEntity, SensorEntityDescription, ) @@ -50,13 +50,13 @@ SENSOR_TYPES: tuple[StarlineSensorEntityDescription, ...] = ( StarlineSensorEntityDescription( key="ctemp", name_="Interior Temperature", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=TEMP_CELSIUS, ), StarlineSensorEntityDescription( key="etemp", name_="Engine Temperature", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=TEMP_CELSIUS, ), StarlineSensorEntityDescription(