Community discussions

MikroTik App
 
fkpk6
just joined
Topic Author
Posts: 1
Joined: Tue Sep 14, 2021 8:19 am

HELP SXT LTE6 Kit Automatic SIM Switching

Tue Sep 14, 2021 10:50 am

I can't understand why the script for connecting a SIM card does not work. I took the official script Dual SIM Application as a basis and replaced down up with a.b, I don't have up and down in the settings.
Help please people are kind
{
# Setup and read current values
: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=false) do={
	# Check which SIM slot is used
        :if ($simSlot="a") do={
            # If "down" slot, switch to up
	    :log info message="LTE down, switching slot to UP"
	    /system routerboard modem set sim-slot=b
    }
        :if ($simSlot="b") do={
            # If "up" slot, switch to down
	    :log info message="LTE down, switching slot to DOWN"
	    /system routerboard modem set sim-slot=a
            }
        } else={
            # Else "running"
            :if ($isConnected=true) do={
                :log info message="LTE UP"
            }
        }
    } else={
        :log info message="LTE interface did not connect to network, wait for next scheduler"
    }
} else={
    :log info message="LTE modem did not appear, trying power-reset"
    /system routerboard usb power-reset duration=5s
}
}
 
User avatar
SiB
Forum Guru
Forum Guru
Posts: 1888
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: HELP SXT LTE6 Kit Automatic SIM Switching

Fri Sep 17, 2021 2:51 pm

This script do many stuff and the latest RouterOS have litle differ syntax. Means this script should be updated... .
What you want do in final situation ?

I not like this script becase you can not have internet and the lte1 can be still Running, then it not switch to other sim card.
Check my KB at signature.

Who is online

Users browsing this forum: Google [Bot], nocivo and 19 guests