-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetSignalStrengh.txt
47 lines (47 loc) · 1.42 KB
/
getSignalStrengh.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#params
:local pppClientName [/interface ppp-client get 0 name];
:local minSignalStrengh -50;
/interface ppp-client info $pppClientName do={
:if ([:len $"access-technology"] > 0 ) do={
:global lte $"access-technology";
:global signalstrenghString $"signal-strengh";
:global signalstrengh [:tonum [:pick $signalstrenghString 0 4]];
:if ([:typeof $signalstrengh] = "nil") do={
:set $signalstrengh [:tonum [:pick $signalstrenghString 0 3]];
}
#no information
:if ([:typeof $signalstrengh] = "nil") do={
:set $signalstrengh -300;
}
:global itog ($lte." ".$signalstrengh);
:log warn $itog;
#
:global ledSignal (-(($signalstrengh - $minSignalStrengh) / 5));
:if (($ledSignal - 8) >= 0) do={
/system leds set [find where leds="led4"] type=on;
:set $ledSignal ($ledSignal - 8);
} else={
/system leds set [find where leds="led4"] type=off;
}
:if (($ledSignal - 4) >= 0) do={
/system leds set [find where leds="led3"] type=on;
:set $ledSignal ($ledSignal - 4);
} else={
/system leds set [find where leds="led3"] type=off;
}
:if (($ledSignal - 2) >= 0) do={
/system leds set [find where leds="led2"] type=on;
:set $ledSignal ($ledSignal - 2);
} else={
/system leds set [find where leds="led2"] type=off;
}
:if (($ledSignal - 1) >= 0) do={
/system leds set [find where leds="led1"] type=on;
:set $ledSignal ($ledSignal - 1);
} else={
/system leds set [find where leds="led1"] type=off;
}
#exit from script. mikrotik bug: if no quit will be infinity loop
:quit;
}
}