mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-29 20:14:30 +02:00
Implemented kid-control #70
This commit is contained in:
parent
7379199d40
commit
9b4a9f8252
3 changed files with 116 additions and 10 deletions
|
@ -80,6 +80,7 @@ class MikrotikControllerData:
|
|||
"bridge_host": {},
|
||||
"arp": {},
|
||||
"nat": {},
|
||||
"kid-control": {},
|
||||
"mangle": {},
|
||||
"ppp_secret": {},
|
||||
"ppp_active": {},
|
||||
|
@ -525,6 +526,9 @@ class MikrotikControllerData:
|
|||
if self.api.connected() and self.option_sensor_nat:
|
||||
await self.hass.async_add_executor_job(self.get_nat)
|
||||
|
||||
if self.api.connected() and self.option_sensor_kidcontrol:
|
||||
await self.hass.async_add_executor_job(self.get_kidcontrol)
|
||||
|
||||
if self.api.connected() and self.option_sensor_mangle:
|
||||
await self.hass.async_add_executor_job(self.get_mangle)
|
||||
|
||||
|
@ -878,6 +882,35 @@ class MikrotikControllerData:
|
|||
|
||||
del self.data["mangle"][uid]
|
||||
|
||||
# ---------------------------
|
||||
# get_kidcontrol
|
||||
# ---------------------------
|
||||
def get_kidcontrol(self):
|
||||
"""Get Kid-control data from Mikrotik"""
|
||||
self.data["kid-control"] = parse_api(
|
||||
data=self.data["kid-control"],
|
||||
source=self.api.path("/ip/kid-control"),
|
||||
key="name",
|
||||
vals=[
|
||||
{"name": "name"},
|
||||
{"name": "rate-limit"},
|
||||
{"name": "mon", "default": "None"},
|
||||
{"name": "tue", "default": "None"},
|
||||
{"name": "wed", "default": "None"},
|
||||
{"name": "thu", "default": "None"},
|
||||
{"name": "fri", "default": "None"},
|
||||
{"name": "sat", "default": "None"},
|
||||
{"name": "sun", "default": "None"},
|
||||
{"name": "comment"},
|
||||
{
|
||||
"name": "enabled",
|
||||
"source": "disabled",
|
||||
"type": "bool",
|
||||
"reverse": True,
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
# ---------------------------
|
||||
# get_ppp
|
||||
# ---------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue