mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-03 17:34:29 +02:00
created types definition file for switches
This commit is contained in:
parent
1503cd79d1
commit
cccbe01279
1 changed files with 47 additions and 0 deletions
47
custom_components/mikrotik_router/switch_types.py
Normal file
47
custom_components/mikrotik_router/switch_types.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
"""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.switch import (
|
||||
SwitchDeviceClass,
|
||||
SwitchEntityDescription,
|
||||
)
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
DEVICE_ATTRIBUTES_CLIENT_TRAFFIC = ["address", "mac-address", "host-name"]
|
||||
|
||||
|
||||
@dataclass
|
||||
class MikrotikSwitchEntityDescription(SwitchEntityDescription):
|
||||
"""Class describing mikrotik entities."""
|
||||
|
||||
device_class: str = SwitchDeviceClass.SWITCH
|
||||
|
||||
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": MikrotikSwitchEntityDescription(
|
||||
key="system_temperature",
|
||||
name="Temperature",
|
||||
icon="mdi:thermometer",
|
||||
entity_category=None,
|
||||
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