the "[/interface lte get lte1 rsrp]"can`t get anything,only "[/interface lte info lte1 once]can display the information about rssi,rsrp…etc
I check and re-create the wiki script today. I put all this into one script running via scheduler.
Currently in work. Thanks for all feedback command’s.
My local time at: https://www.timeanddate.com/worldclock/poland/warsaw . After 19:00 I will be doing it and give write here to check it.
At http://forum.mikrotik.com/t/script-to-get-rsrp-and-then-do/132259/8 is created script who check RSRP and base on value of rsrp put information and turn proper count of LED1..5 on RouterBoard.
It was successded,because the “/interface lte info [find name=“lte1”] once as-value”,the info dont have dBm after rsrp number,If use "$isRsrp<-105dBm",the script cant switch the sim,change the “$isRsrp<-105dBm” to “$isRsrp<-105”,the script will be run and switch the sim
Base on

because I cannot do it at my RB ROS:
![]()
try do and print the same results like upper example all prints you have (I don’t do it bcs I not have this hardware ! and I not have a remote access to your PC to check all diagnostic parameter’s fast ).
Please provide results of:
put [/interface lte info lte1 once as-value]
put ([/interface lte info lte1 once as-value]->"rsrp")
Please confirm that every running this code will change a sim-slot to other one
if ([/system routerboard modem get sim-slot]="up") do={/system routerboard modem set sim-slot=down} else={/system routerboard modem set sim-slot=up};
Thanks,Your post script was run good in CLI,The first script you cant run because you dont have interface “lte1”.
the second script when I copy to CLI,its change to this " if ([/system stem routerboard modem get sim-slot]="up") do=o={/system routerboard modem set sim-slot=down} else={/system routerboard modem set sim-slot=up}",I dont know what`s happened,when I fix the incorrect word,it was work good
I write you before in 1st answer that I use USB LTE but not as modem but as router and I HAVENT GOT the INFO property!.

GIVE ME THIS RESULTS:
put [/interface lte info lte1 once as-value]
put ([/interface lte info lte1 once as-value]->"rsrp")
I must give you instruction how to do it?
[admin@MikroTik] > put [/interface lte info lte1 once as-value]
access-technology=Evolved 3G (LTE);current-cellid=93620003;current-operator=MOBILE;earfcn=30900;enb-id=300722;functionality=full;imei=860107044200059;imsi=460000642900045;lac=9002;manufacturer=Quectel;model=EC20F;pin-status=ok;registration-statu
s=registered;revision=EC20CEFHKGR06A03M2G;rsrp=-87;rsrq=-90;rssi=-57;sector-id=71;session-uptime=00:20:04;sinr=7
[admin@MikroTik] > put ([/interface lte info lte1 once as-value]->“rsrp”)
-86
[admin@MikroTik] >
I can only post the word because I don`t know how to post picture
Perfect, VERY THANKS, TEXT FORM is the best to me. I can just copy-paste.
Next post should be with a beta-script who will be to testing.
Please, copy to CLI this script=code from http://forum.mikrotik.com/t/script-to-get-rsrp-and-then-do/132259/1 and check yourself the LED and printing.
Picture:


check this, only display in terminal, the /led settings are from other post:
every running grab rsrp and display proper information.
{
local RsrpLte1 ([/interface lte info lte1 once as-value]->"rsrp");
put $RsrpLte1; # Now it is "-87" without dBm word
:if ($RsrpLte1 >= -80) do={
#/system leds set 1 leds=led1,led2,led3,led4,led5 type=on
put "5 Led *****";
} else={
:if (($RsrpLte1 <= -81) && ($RsrpLte1 >= -90)) do={
#/system leds set 1 leds=led1,led2,led3,led4 type=on
put "4 Led ****";
} else={
:if (($RsrpLte1 <= -91) && ($RsrpLte1 >= -100)) do={
#/system leds set 1 leds=led1,led2,led3 type=on
put "3 Led ***";
} else={
:if (($RsrpLte1 <= -101) && ($RsrpLte1 >= -110)) do={
#/system leds set 1 leds=led1,led2 type=on
put "2 Led **";
} else={
:if (($RsrpLte1 <= -111) && ($RsrpLte1 >= -120)) do={
#/system leds set 1 leds=led1 type=on
put "1 Led *"
} else={
#/system leds set 1 leds=led1,led2,led3,led4,led5 type=off;
put "- Led";
}
}
}
}
}
}
At the end
{… }
-84
4 Led ***
Many routerboard dont have the LED1,LED2.....etc,if the routerboard have this LEDS,its can work and don`t need script like LTAP

ok, I understand this but I not use the LED property, never. For me it’s not any usage in it. This is common part in scripting for you and for @krafg .
Currenty I work now in my main job. Additional try help with your and @krafg sctipts.
About the ltap1.rsc is like 85% progress. Just few stuff.
You still not give me feedback about this:
Please confirm that every running this code will change a sim-slot to other one
if ([/system routerboard modem get sim-slot]=“up”) do={/system routerboard modem set sim-slot=down} else={/system routerboard modem set sim-slot=up};
>
I post it at 26#,it`s work good in CLI.
by the way,the script from "https://wiki.mikrotik.com/wiki/Dual_SIM_Application"was working on my LTAP when I change something,Thanks for your help!
Wiki script not check rsrp and have other purpose.
Main JOB is to switch sim-slot when the ($InfoRsrp >= -103) is true.
Release Candidate version:
{
# TODO: run only if uptime is bigger then x minutes
# TODO: do switch lte-slot base on history last few value rsrp
:global timeoutLTE 60
:global timeoutConnect 60
# Wait for LTE to initialize for maximum "timeoutLTE" seconds
:global LteInitTime 0;
:local i 0
:local LteDetected false
:local result false
:while ($i<$timeoutLTE) do={
:set $i ($i+1)
:set $LteInitTime $i;
:foreach n in=[/interface lte find ] do={
# Disable LTE interface means the same like plug-in and initialized but not running.
:set $LteDetected true;
:set $i $timeoutLTE
}
:delay 1s
}
:if ($LteDetected=true) do={set $result "GOOD"} else={set $result "FAIL"};
:log info ("LTE initialize in ".$LteInitTime." seconds with ".$result);
# Check if LTE is initialized, or try power-reset the modem
:if ($LteDetected=true) do={
# Wait for LTE interface to connect to mobile network for maximum "timeoutConnet" seconds
:local isConnected false
:set $i 0
:while ($i<$timeoutConnect) do={
:if ([/interface lte get [find name="lte1"] running]=true) do={
:set $isConnected true
:set $i $timeoutConnect
}
:set $i ($i+1)
:delay 1s
}
# Change the LTE Slot when the RSRP is to bad.
if ($isConnected=true) do={
:local InfoRsrp ([/interface lte info [find name="lte1"] once as-value]->"rsrp")
:if ($InfoRsrp >= -103) do={
:log info "LTE modem is switch to other sim slot."
:if ([/system routerboard modem get sim-slot]="up") do={/system routerboard modem set sim-slot=down} else={/system routerboard modem set sim-slot=up};
}
}
} else={
:log info ("LTE modem did not appear in ".$LteInitTime."s, trying power-reset")
/system routerboard usb power-reset duration=5s
}
}
Yes,the original script can`t check the rsrp,so I modify the part of script like this
":local Info [/interface lte info [find name="lte1"] once as-value]
:local isRsrp ($Info->"rsrp")
:local isRssi ($Info->"rssi")
Check which SIM slot is used
:if ($simSlot="up") do={
If "up" (UNICOM) slot, check Rsrp or Rssi
:if ($isRsrp<-105 | $isRssi<-110) do={",
why I check the rssi?because in 3G mode don`t have rsrp
When you paste a code please use this button
![]()
and paste your code between the code marks.
![]()
.
When you modify and do a better script then please share your patch/fix and maybe MikroTik support import our idea into build-in function. Or other users can have a benefit from it.
Maybe this main job of script is better?
When rsrp or rssi are very bad then change active sim-slot?
:local isRsrp ([/interface lte info [find name="lte1"] once as-value]->"rsrp")
:local isRssi ([/interface lte info [find name="lte1"] once as-value]->"rssi")
:if ($isRsrp<-105 | $isRssi<-110) do={
:if ([/system routerboard modem get sim-slot]="up") do={/system routerboard modem set sim-slot=down} else={/system routerboard modem set sim-slot=up};
}
Full script Release Candidate with upper Main Job here:
{
# TODO: run only if uptime is bigger then x minutes
# TODO: do switch lte-slot base on history last few value rsrp
:local timeoutLTE 60
:local timeoutConnect 60
# Wait for LTE to initialize for maximum "timeoutLTE" seconds
:local LteInitTime 0;
:local i 0
:local LteDetected false
:local result false
:while ($i<$timeoutLTE) do={
:set $i ($i+1)
:set $LteInitTime $i;
:foreach n in=[/interface lte find ] do={
# Disable LTE interface means the same like plug-in and initialized but not running.
:set $LteDetected true;
:set $i $timeoutLTE
}
:delay 1s
}
:if ($LteDetected=true) do={set $result "GOOD"} else={set $result "FAIL"};
:log info ("LTE initialize in ".$LteInitTime." seconds with ".$result);
# Check if LTE is initialized, or try power-reset the modem
:if ($LteDetected=true) do={
# Wait for LTE interface to connect to mobile network for maximum "timeoutConnet" seconds
:local isConnected false
:set $i 0
:while ($i<$timeoutConnect) do={
:if ([/interface lte get [find name="lte1"] running]=true) do={
:set $isConnected true
:set $i $timeoutConnect
}
:set $i ($i+1)
:delay 1s
}
# Change the LTE Slot when the RSRP or RSSI is to too bad.
if ($isConnected=true) do={
:local isRsrp ([/interface lte info [find name="lte1"] once as-value]->"rsrp")
:local isRssi ([/interface lte info [find name="lte1"] once as-value]->"rssi")
:if ($isRsrp<-105 | $isRssi<-110) do={
:log info "LTE modem is switch to other sim slot."
:if ([/system routerboard modem get sim-slot]="up") do={/system routerboard modem set sim-slot=down} else={/system routerboard modem set sim-slot=up};
}
}
} else={
:log info ("LTE modem did not appear in ".$LteInitTime."s, trying power-reset")
/system routerboard usb power-reset duration=5s
}
}
I will post the script which my modified tomorrow, but I don’t know which is better between your script and my modified.
By the way,do you know APRS? I have a idea , send the /system/GPS info to the APRS network
“When rsrp or rssi are very bad then change active sim-slot?”
For this,in my local, the ISP says the rsrp <105dBm was bad, for test easy, I set it’s like that;and in car use, not usually to execute the script to switch the sim, because switch sim need more than 30 seconds and maybe the rsrp was good in a short time