From 5227019d3edf6e75c0a52191aba774985a3b3f4c Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Thu, 16 Dec 2021 09:10:54 -0500 Subject: [PATCH] Use enums in rdw (#62059) --- homeassistant/components/rdw/binary_sensor.py | 4 ++-- homeassistant/components/rdw/sensor.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/rdw/binary_sensor.py b/homeassistant/components/rdw/binary_sensor.py index 80f4a425212..81d3e448b78 100644 --- a/homeassistant/components/rdw/binary_sensor.py +++ b/homeassistant/components/rdw/binary_sensor.py @@ -7,7 +7,7 @@ from dataclasses import dataclass from vehicle import Vehicle from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_PROBLEM, + BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription, ) @@ -48,7 +48,7 @@ BINARY_SENSORS: tuple[RDWBinarySensorEntityDescription, ...] = ( RDWBinarySensorEntityDescription( key="pending_recall", name="Pending Recall", - device_class=DEVICE_CLASS_PROBLEM, + device_class=BinarySensorDeviceClass.PROBLEM, is_on_fn=lambda vehicle: vehicle.pending_recall, ), ) diff --git a/homeassistant/components/rdw/sensor.py b/homeassistant/components/rdw/sensor.py index f2c8d93a8a2..04f525c61b8 100644 --- a/homeassistant/components/rdw/sensor.py +++ b/homeassistant/components/rdw/sensor.py @@ -8,7 +8,7 @@ from datetime import date from vehicle import Vehicle from homeassistant.components.sensor import ( - DEVICE_CLASS_DATE, + SensorDeviceClass, SensorEntity, SensorEntityDescription, ) @@ -43,13 +43,13 @@ SENSORS: tuple[RDWSensorEntityDescription, ...] = ( RDWSensorEntityDescription( key="apk_expiration", name="APK Expiration", - device_class=DEVICE_CLASS_DATE, + device_class=SensorDeviceClass.DATE, value_fn=lambda vehicle: vehicle.apk_expiration, ), RDWSensorEntityDescription( key="ascription_date", name="Ascription Date", - device_class=DEVICE_CLASS_DATE, + device_class=SensorDeviceClass.DATE, value_fn=lambda vehicle: vehicle.ascription_date, ), )