The LTAP can switch the Dual SIM when the RSSI was weakness?

Easy, I just modify my script for you, I apply your all suggestion and create one common script for your device and similar.
.

By the way,do you know APRS? I have a idea , send the /system/GPS info to the APRS network

I must read about that, it’s new for me.
I have few own idea too.

  1. This RB have GPS and if we can select direction to N and know where is BPS then this can help same one to move external antena into proper BPS Number from $isInfoBpsNo
  2. Create a CLI “monitor” just check the https://wiki.mikrotik.com/wiki/Manual:Spectral_scan
    .

For this,in my local, the ISP says the rsrp <105dBm was bad, for test easy

I think every one can change this arg by himself. We can create a first variable at script for global setting section.

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

Agree and I write second TODO in script about do a AVG (average) value from x time. This will be better then only one bad event. This is “Next stuff strategy”

{
# Setup and read current values, "up" SIM slot will be used for UNICOM, "down" for CM
:global simSlot [/system routerboard modem get sim-slot]
:global timeoutLTE 60
:global timeoutConnect 60

# Wait for LTE to initialize for maximum "timeoutLTE" seconds
:local i 0
:local isLTEinit false
:while ($i<$timeoutLTE) do={
    :foreach n in=[/interface lte find] do={:set $isLTEinit true}
    :if ($isLTEinit=true) do={
        :set $i $timeoutLTE
    }
    :set $i ($i+1)
    :delay 1s
}

# Check if LTE is initialized, or try power-reset the modem
:if ($isLTEinit=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
    }
    # Check if LTE is connected
    if ($isConnected=true) do={
        :local Info [/interface lte info [find name="lte1"] once as-value]
        :local isRsrp ($Info->"rsrp")
        :local isRssi ($Info->"rssi")
        :log info message="$Info"
        # Check which SIM slot is used
        :if ($simSlot="up") do={
            # If "up" (UNICOM) slot, check Rsrp or Rssi
            :if ($isRsrp<-105 | $isRssi<-110) do={
                :log info message="Rsrp less than -105dBm, switching to SIM DOWN (CM)"
                :system routerboard modem set sim-slot=down
            }
        } else={
            # Else "down" (CM) slot, check Rsrp or Rssi
            :if (!$isRsrp<-101 | $isRssi<-110) do={
                :log info message="Rsrp less than -101dBm, switching to SIM UP (UNICOM)"
                :system routerboard modem set sim-slot=up
            }
        }
    } else={
        :log info message="LTE interface did not connect to network, wait for next scheduler"
        :if ($simSlot="down") do={
            :log info message="DOWN slot No sim Switch simslot to Sim UP"
            :system routerboard modem set sim-slot=up
           } else={
            :log info message="UP slot No sim Switch simslot to Sim DOWN"
            :system routerboard modem set sim-slot=down
           }
    }
} else={
    :log info message="LTE modem did not appear, trying power-reset"
    :system routerboard usb power-reset duration=5s
}
}

This my modify script

I have a idea for the sim switch,get the gps speed info,if the speed <1km/h,mean the router was in floor/basement or tunnel ,dont need switch the sim,so its to disable the sim switch script Scheduler,when the speed>1.5km/h,enable the Scheduler

Your current version is easy to analyze. Work just after rsrp|rssi goes to wrong value. Current script works perfect OR change SIM-Slot in madness frequency ?
We can add some latency and average but without your feedback I don’t know if I can help with something or not.
Maybe script should monitor time of last change a sim-slot to not change to often.

Detail about script, The main section is long but this is fast to edit and you not must change this idea into function. My changes not change a current functionality

# Check if LTE is connected
if ($isConnected=true) do={
    :local Info [/interface lte info [find name="lte1"] once as-value]
    :local isRsrp ($Info->"rsrp")
    :local isRssi ($Info->"rssi")
    :log info message="$Info"
    # Check which SIM slot is used
    :if ($simSlot="up") do={
        # If "up" (UNICOM) slot, check Rsrp or Rssi
        :if ($isRsrp<-105 | $isRssi<-110) do={
            :log info message="Rsrp less than -105dBm, switching to SIM DOWN (CM)"
            :system routerboard modem set sim-slot=down
        }
    } else={
        # Else "down" (CM) slot, check Rsrp or Rssi
        :if (!$isRsrp<-101 | $isRssi<-110) do={
            :log info message="Rsrp less than -101dBm, switching to SIM UP (UNICOM)"
            :system routerboard modem set sim-slot=up
        }
    }
} else={
    :log info message="LTE interface did not connect to network, wait for next scheduler"
    :if ($simSlot="down") do={
        :log info message="DOWN slot No sim Switch simslot to Sim UP"
        :system routerboard modem set sim-slot=up
       } else={
        :log info message="UP slot No sim Switch simslot to Sim DOWN"
        :system routerboard modem set sim-slot=down
       }
}

