From 86a4dd358fdefee8f2cd931e573567cb06f46eda Mon Sep 17 00:00:00 2001 From: tomaae <23486452+tomaae@users.noreply.github.com> Date: Tue, 14 Dec 2021 20:59:59 +0100 Subject: [PATCH] Added Device_class for firmware update binary sensor, fixes #137 --- custom_components/mikrotik_router/binary_sensor.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/mikrotik_router/binary_sensor.py b/custom_components/mikrotik_router/binary_sensor.py index ba1a363..18dc00b 100644 --- a/custom_components/mikrotik_router/binary_sensor.py +++ b/custom_components/mikrotik_router/binary_sensor.py @@ -261,6 +261,14 @@ class MikrotikControllerBinarySensor(BinarySensorEntity): """Return the state attributes.""" return self._attrs + @property + def device_class(self) -> Optional[str]: + """Return the device class.""" + if ATTR_DEVICE_CLASS in self._type: + return self._type[ATTR_DEVICE_CLASS] + + return None + @property def unique_id(self) -> str: """Return a unique id for this entity."""