From 248f01f41f58682abc75a26f8ae16bd1516fba97 Mon Sep 17 00:00:00 2001 From: Markus Bong Date: Thu, 5 May 2022 11:36:00 +0200 Subject: [PATCH] fix reading of battery messages (#70659) --- .../components/devolo_home_control/devolo_device.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/devolo_home_control/devolo_device.py b/homeassistant/components/devolo_home_control/devolo_device.py index b3cb68098e1..6087e07799d 100644 --- a/homeassistant/components/devolo_home_control/devolo_device.py +++ b/homeassistant/components/devolo_home_control/devolo_device.py @@ -7,6 +7,7 @@ from urllib.parse import urlparse from devolo_home_control_api.devices.zwave import Zwave from devolo_home_control_api.homecontrol import HomeControl +from homeassistant.components.sensor import SensorDeviceClass from homeassistant.helpers.entity import DeviceInfo, Entity from .const import DOMAIN @@ -71,7 +72,11 @@ class DevoloDeviceEntity(Entity): def _generic_message(self, message: tuple) -> None: """Handle generic messages.""" - if len(message) == 3 and message[2] == "battery_level": + if ( + len(message) == 3 + and message[2] == "battery_level" + and self.device_class == SensorDeviceClass.BATTERY + ): self._value = message[1] elif len(message) == 3 and message[2] == "status": # Maybe the API wants to tell us, that the device went on- or offline.