Use device and state class enum for Renault (#60768)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-01 17:40:56 +01:00 committed by GitHub
parent b154f43657
commit cd9962dfa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 79 additions and 93 deletions

View file

@ -7,8 +7,7 @@ from renault_api.kamereon.enums import ChargeState, PlugState
from renault_api.kamereon.models import KamereonVehicleBatteryStatusData
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY_CHARGING,
DEVICE_CLASS_PLUG,
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
@ -75,7 +74,7 @@ BINARY_SENSOR_TYPES: tuple[RenaultBinarySensorEntityDescription, ...] = (
RenaultBinarySensorEntityDescription(
key="plugged_in",
coordinator="battery",
device_class=DEVICE_CLASS_PLUG,
device_class=BinarySensorDeviceClass.PLUG,
name="Plugged In",
on_key="plugStatus",
on_value=PlugState.PLUGGED.value,
@ -83,7 +82,7 @@ BINARY_SENSOR_TYPES: tuple[RenaultBinarySensorEntityDescription, ...] = (
RenaultBinarySensorEntityDescription(
key="charging",
coordinator="battery",
device_class=DEVICE_CLASS_BATTERY_CHARGING,
device_class=BinarySensorDeviceClass.BATTERY_CHARGING,
name="Charging",
on_key="chargingStatus",
on_value=ChargeState.CHARGE_IN_PROGRESS.value,