Added captive portal authorized clients count #200

This commit is contained in:
Tomaae 2022-06-25 15:18:00 +02:00
parent 981668032e
commit e14d018b20
No known key found for this signature in database
GPG key ID: 8360BBD8A381D1C0
2 changed files with 23 additions and 0 deletions

View file

@ -1381,6 +1381,7 @@ class MikrotikControllerData:
{"name": "uptime_epoch", "default": 0},
{"name": "clients_wired", "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
# ---------------------------

View file

@ -286,6 +286,21 @@ SENSOR_TYPES = {
data_uid="",
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(
key="traffic_tx",
name="TX",