diff --git a/homeassistant/components/nissan_leaf/binary_sensor.py b/homeassistant/components/nissan_leaf/binary_sensor.py index 13fe666a3a8..5212eec3e82 100644 --- a/homeassistant/components/nissan_leaf/binary_sensor.py +++ b/homeassistant/components/nissan_leaf/binary_sensor.py @@ -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): diff --git a/homeassistant/components/nissan_leaf/sensor.py b/homeassistant/components/nissan_leaf/sensor.py index bed4d264bd4..8d43e9bcf85 100644 --- a/homeassistant/components/nissan_leaf/sensor.py +++ b/homeassistant/components/nissan_leaf/sensor.py @@ -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):