mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-02 08:54:31 +02:00
added icons into types definition file for binary sensors
This commit is contained in:
parent
8b2f75a0ff
commit
167469b7d1
2 changed files with 13 additions and 1 deletions
|
@ -317,6 +317,15 @@ class MikrotikControllerBinarySensor(BinarySensorEntity):
|
||||||
"""Return true if device is on."""
|
"""Return true if device is on."""
|
||||||
return self._data[self.entity_description.data_is_on]
|
return self._data[self.entity_description.data_is_on]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon(self) -> str:
|
||||||
|
"""Return the icon."""
|
||||||
|
if self.entity_description.icon_enabled:
|
||||||
|
if self._data[self.entity_description.data_is_on]:
|
||||||
|
return self.entity_description.icon_enabled
|
||||||
|
else:
|
||||||
|
return self.entity_description.icon_disabled
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
"""Return a description for device registry."""
|
"""Return a description for device registry."""
|
||||||
|
|
|
@ -15,6 +15,8 @@ from .const import DOMAIN
|
||||||
class MikrotikBinarySensorEntityDescription(BinarySensorEntityDescription):
|
class MikrotikBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||||
"""Class describing mikrotik entities."""
|
"""Class describing mikrotik entities."""
|
||||||
|
|
||||||
|
icon_enabled: str = ""
|
||||||
|
icon_disabled: str = ""
|
||||||
ha_group: str = ""
|
ha_group: str = ""
|
||||||
ha_connection: str = ""
|
ha_connection: str = ""
|
||||||
ha_connection_value: str = ""
|
ha_connection_value: str = ""
|
||||||
|
@ -30,7 +32,8 @@ SENSOR_TYPES = {
|
||||||
"system_fwupdate": MikrotikBinarySensorEntityDescription(
|
"system_fwupdate": MikrotikBinarySensorEntityDescription(
|
||||||
key="system_fwupdate",
|
key="system_fwupdate",
|
||||||
name="Firmware update",
|
name="Firmware update",
|
||||||
icon="mdi:thermometer",
|
icon_enabled="",
|
||||||
|
icon_disabled="",
|
||||||
device_class=BinarySensorDeviceClass.UPDATE,
|
device_class=BinarySensorDeviceClass.UPDATE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
ha_group="System",
|
ha_group="System",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue