mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use new enums in nissan_leaf (#61951)
This commit is contained in:
parent
81ea811b74
commit
39590f9917
@ -2,8 +2,7 @@
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_BATTERY_CHARGING,
|
||||
DEVICE_CLASS_PLUG,
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
|
||||
@ -29,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
class LeafPluggedInSensor(LeafEntity, BinarySensorEntity):
|
||||
"""Plugged In Sensor class."""
|
||||
|
||||
_attr_device_class = DEVICE_CLASS_PLUG
|
||||
_attr_device_class = BinarySensorDeviceClass.PLUG
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@ -50,7 +49,7 @@ class LeafPluggedInSensor(LeafEntity, BinarySensorEntity):
|
||||
class LeafChargingSensor(LeafEntity, BinarySensorEntity):
|
||||
"""Charging Sensor class."""
|
||||
|
||||
_attr_device_class = DEVICE_CLASS_BATTERY_CHARGING
|
||||
_attr_device_class = BinarySensorDeviceClass.BATTERY_CHARGING
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -1,8 +1,8 @@
|
||||
"""Battery Charge and Range Support for the Nissan Leaf."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
from homeassistant.util.distance import LENGTH_KILOMETERS, LENGTH_MILES
|
||||
from homeassistant.util.unit_system import IMPERIAL_SYSTEM, METRIC_SYSTEM
|
||||
@ -47,7 +47,7 @@ class LeafBatterySensor(LeafEntity, SensorEntity):
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the device class of the sensor."""
|
||||
return DEVICE_CLASS_BATTERY
|
||||
return SensorDeviceClass.BATTERY
|
||||
|
||||
@property
|
||||
def native_value(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user