Does anyone have an example of a Mikrotik router

Hi,
I wonder if anyone out there can give me a syntax example of how to use the raw input to the node-red-contrib-mikrotik

For example how would I do the equivalent of
/ip firewall filter enable numbers=1

Have looked everywhere and found nothing so any help would be appreciated.

Thanks

Tom

1 Like

Looking at the github page:

This is an alfa verion. Available actions: log, resources, wifi, connections, reboot, raw.

1 Like

Hi,

In the documentation it seems to suggest that "Raw" will do it for me.... Am I missing something ?

  • Raw: uses msg.payload as command. To pass command with parametrs use JSON object with "command" property as msg.payload . For example: {"command":["/system/script/run","=.id=myscript"]} . This example runs script myscript

So I thought something like this wold work, but I can't get it to do so.

msg.payload='{"command":["/ip/firewall/filter/disable","numbers=1"]}.';

Regards

Tom

For anyone's future reference it's the following using the raw input

msg.payload=['/ip/firewall/filter/disable','=numbers=*1'];

1 Like

Hi, Would you mind posting a fully flow of how you have implemented this please as I have been trying unsuccessfully to implement this and I cannot seem to get the format correct ?

Thanks.

I managed to figure it out, for those searching for help like me, I put the details that tashbee provided into a Node Red Function block as follows.

msg.payload=['/ip/firewall/filter/disable','=.id=*Test'];
return msg;

Thanks tashbee

Hi, I put it in a change node (json) like this and this works well:

[
    "/ip/firewall/address-list/disable",
    "=numbers=*22"
]

Note this is for disabling list number 22 here in my case. Question I would have is how do you put multiple numbers into the same function, i.e. how could I disable let's say list 1 and 22?

Thank you for your contribution Friend!! Very enlightening!
Now in a similar scenario I need to disable the route based on the comment as I do via the command line (/ip route disable numbers=[find comment="WAN1"]) but I'm not getting it using the same logic (msg.payload=[ '/ip/route/disable','=numbers=[find comment="TST"]']:wink:
How can I fix this?;