mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-18 01:34:24 +02:00
Modified kid-control switches to block/unblock traffic #70
This commit is contained in:
parent
1bdd8e81f6
commit
7dc9120b19
3 changed files with 80 additions and 6 deletions
|
@ -722,6 +722,11 @@ class MikrotikControllerKidcontrolSwitch(MikrotikControllerSwitch):
|
|||
"""Initialize."""
|
||||
super().__init__(inst, uid, mikrotik_controller, sid_data)
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if device is on."""
|
||||
return self._data["paused"]
|
||||
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
"""Return the icon."""
|
||||
|
@ -756,9 +761,8 @@ class MikrotikControllerKidcontrolSwitch(MikrotikControllerSwitch):
|
|||
path = "/ip/kid-control"
|
||||
param = "name"
|
||||
value = self._data["name"]
|
||||
mod_param = "disabled"
|
||||
mod_value = False
|
||||
self._ctrl.set_value(path, param, value, mod_param, mod_value)
|
||||
command = "resume"
|
||||
self._ctrl.execute(path, command, param, value)
|
||||
await self._ctrl.force_update()
|
||||
|
||||
async def async_turn_off(self) -> None:
|
||||
|
@ -766,7 +770,6 @@ class MikrotikControllerKidcontrolSwitch(MikrotikControllerSwitch):
|
|||
path = "/ip/kid-control"
|
||||
param = "name"
|
||||
value = self._data["name"]
|
||||
mod_param = "disabled"
|
||||
mod_value = True
|
||||
self._ctrl.set_value(path, param, value, mod_param, mod_value)
|
||||
command = "pause"
|
||||
self._ctrl.execute(path, command, param, value)
|
||||
await self._ctrl.async_update()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue