node-red-contrib / node-red-contrib-mikrotik

Node-red node to work with Mikrotik WiFi router
ISC License
15 stars 14 forks source link

Can't execute script via API #47

Closed sanyafifa closed 2 years ago

sanyafifa commented 3 years ago

Hi! I was unable to run the script through the API. I did it according to your example. On the router, I see that the counter is increasing, but nothing is working

{
    "command": [
        "/system/script/run",
        "=.id=*3"
    ]
}

image

The script works through the console :)

0nikola1 commented 2 years ago

Hi, I just tested triggering script based on

 [{"id":"8e2678a6.f69328","type":"mikrotik","z":"589710b8.068a1","device":"","name":"","action":"9","command":"","command-type":"json","x":680,"y":300,"wires":[["bc37181f.696488"]]},{"id":"bc37181f.696488","type":"debug","z":"589710b8.068a1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":850,"y":300,"wires":[]},{"id":"aee77086.2d473","type":"change","z":"589710b8.068a1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":[\"/system/script/run\",\"=.id=script1\"]}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":300,"wires":[["8e2678a6.f69328","ef03c632.c297d8"]]},{"id":"c5467461.d3301","type":"inject","z":"589710b8.068a1","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":300,"wires":[["aee77086.2d473"]]}]

and it works for me on CHR v6.49. Which device are you using and which version of OS? Edit: Tested on Hex, hAP lite and hAP ac with v6.49 and it works on all of them

konne commented 2 years ago

@sanyafifa if you still have an issue please reopen.

sanyafifa commented 2 years ago

and it works for me on CHR v6.49. Which device are you using and which version of OS?

Hi!! HAP AC Lite CHR 7.1.1

I see that the counter is increasing, but nothing is working

:( the problem hasn't changed my script -- image