Use enums in rdw (#62059)

This commit is contained in:
Robert Hillis 2021-12-16 09:10:54 -05:00 committed by GitHub
parent 079b7f217f
commit 5227019d3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ from dataclasses import dataclass
from vehicle import Vehicle from vehicle import Vehicle
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
BinarySensorEntityDescription, BinarySensorEntityDescription,
) )
@ -48,7 +48,7 @@ BINARY_SENSORS: tuple[RDWBinarySensorEntityDescription, ...] = (
RDWBinarySensorEntityDescription( RDWBinarySensorEntityDescription(
key="pending_recall", key="pending_recall",
name="Pending Recall", name="Pending Recall",
device_class=DEVICE_CLASS_PROBLEM, device_class=BinarySensorDeviceClass.PROBLEM,
is_on_fn=lambda vehicle: vehicle.pending_recall, is_on_fn=lambda vehicle: vehicle.pending_recall,
), ),
) )

View file

@ -8,7 +8,7 @@ from datetime import date
from vehicle import Vehicle from vehicle import Vehicle
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
DEVICE_CLASS_DATE, SensorDeviceClass,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
) )
@ -43,13 +43,13 @@ SENSORS: tuple[RDWSensorEntityDescription, ...] = (
RDWSensorEntityDescription( RDWSensorEntityDescription(
key="apk_expiration", key="apk_expiration",
name="APK Expiration", name="APK Expiration",
device_class=DEVICE_CLASS_DATE, device_class=SensorDeviceClass.DATE,
value_fn=lambda vehicle: vehicle.apk_expiration, value_fn=lambda vehicle: vehicle.apk_expiration,
), ),
RDWSensorEntityDescription( RDWSensorEntityDescription(
key="ascription_date", key="ascription_date",
name="Ascription Date", name="Ascription Date",
device_class=DEVICE_CLASS_DATE, device_class=SensorDeviceClass.DATE,
value_fn=lambda vehicle: vehicle.ascription_date, value_fn=lambda vehicle: vehicle.ascription_date,
), ),
) )