FINAL SCRIPT: My version is :

  # 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
}

Why you resign from /system routerboard usb power-reset duration=5s and do just change sim-slot ?
Maybe this part should be like… if (“up” no connect in 60s) then (switch to “down”) and if (still not connection) then re-power. This “way of working” must use a Function, FailCounters, FailRePowerCounters. Just my thinking about do safe situation and be sure just RB have a own LTE_WatchDog checking internet in loop.

Please put result of:

put [/interface lte get lte1 band]

or maybe this info is at WinBox > Interfaces > LTE > lte1 > General or Status tab.
Cell-Monitor exist to search band/cell@BTS but maybe you know how to check current used band without at-chat ?

About GPS. We can use two script who will be cooperate by global variable. Fist we must check how to grab a speed value. Then we can write about merging scripts.
I just guessing a cli command, please check and search a correct syntax:

put [/system gps monitor once as-value];
put ([/system gps monitor once as-value]->"speed");

When we have speed then simple script can do history adding value into array of last 10 cycles and do something what be trigger for change (or not) sim-slot operation. Or just disable/enable script from upper post’s.

Similar case with controlling a 5x LEDs at “LtAP KIT LTE” is at finish stage. Please look at ReleaseCandidate script/code based on function who short a code from 70 lines to 20. What exactly is your hardware

put [system routerboard get model ]

?
.

By the way,do you know APRS? I have a idea , send the /system/GPS info to the APRS network

I think this is case on other Post at forum. This is just grab gps values and upload it to other devices like RasberyPi etc. who will propagate your coordinate etc. Just mutch other stuff not related into LTE topic..

Your current version is easy to analyze. Work just after rsrp|rssi goes to wrong value. Current script works perfect OR change SIM-Slot in madness frequency ?

Its dont change sim-slot in madness frequency,the script was execute by Scheduler,usually set the Scheduler execute the script more the 90 seconds

We can add some latency and average but without your feedback I don’t know if I can help with something or not.
Maybe script should monitor time of last change a sim-slot to not change to often.

I think monitor/average/latency have a problem that maybe when change the sim-slot,the RSRP/RSSi maybe bad which the sim-slot change to,like the script change the sim-slot when the RSRP/RSSI was bad at once,so I think the monitor…etc function not necessary at now


Why you resign from /system routerboard usb power-reset duration=5s and do just change sim-slot ?
Maybe this part should be like… if (“up” no connect in 60s) then (switch to “down”) and if (still not connection) then re-power. This “way of working” must use a Function, FailCounters, FailRePowerCounters. Just my thinking about do safe situation and be sure just RB have a own LTE_WatchDog checking internet in loop.

“…duration=5s”,this used for the usb power ,the mean is ROS dont detected the LTE module or dongle,not the LTE dont init or not run, and this function not change sim-slot,its simple to reset the usb power;the".....slot No sim Switch simslot to Sim....."is not for this ,its for maybe the one of sim-slot have no sim before LTE run

Please put result of:

put [/interface lte get lte1 band]

or maybe this info is at WinBox > Interfaces > LTE > lte1 > General or Status tab.
Cell-Monitor exist to search band/cell@BTS but maybe you know how to check current used band without at-chat ?

"get band…"cant get anything,maybe my LTE module dont support this function,and Cell-Monitor like this

About GPS. We can use two script who will be cooperate by global variable. Fist we must check how to grab a speed value. Then we can write about merging scripts.
I just guessing a cli command, please check and search a correct syntax:

put [/system gps monitor once as-value];
put ([/system gps monitor once as-value]->"speed");

When we have speed then simple script can do history adding value into array of last 10 cycles and do something what be trigger for change (or not) sim-slot operation. Or just disable/enable script from upper post’s.

