mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-25 18:28:46 +02:00
Added status, rate, duplex and negotiation status to ethernet ports #146
This commit is contained in:
parent
052c1f1e7d
commit
b04a0a5b26
3 changed files with 105 additions and 41 deletions
|
@ -60,6 +60,25 @@ DEVICE_ATTRIBUTES_IFACE = [
|
|||
"actual-mtu",
|
||||
"type",
|
||||
"name",
|
||||
]
|
||||
|
||||
DEVICE_ATTRIBUTES_IFACE_ETHER = [
|
||||
"running",
|
||||
"enabled",
|
||||
"comment",
|
||||
"client-ip-address",
|
||||
"client-mac-address",
|
||||
"port-mac-address",
|
||||
"last-link-down-time",
|
||||
"last-link-up-time",
|
||||
"link-downs",
|
||||
"actual-mtu",
|
||||
"type",
|
||||
"name",
|
||||
"status",
|
||||
"auto-negotiation",
|
||||
"rate",
|
||||
"full-duplex",
|
||||
"default-name",
|
||||
"poe-out",
|
||||
]
|
||||
|
@ -476,12 +495,19 @@ class MikrotikControllerPortBinarySensor(MikrotikControllerBinarySensor):
|
|||
def extra_state_attributes(self) -> Dict[str, Any]:
|
||||
"""Return the state attributes."""
|
||||
attributes = self._attrs
|
||||
for variable in DEVICE_ATTRIBUTES_IFACE:
|
||||
if variable in self._data:
|
||||
attributes[format_attribute(variable)] = self._data[variable]
|
||||
|
||||
if "sfp-shutdown-temperature" in self._data:
|
||||
for variable in DEVICE_ATTRIBUTES_IFACE_SFP:
|
||||
if self._data["type"] == "ether":
|
||||
for variable in DEVICE_ATTRIBUTES_IFACE_ETHER:
|
||||
if variable in self._data:
|
||||
attributes[format_attribute(variable)] = self._data[variable]
|
||||
|
||||
if "sfp-shutdown-temperature" in self._data:
|
||||
for variable in DEVICE_ATTRIBUTES_IFACE_SFP:
|
||||
if variable in self._data:
|
||||
attributes[format_attribute(variable)] = self._data[variable]
|
||||
|
||||
else:
|
||||
for variable in self._sid_data["sid_attr"]:
|
||||
if variable in self._data:
|
||||
attributes[format_attribute(variable)] = self._data[variable]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue