mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-28 03:30:07 +02:00
Added captive portal authorized clients count #200
This commit is contained in:
parent
981668032e
commit
e14d018b20
2 changed files with 23 additions and 0 deletions
|
@ -1381,6 +1381,7 @@ class MikrotikControllerData:
|
||||||
{"name": "uptime_epoch", "default": 0},
|
{"name": "uptime_epoch", "default": 0},
|
||||||
{"name": "clients_wired", "default": 0},
|
{"name": "clients_wired", "default": 0},
|
||||||
{"name": "clients_wireless", "default": 0},
|
{"name": "clients_wireless", "default": 0},
|
||||||
|
{"name": "captive_authorized", "default": 0},
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1547,6 +1548,13 @@ class MikrotikControllerData:
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
auth_hosts = sum(
|
||||||
|
1
|
||||||
|
for uid in self.data["hostspot_host"]
|
||||||
|
if self.data["hostspot_host"][uid]["authorized"]
|
||||||
|
)
|
||||||
|
self.data["resource"]["captive_authorized"] = auth_hosts
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# get_queue
|
# get_queue
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
|
|
@ -286,6 +286,21 @@ SENSOR_TYPES = {
|
||||||
data_uid="",
|
data_uid="",
|
||||||
data_reference="",
|
data_reference="",
|
||||||
),
|
),
|
||||||
|
"system_captive-authorized": MikrotikSensorEntityDescription(
|
||||||
|
key="system_captive-authorized",
|
||||||
|
name="Captive Portal Clients",
|
||||||
|
icon="mdi:key-wireless",
|
||||||
|
native_unit_of_measurement=None,
|
||||||
|
device_class=None,
|
||||||
|
state_class=None,
|
||||||
|
entity_category=None,
|
||||||
|
ha_group="System",
|
||||||
|
data_path="resource",
|
||||||
|
data_attribute="captive_authorized",
|
||||||
|
data_name="",
|
||||||
|
data_uid="",
|
||||||
|
data_reference="",
|
||||||
|
),
|
||||||
"traffic_tx": MikrotikSensorEntityDescription(
|
"traffic_tx": MikrotikSensorEntityDescription(
|
||||||
key="traffic_tx",
|
key="traffic_tx",
|
||||||
name="TX",
|
name="TX",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue