mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-26 02:38:47 +02:00
Fixed traffic sensor names, ref #306
This commit is contained in:
parent
6079affcfa
commit
4b610ba4e5
2 changed files with 31 additions and 31 deletions
|
@ -39,7 +39,7 @@ async def async_setup_entry(
|
|||
dispatcher = {
|
||||
"MikrotikSensor": MikrotikSensor,
|
||||
"MikrotikInterfaceTrafficSensor": MikrotikInterfaceTrafficSensor,
|
||||
# "MikrotikClientTrafficSensor": MikrotikClientTrafficSensor,
|
||||
"MikrotikClientTrafficSensor": MikrotikClientTrafficSensor,
|
||||
}
|
||||
await async_add_entities(hass, config_entry, dispatcher)
|
||||
|
||||
|
@ -109,27 +109,27 @@ class MikrotikInterfaceTrafficSensor(MikrotikSensor):
|
|||
return attributes
|
||||
|
||||
|
||||
# # ---------------------------
|
||||
# # MikrotikClientTrafficSensor
|
||||
# # ---------------------------
|
||||
# class MikrotikClientTrafficSensor(MikrotikSensor):
|
||||
# """Define an Mikrotik MikrotikClientTrafficSensor sensor."""
|
||||
#
|
||||
# @property
|
||||
# def name(self) -> str:
|
||||
# """Return the name."""
|
||||
# return f"{self.entity_description.name}"
|
||||
#
|
||||
# # @property
|
||||
# # def available(self) -> bool:
|
||||
# # """Return if controller and accounting feature in Mikrotik is available.
|
||||
# # Additional check for lan-tx/rx sensors
|
||||
# # """
|
||||
# # if self.entity_description.data_attribute in ["lan-tx", "lan-rx"]:
|
||||
# # return (
|
||||
# # self.coordinator.connected()
|
||||
# # and self._data["available"]
|
||||
# # and self._data["local_accounting"]
|
||||
# # )
|
||||
# # else:
|
||||
# # return self.coordinator.connected() and self._data["available"]
|
||||
# ---------------------------
|
||||
# MikrotikClientTrafficSensor
|
||||
# ---------------------------
|
||||
class MikrotikClientTrafficSensor(MikrotikSensor):
|
||||
"""Define an Mikrotik MikrotikClientTrafficSensor sensor."""
|
||||
|
||||
@property
|
||||
def custom_name(self) -> str:
|
||||
"""Return the name for this entity"""
|
||||
return f"{self.entity_description.name}"
|
||||
|
||||
# @property
|
||||
# def available(self) -> bool:
|
||||
# """Return if controller and accounting feature in Mikrotik is available.
|
||||
# Additional check for lan-tx/rx sensors
|
||||
# """
|
||||
# if self.entity_description.data_attribute in ["lan-tx", "lan-rx"]:
|
||||
# return (
|
||||
# self.coordinator.connected()
|
||||
# and self._data["available"]
|
||||
# and self._data["local_accounting"]
|
||||
# )
|
||||
# else:
|
||||
# return self.coordinator.connected() and self._data["available"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue