Community discussions

 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 1310
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Using Wifi or User led to show signal strength

Wed Nov 28, 2018 3:20 pm

I have some router that are used as a repeater (wifi to ethernet)
To be able to see the signal strength without needing to log inn to web gui / winbox etc, I have made a script.

It test signal strengt on first wifi client and blinks the led to show signal strengt.
Less blink are better than many so

-30 dBm = 3 blink
-63 dBm = 6 blink
Last blink is longer to show that its at the end.

Scripts should run for ever or until you change global value runLoop to false.

But there are some bugs with it.
When I start it with a client connected it runs fine.
Stop the client and no more blink.
But turn on the client again and i do not get any blink.
IF I do run this command it will work again
/interface wireless registration-table print stats
Any suggestion are welcome :)
:global runLoop true
: do {
	: do {
		: local a [/interface wireless registration-table get value-name=signal-strength 0]
		: local loop ([:pick ([:pick $a 0 [:find $a "dBm"]]/10) 1]-0)
		: if ([:len $a] = 0) do={
			} else={
			: for e from 1 to $loop do={
				/system leds set [find where leds="wlan-led" ] type=off
				:delay 500ms
				/system leds set [find where leds="wlan-led" ] type=on
				:delay 500ms
				}
			}
		:delay 1s
		/system leds set [find where leds="wlan-led" ] type=off  
		:delay 2s
		} on-error={}
	} while=($runLoop)
To run it for terminal add { } before and after script and copy it inn to the router.
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
User avatar
eworm
Member
Member
Posts: 403
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Using Wifi or User led to show signal strength

Fri Dec 14, 2018 1:23 am

But there are some bugs with it.
When I start it with a client connected it runs fine.
Stop the client and no more blink.
But turn on the client again and i do not get any blink.
IF I do run this command it will work again
/interface wireless registration-table print stats
Never ever use item index in script! :roll:
Any suggestion are welcome :)
How about this?
[...]
: local a [/interface wireless registration-table get value-name=signal-strength [ :pick [ find ] 0 ] ]
[...]
Alternatively use a real condition if available.
[...]
: local a [/interface wireless registration-table get value-name=signal-strength [ find where mac-address=00:11:22:33:44:55 ] ]
[...]
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 1310
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Using Wifi or User led to show signal strength

Fri Dec 14, 2018 8:24 am

[...]
: local a [/interface wireless registration-table get value-name=signal-strength [ find where mac-address=00:11:22:33:44:55 ] ]
[...]
I will test it out, but then you also have to manually find the mac of the link and edit the script.
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
User avatar
eworm
Member
Member
Posts: 403
Joined: Wed Oct 22, 2014 9:23 am
Location: Oberhausen, Germany
Contact:

Re: Using Wifi or User led to show signal strength

Fri Dec 14, 2018 8:32 am

[...]
: local a [/interface wireless registration-table get value-name=signal-strength [ find where mac-address=00:11:22:33:44:55 ] ]
[...]
I will test it out, but then you also have to manually find the mac of the link and edit the script.
If MAC address changes because it is not always the same client use my first code snippet.
Manage RouterOS scripts and extend your devices' functionality: RouterOS Scripts
 
pe1chl
Forum Guru
Forum Guru
Posts: 5923
Joined: Mon Jun 08, 2015 12:09 pm

Re: Using Wifi or User led to show signal strength

Sun Aug 11, 2019 11:58 am

Doesn't such a script incur a lot of flash writes because every '/system leds set [find where leds="wlan-led" ] type=' command is not only controlling the LED state but is also being saved as a new configuration state that is supposed to survive reboot?
When you do led blinking that way it could wear the flash memory.

There should be some LED control command that is not part of configuration...
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 1310
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Using Wifi or User led to show signal strength

Sun Aug 11, 2019 12:06 pm

I haven't thought about that, but can see that it not an optimal solution if that is the case.
Possible some from MT can give a respond on this ..
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 
 
pe1chl
Forum Guru
Forum Guru
Posts: 5923
Joined: Mon Jun 08, 2015 12:09 pm

Re: Using Wifi or User led to show signal strength

Sun Aug 11, 2019 1:59 pm

I think there should be a new type of LED control like type=soft or similar, where the LED is controlled by a software/script command that can turn it on or off (or maybe even send a programmed blinking sequence repeatedly) but that is not saved as part of the configuration.
So in the configuration only the type=soft is stored, and then you can do something like:
/system leds control [find where leds="wlan-led" ] on
/system leds control [find where leds="wlan-led" ] off
/system leds control [find where leds="wlan-led" ] blink
/system leds control [find where leds="wlan-led" ] pattern="...-"
This "control" command only controls the LED from the time it has been issued in a running router (usually from a script), but would not be saved in flash.
 
User avatar
Jotne
Forum Guru
Forum Guru
Topic Author
Posts: 1310
Joined: Sat Dec 24, 2016 11:17 am
Location: jo.overland at gmail.com

Re: Using Wifi or User led to show signal strength

Mon Aug 19, 2019 8:27 am

Agree. Hopefulle MT reads this post and add it to their train :)
 
How to use Splunk to monitor your MikroTik Router

MikroTik->Splunk
 

Who is online

Users browsing this forum: No registered users and 15 guests