mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-26 18:58:54 +02:00
removed unnecessery MikrotikClientTrafficSensor
This commit is contained in:
parent
7a892b6800
commit
cace2ae3e5
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 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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue