mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
fix reading of battery messages (#70659)
This commit is contained in:
parent
22d2587593
commit
248f01f41f
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user