I will test

Thanks for your relay!

Its dont change sim-slot in madness frequency,the script was execute by Scheduler,usually set the Scheduler execute the script more the 90 seconds

My LTE change his RSRP in small range and if you have the same, then this 90 second is good. How often is sim changed? Few hour, Few days ?


I think monitor/average/latency have a problem that maybe when change the sim-slot,the RSRP/RSSi maybe bad which the sim-slot change to,like the script change the sim-slot when the RSRP/RSSI was bad at once

In my LTE after change band I must wait 1m to stable signal.. and then I check parameters. Scheduler can change his “Next run” by example:

system scheduler set NameOfScheduler start-time=([/system clock get time]+1m)

.

,so I think the monitor…etc function not necessary at now

This give me info, currently script works very well. It’s ok.
.

t`s for maybe the one of sim-slot have no sim before LTE run

.
Rather, when sim card’s are present and no one is registered in network then do power reset. I don’t know what author have in mind if (s)he think about other purpose.
.

"get band…"cant get anything,maybe my LTE module dont support this function,and Cell-Monitor like this

Anything here:
Screenshot_14.jpg

Its dont change sim-slot in madness frequency,the script was execute by Scheduler,usually set the Scheduler execute the script more the 90 seconds

My LTE change his RSRP in small range and if you have the same, then this 90 second is good. How often is sim changed? Few hour, Few days ?

“How often…",need time to test.the routerboard was in my home,the rsrp was very stable,so not change by script in few days.

I think monitor/average/latency have a problem that maybe when change the sim-slot,the RSRP/RSSi maybe bad which the sim-slot change to,like the script change the sim-slot when the RSRP/RSSI was bad at once

In my LTE after change band I must wait 1m to stable signal.. and then I check parameters. Scheduler can change his “Next run” by example:

system scheduler set NameOfScheduler start-time=([/system clock get time]+1m)

Thanks,I will test this script,I think my LTE module EC20 don`t support the manual select the band,the interface/lte like your post picture ,but “band” have nothing to choice

,so I think the monitor…etc function not necessary at now

This give me info, currently script works very well. It’s ok.
.

t`s for maybe the one of sim-slot have no sim before LTE run

.
Rather, when sim card’s are present and no one is registered in network then do power reset. I don’t know what author have in mind if (s)he think about other purpose.

.I means the ”…power reset …“ its not used for when no sim registered in network ,If no sim registered in network ,the script will change sim-slot,not do ".......power reset...",its only execute when “$isLTEinit=false” ,the “$isLTEinit=false” mean you will don`t see ”LTE" in /interface,if “$isLTEinit=ture”,you can see “LTE” in /interface. maybe some LTE module need “…power reset…” to work

"get band…"cant get anything,maybe my LTE module dont support this function,and Cell-Monitor like this

Anything here:
Screenshot_14.jpg

The interface/lte like your post picture ,but “band” have nothing to choice

I found the YT clip with show the full settings with band. Mikrotik SXT LTE v2 Dual SIM & Band Select

the lte module in video is “r11e lte“,it’s made by mikrotik, so can support the band select function, many other brand can’t support

Quectel_EC20_AT_Commands_Manual
and manual at-chat
4.3.6. AT+QCFG=“band” Band Configuration
6.9. AT+QNWINFO Query Network Information

Just say.

thanks,the band change usually was automatically, why do you need manual change/lock the band ?

This is offtopic with band.
This is easy as reason why to lock into band. If you not live in city then you have some distance to tower. Slow quality of signal like 0/5 or 1/5 from progress bar.
In this situation you discover that 800/900 band is slower but works better at distance like in my scenario.

On most modems the selective LTE or 3G or LTE>3G is max of selection. When you can select band then you discover properly speed per each band and you can choose a proper.
My situation as offtipic is described in viewtopic.php?f=9&t=151036#p747828 and this is good example why use Band and be aweare or them.

My college in city say, same times internet is extreme speed like 90/40Mb and some times 13/3 but he have the “LTE only”. I write him a custom firmware to his Huawei USB LTE modem and we choose and save only one band at LTE. Now he always have very speed. Without any external antenna.

ok,I can understand now,in my local,FTTH was popular, not many user
use the LTE as home network, and the mobile ISP service was good, so the manual band select was not necessary.