mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-24 17:58:47 +02:00
added run script switches
This commit is contained in:
parent
0c5048160f
commit
42c95e78a6
3 changed files with 142 additions and 3 deletions
|
@ -137,4 +137,26 @@ class MikrotikAPI:
|
|||
mod_param: mod_value
|
||||
}
|
||||
|
||||
return response.update(**params)
|
||||
response.update(**params)
|
||||
|
||||
return True
|
||||
|
||||
# ---------------------------
|
||||
# run_script
|
||||
# ---------------------------
|
||||
def run_script(self, name):
|
||||
response = self.path('/system/script')
|
||||
if response is None:
|
||||
return False
|
||||
|
||||
for tmp in response:
|
||||
if 'name' not in tmp:
|
||||
continue
|
||||
|
||||
if tmp['name'] != name:
|
||||
continue
|
||||
|
||||
run = response('run', **{'.id': tmp['.id']})
|
||||
tuple(run)
|
||||
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue