mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-06-26 18:58:54 +02:00
added option to specify router name for services
This commit is contained in:
parent
4e66101038
commit
7d0a614a86
3 changed files with 17 additions and 5 deletions
|
@ -194,8 +194,16 @@ class MikrotikControllerData:
|
|||
def run_script(self, name):
|
||||
"""Run script using Mikrotik API"""
|
||||
if type(name) != str:
|
||||
if CONF_NAME in name.data:
|
||||
name = name.data.get(CONF_NAME)
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue