mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-03 17:34:29 +02:00
created types definition file for binary sensors
This commit is contained in:
parent
0b0e15be25
commit
889d270eb7
1 changed files with 43 additions and 0 deletions
43
custom_components/mikrotik_router/binary_sensor_types.py
Normal file
43
custom_components/mikrotik_router/binary_sensor_types.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
"""Definitions for Mikrotik Router sensor entities."""
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntityDescription,
|
||||
)
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
@dataclass
|
||||
class MikrotikBinarySensorEntityDescription(BinarySensorEntityDescription):
|
||||
"""Class describing mikrotik entities."""
|
||||
|
||||
ha_group: str = ""
|
||||
ha_connection: str = ""
|
||||
ha_connection_value: str = ""
|
||||
data_path: str = ""
|
||||
data_attribute: str = ""
|
||||
data_name: str = ""
|
||||
data_uid: str = ""
|
||||
data_reference: str = ""
|
||||
data_attributes_list: List = field(default_factory=lambda: [])
|
||||
|
||||
|
||||
SENSOR_TYPES = {
|
||||
"system_temperature": MikrotikBinarySensorEntityDescription(
|
||||
key="system_temperature",
|
||||
name="Temperature",
|
||||
icon="mdi:thermometer",
|
||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
ha_group="System",
|
||||
data_path="health",
|
||||
data_attribute="temperature",
|
||||
data_name="",
|
||||
data_uid="",
|
||||
data_reference="",
|
||||
),
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue