From 730208028f1dc37cc5da5208d391bcce61de3b98 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 9 Dec 2021 09:13:23 +0100 Subject: [PATCH] Use SensorDeviceClass enum in bh1750 (#61314) Co-authored-by: epenet --- homeassistant/components/bh1750/sensor.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/bh1750/sensor.py b/homeassistant/components/bh1750/sensor.py index ad5ca13684a..8eab85e5f1d 100644 --- a/homeassistant/components/bh1750/sensor.py +++ b/homeassistant/components/bh1750/sensor.py @@ -6,8 +6,12 @@ from i2csense.bh1750 import BH1750 # pylint: disable=import-error import smbus import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity -from homeassistant.const import CONF_NAME, DEVICE_CLASS_ILLUMINANCE, LIGHT_LUX +from homeassistant.components.sensor import ( + PLATFORM_SCHEMA, + SensorDeviceClass, + SensorEntity, +) +from homeassistant.const import CONF_NAME, LIGHT_LUX import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) @@ -96,7 +100,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= class BH1750Sensor(SensorEntity): """Implementation of the BH1750 sensor.""" - _attr_device_class = DEVICE_CLASS_ILLUMINANCE + _attr_device_class = SensorDeviceClass.ILLUMINANCE def __init__(self, bh1750_sensor, name, unit, multiplier=1.0): """Initialize the sensor."""