mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-23 01:08:55 +02:00
added update value for mikrotik api
This commit is contained in:
parent
a4c4b344b7
commit
a3e6e5692b
2 changed files with 28 additions and 0 deletions
|
@ -116,3 +116,25 @@ class MikrotikAPI:
|
|||
return None
|
||||
|
||||
return response if response else None
|
||||
|
||||
# ---------------------------
|
||||
# update
|
||||
# ---------------------------
|
||||
def update(self, path, param, value, mod_param, mod_value):
|
||||
response = self.path(path)
|
||||
if response is None:
|
||||
return False
|
||||
|
||||
for tmp in response:
|
||||
if param not in tmp:
|
||||
continue
|
||||
|
||||
if tmp[param] != value:
|
||||
continue
|
||||
|
||||
params = {
|
||||
'.id': tmp['.id'],
|
||||
mod_param: mod_value
|
||||
}
|
||||
|
||||
return response.update(**params)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue