mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-08-30 22:49:30 +02:00
Reworked scripts to buttons only, fixes #414
This commit is contained in:
parent
ee886e0365
commit
6487398741
5 changed files with 8 additions and 42 deletions
|
@ -64,7 +64,6 @@ from .const import (
|
|||
CONF_SENSOR_NETWATCH_TRACKER,
|
||||
DEFAULT_SENSOR_NETWATCH_TRACKER,
|
||||
)
|
||||
from .exceptions import ApiEntryNotFound
|
||||
from .apiparser import parse_api
|
||||
from .mikrotikapi import MikrotikAPI
|
||||
|
||||
|
@ -463,28 +462,6 @@ class MikrotikCoordinator(DataUpdateCoordinator[None]):
|
|||
"""Change value using Mikrotik API"""
|
||||
return self.api.execute(path, command, param, value, attributes)
|
||||
|
||||
# ---------------------------
|
||||
# run_script
|
||||
# ---------------------------
|
||||
def run_script(self, name):
|
||||
"""Run script using Mikrotik API"""
|
||||
if type(name) != str:
|
||||
if "router" not in name.data:
|
||||
return
|
||||
|
||||
if self.config_entry.data["name"] != name.data.get("router"):
|
||||
return
|
||||
|
||||
if "script" in name.data:
|
||||
name = name.data.get("script")
|
||||
else:
|
||||
return
|
||||
|
||||
try:
|
||||
self.api.run_script(name)
|
||||
except ApiEntryNotFound as error:
|
||||
_LOGGER.error("Failed to run script: %s", error)
|
||||
|
||||
# ---------------------------
|
||||
# get_capabilities
|
||||
# ---------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue