From d30eec9f608547596ce090968cffa7371facaaf7 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Tue, 9 Jan 2024 22:02:20 +0100 Subject: [PATCH] Fix device_class for Shelly Gen1 sleeping sensors --- homeassistant/components/shelly/sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/shelly/sensor.py b/homeassistant/components/shelly/sensor.py index 89dc10f053026..c7d89f2d284e8 100644 --- a/homeassistant/components/shelly/sensor.py +++ b/homeassistant/components/shelly/sensor.py @@ -36,6 +36,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_registry import RegistryEntry from homeassistant.helpers.typing import StateType +from homeassistant.util.enum import try_parse_enum from .const import CONF_SLEEP_PERIOD, SHAIR_MAX_WORK_HOURS from .coordinator import ShellyBlockCoordinator, ShellyRpcCoordinator @@ -969,7 +970,7 @@ def _build_block_description(entry: RegistryEntry) -> BlockSensorDescription: name="", icon=entry.original_icon, native_unit_of_measurement=entry.unit_of_measurement, - device_class=entry.original_device_class, + device_class=try_parse_enum(SensorDeviceClass, entry.original_device_class), )