Community discussions

MikroTik App
 
msatter
Forum Guru
Forum Guru
Topic Author
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

[ API ] NodeRed (Javascript)

Fri May 20, 2022 2:55 pm

I am using NodeRed for the solar panels and it is very flexible. I connect to the solar panels inverter with a CAP lite and sometimes the WiFi connection fail. To restore the connection I use NodeRed.

There is NodeRed node for Mikrotik devices and using it was a difficult start because of the spare information how to use it.

To restart a connection I need first to need the know the .id of the wlan1, this because you can only address a specifik connection by the .id or numbers
contribution removed

Now I have the .id of wlan1 and can use it in a second function node:
contribution removed

Node Red is mainly graphical orientated so this how it looks and on the right you can see the debug output showing the second command.

contribution removed

The Mikrotik Node is available in palette in Node Red and the direct link is: https://flows.nodered.org/node/node-red ... b-mikrotik

Update: the command "=.proplist=.id" does not seem to do anything. Luckily NodeRed can address the values swiftly like msg.payload[0].disabled get false or true if a interface is active or not.

Update: proplist works and I have added it again to the code example
Last edited by msatter on Sat Jun 11, 2022 1:57 pm, edited 13 times in total.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: [ API ] NodeRed (Javascript)

Fri May 20, 2022 3:12 pm

CAn you simply send a command like:

"/interface/wireless/disable [find]"

"/interface/wireless/enable [find]"

???

The CAP lite have only one unique wlan
 
msatter
Forum Guru
Forum Guru
Topic Author
Posts: 2897
Joined: Tue Feb 18, 2014 12:56 am
Location: Netherlands / Nīderlande

Re: [ API ] NodeRed (Javascript)

Sun May 22, 2022 2:16 pm

Some more ready to use NodeJS can be found here: https://github.com/aluisiora

It is not specific written for NodeRed but nice examples and it is looking for someone who continue the development.

Who is online

Users browsing this forum: No registered users and 19 guests