diff --git a/custom_components/mikrotik_router/mikrotik_controller.py b/custom_components/mikrotik_router/mikrotik_controller.py index 41bc38b..cdea899 100644 --- a/custom_components/mikrotik_router/mikrotik_controller.py +++ b/custom_components/mikrotik_router/mikrotik_controller.py @@ -387,9 +387,9 @@ class MikrotikControllerData: # --------------------------- # execute # --------------------------- - def execute(self, path, command, param, value): + def execute(self, path, command, param, value, attributes=None): """Change value using Mikrotik API""" - return self.api.execute(path, command, param, value) + return self.api.execute(path, command, param, value, attributes) # --------------------------- # run_script @@ -1544,7 +1544,7 @@ class MikrotikControllerData: ): return - self.execute("/system/package/update", "check-for-updates", None, None) + self.execute("/system/package/update", "check-for-updates", None, None, {"duration": 10}) self.data["fw-update"] = parse_api( data=self.data["fw-update"], source=self.api.query("/system/package/update"), diff --git a/custom_components/mikrotik_router/mikrotikapi.py b/custom_components/mikrotik_router/mikrotikapi.py index 2732218..791110d 100644 --- a/custom_components/mikrotik_router/mikrotikapi.py +++ b/custom_components/mikrotik_router/mikrotikapi.py @@ -258,7 +258,7 @@ class MikrotikAPI: # --------------------------- # execute # --------------------------- - def execute(self, path, command, param, value) -> bool: + def execute(self, path, command, param, value, attributes=None) -> bool: """Execute a command""" entry_found = None params = {} @@ -292,6 +292,9 @@ class MikrotikAPI: params = {".id": entry_found} + if attributes: + params.update(attributes) + self.lock.acquire() try: tuple(response(command, **params))