Community discussions

 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Tue Aug 27, 2019 12:00 pm

Hello everyone!
My LTAP ROS version was 6.45.3,and in my local the ISP don`t support Roaming,So i need switch the SIM when the RSSI was weakness(for example,the UP sim was online.if the RSSI <91dbm,run the script to switch the SIM to DOWM sim) ,how to modify the Dual SIM script to work at this mode?thanks!
{
# Setup and read current values, "up" SIM slot will be used for roaming, "down" for home network
: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 isRoaming ($Info->"roaming")
        # Check which SIM slot is used
        :if ($simSlot="down") do={
            # If "down" (home) slot, check roaming status
            :if ($isRoaming=true) do={
                :log info message="Roaming detected, switching to SIM UP (Roaming)"
                /system routerboard modem set sim-slot=up
            }
        } else={
            # Else "up" (roaming) slot, check roaming status
            :if (!$isRoaming=true) do={
                :log info message="Not roaming, switching to SIM DOWN (Home)"
                /system routerboard modem set sim-slot=down
            }
        }
    } 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
}
}
Last edited by krisjanisj on Tue Aug 27, 2019 12:01 pm, edited 1 time in total.
Reason: Please post configs/code in [code] blocks to save peoples scroll wheels
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Tue Aug 27, 2019 1:25 pm

It's hard, I check all your script to find your idea to solve problem.
You not have any part of script to grab RSSI. If you provide proper some "/... print detailed" or with as-value print then I can understand what parameter lookup and give you a hint.
For now I must say thay I haven't any LTAP and I use Huawei USB LTE modems, works as router itself (Hi.Link), with custom firmware who can change LTE Band.
Image
You can change LTE Band?
Then I don't know parameters with RSSI for your scenario.

More data from you must be provided
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Tue Aug 27, 2019 2:25 pm

It's hard, I check all your script to find your idea to solve problem.
You not have any part of script to grab RSSI. If you provide proper some "/... print detailed" or with as-value print then I can understand what parameter lookup and give you a hint.
For now I must say thay I haven't any LTAP and I use Huawei USB LTE modems, works as router itself (Hi.Link), with custom firmware who can change LTE Band.
Image
You can change LTE Band?
Then I don't know parameters with RSSI for your scenario.

More data from you must be provided
/interface lte info [find name="lte1"] once as-value
this script can show the RSSI,
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Tue Aug 27, 2019 2:43 pm

[admin@MikroTik] > /interface lte info [find name="lte1"] once
pin-status: ok
registration-status: registered
functionality: full
manufacturer: Quectel
model: EC20F
revision: EC20CEFAGR06A10M4G
current-operator: MOBILE
lac: 9902
current-cellid: 177000798
enb-id: 693600
sector-id: 22
access-technology: Evolved 3G (LTE)
session-uptime: 30s
imei: 868704046700000
imsi: 460000642993005
earfcn: 40936
rssi: -57dBm
rsrp: -87dBm
rsrq: -11dB
sinr: 1dB
 
mkx
Forum Guru
Forum Guru
Posts: 2985
Joined: Thu Mar 03, 2016 10:23 pm

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

Tue Aug 27, 2019 3:51 pm

But, please, use RSRP for indication of signal strength ... RSSI includes also all the interference.
BR,
Metod
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Tue Aug 27, 2019 5:10 pm

Next,
I read https://wiki.mikrotik.com/wiki/Manual:Interface/LTE and https://wiki.mikrotik.com/wiki/Dual_SIM_Application

On some LTE MikroTik devices can be set specific LTE Band via AT command. This is important because you can select this who have a best speed in your region.
put [/interface lte get lte1 band ]
put [/interface lte get lte1 running ]
You can have both lte1 and lte2 running at the same time and select via script the MultiWan policy from just FialOver to many method to do it.

Easy way to reach "The LTAP can switch the Dual SIM when the RSSI was weakness?" is by:
# ? You must correct this: /local rsrp-lte1 [/interface lte get lte1 rsrp]; ?
local rsrp-lte1_v1 "-87dBm";
local rsrp-lte1_v2 [/pick $rsrp-lte1_v1 0 [/find $rsrp-lte1_v1 dBm]];
/if ($rsrp-lte1_v2 > -102) do={put "Disable weak lte1 "};
Better is change route and have possibility to check and wait until rsrp cameback to good signal.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 12:31 am

Next,
I read https://wiki.mikrotik.com/wiki/Manual:Interface/LTE and https://wiki.mikrotik.com/wiki/Dual_SIM_Application

On some LTE MikroTik devices can be set specific LTE Band via AT command. This is important because you can select this who have a best speed in your region.
put [/interface lte get lte1 band ]
put [/interface lte get lte1 running ]
You can have both lte1 and lte2 running at the same time and select via script the MultiWan policy from just FialOver to many method to do it.

Easy way to reach "The LTAP can switch the Dual SIM when the RSSI was weakness?" is by:
# ? You must correct this: /local rsrp-lte1 [/interface lte get lte1 rsrp]; ?
local rsrp-lte1_v1 "-87dBm";
local rsrp-lte1_v2 [/pick $rsrp-lte1_v1 0 [/find $rsrp-lte1_v1 dBm]];
/if ($rsrp-lte1_v2 > -102) do={put "Disable weak lte1 "};
Better is change route and have possibility to check and wait until rsrp cameback to good signal.
Thanks,I think your script is better for Dual LTE,but the Dual SIM mean is one LTE have Dual SIM like rbltap mini or ltap only have the bottom slot LTE,only one SIM online in same time.
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Wed Aug 28, 2019 12:41 am

If this is not DualSIM but SIM1 or SIM2 then in how way you select the active one? You cannot check the rsrp/rssi etc from non-used one?
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 12:42 am

But, please, use RSRP for indication of signal strength ... RSSI includes also all the interference.
Thanks,however use the rssi or rsrp,the script can't switch the
Sim.
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 12:59 am

If this is not DualSIM but SIM1 or SIM2 then in how way you select the active one? You cannot check the rsrp/rssi etc from non-used one?
In the script have script to active the one sim like" /system……up or down", and don't need check the non-used one's rsrp/rssi when the sim was non-used, simply switch to the non-used sim , wait the sim online, check the rsrp/rssi, if <xxdBm, switch back
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 1:07 am

Dual sim means the LTE have two Sim slot, but only one can active at same time.
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Wed Aug 28, 2019 1:34 am

some of new LTE MikroTik devices have even 3x SIM and only one can be active - not good.

How often you will be run this scheduler, every 1, 2, 3, 5 minutes interval?
Please confirm that
/system routerboard modem set sim-slot=up <- this activate sim1 and deactivate sim2
/system routerboard modem set sim-slot=down <- this activate sim2 because this is the last one
This works in this way ?

I ask because the in https://wiki.mikrotik.com/wiki/Manual:TOC I cannot found description of this options in /system routerboard modem
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 1:55 am

some of new LTE MikroTik devices have even 3x SIM and only one can be active - not good.

How often you will be run this scheduler, every 1, 2, 3, 5 minutes interval?
Please confirm that
/system routerboard modem set sim-slot=up <- this activate sim1 and deactivate sim2
/system routerboard modem set sim-slot=down <- this activate sim2 because this is the last one
This works in this way ?
Thanks!
Simply scheduler not good, I means if the rssi/rsrp was Good, not need to switch the sim slot .
the 3x sim means LTE 1 have sim slot 1st and 2nd, LTE2 have sim slot 3rd, LTE 1 and LTE 2 can work at same time, but Sim 1st or 2nd work on LTE 1
Was only one at same time
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Wed Aug 28, 2019 1:58 am

Too many stuff to discus and the forum is not best. If we can speak about it via Telegram, it's ok for you? .
When we finish the script then we publish his newer version here.
Last edited by SiB on Wed Aug 28, 2019 2:18 am, edited 1 time in total.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 2:05 am


I ask because the in https://wiki.mikrotik.com/wiki/Manual:TOC I cannot found description of this options in /system routerboard modem
In this https://wiki.mikrotik.com/wiki/Dual_SIM_Application
For old Ros version, the "modem" was "sim", so in this URL,it was /system routerboard Sim .
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Wed Aug 28, 2019 2:16 am

For old Ros version, the "modem" was "sim", so in this URL,it was /system routerboard Sim .
You write about CLI. The url in wiki not have article who describe a property of parameters in /system routerboard modem.
Simply scheduler not good, I means if the rssi/rsrp was Good, not need to switch the sim slot .
Not agree. Scheduler can run every 4 minutes and check the state of running currently lte, rssi, rsrp etc. and do some action. This is fixing loop running every 4 minutes and we must have sure that our delay and inscript actions finish before that time. This works like watchdog who check and fix.
/system routerboard modem set sim-slot=up <- this activate sim1 and deactivate sim2
/system routerboard modem set sim-slot=down <- this activate sim2 because this is the last one
This works in this way ?
Please confirm the command works in this way or not
# ? You must correct this: /local rsrp-lte1 [/interface lte get lte1 rsrp]; ?
You found a proper CLI to display via put the rsrp value ?
Thanks,however use the rssi or rsrp,the script can't switch the
Sim.
This was example, not solution. You must do checking because I have not any MikroTik LTE device and cannot check results of command.
I can do remote session to check this and then I will be have all stuff to rewrite main script but you must cooperate too.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 2:39 am

For old Ros version, the "modem" was "sim", so in this URL,it was /system routerboard Sim .
You write about CLI. The url in wiki not have article who describe a property of parameters in /system routerboard modem.
Simply scheduler not good, I means if the rssi/rsrp was Good, not need to switch the sim slot .
Not agree. Scheduler can run every 4 minutes and check the state of running currently lte, rssi, rsrp etc. and do some action. This is fixing loop running every 4 minutes and we must have sure that our delay and inscript actions finish before that time. This works like watchdog who check and fix.
/system routerboard modem set sim-slot=up <- this activate sim1 and deactivate sim2
/system routerboard modem set sim-slot=down <- this activate sim2 because this is the last one
This works in this way ?
Please confirm the command works in this way or not
# ? You must correct this: /local rsrp-lte1 [/interface lte get lte1 rsrp]; ?
You found a proper CLI to display via put the rsrp value ?
Thanks,however use the rssi or rsrp,the script can't switch the
Sim.
This was example, not solution. You must do checking because I have not any MikroTik LTE device and cannot check results of command.
I am sure /system……up/down was working
/Interface……rsrp I will test as soon as possible
By the way,in https://wiki.mikrotik.com/wiki/Dual_SIM_Application, the script run in /system script, not CLI
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 3:07 am

# ? You must correct this: /local rsrp-lte1 [/interface lte get lte1 rsrp]; ?
You found a proper CLI to display via put the rsrp value ?
Thanks,however use the rssi or rsrp,the script can't switch the
Sim.
This was example, not solution. You must do checking because I have not any MikroTik LTE device and cannot check results of command.
I can do remote session to check this and then I will be have all stuff to rewrite main script but you must cooperate too.
the "/interface lte get lte1 rsrp" not work,the " /interface lte info [find name="lte1"] once" can work and get rsrp/rssi
[admin@MikroTik] > /interface lte info [find name="lte1"] once
pin-status: ok
registration-status: registered
functionality: full
manufacturer: Quectel
model: EC20F
revision: EC20CEFAGR06A10M4G
current-operator: MOBILE
lac: 9902
current-cellid: 177000798
enb-id: 693600
sector-id: 22
access-technology: Evolved 3G (LTE)
session-uptime: 30s
imei: 868704046700000
imsi: 460000642993005
earfcn: 40936
rssi: -57dBm
rsrp: -87dBm
rsrq: -11dB
sinr: 1dB
 
User avatar
krafg
Member
Member
Posts: 313
Joined: Sun Jun 28, 2015 7:36 pm

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

Wed Aug 28, 2019 6:33 am

Also here I tried to get the RSRP and then do something:

viewtopic.php?f=9&t=151036

But I can't get results.

Anyway I also can help with some commands or scripting test.

EDIT:

Finally I can get the value and set it to a variable:
interface lte info lte1 once do={:global rsrp1 $"rsrp" ; :put $rsrp1}
Regards.
Image
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 12:52 pm

For many test,i think
the script " :local Info [/interface lte info [find name="lte1"] once as-value]
:local isRoaming ($Info->"roaming")
# Check which SIM slot is used
:if ($simSlot="down") do={
# If "down" (home) slot, check roaming status
:if ($isRoaming=true)"
is my problem.
What's happened when run "interface lte info [find name="lte1"] once as-value"?
Last edited by intensex on Wed Aug 28, 2019 3:51 pm, edited 1 time in total.
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Wed Aug 28, 2019 3:32 pm

Next,
I read https://wiki.mikrotik.com/wiki/Manual:Interface/LTE and https://wiki.mikrotik.com/wiki/Dual_SIM_Application

On some LTE MikroTik devices can be set specific LTE Band via AT command. This is important because you can select this who have a best speed in your region.
put [/interface lte get lte1 band ]
put [/interface lte get lte1 running ]
You can have both lte1 and lte2 running at the same time and select via script the MultiWan policy from just FialOver to many method to do it.

Easy way to reach "The LTAP can switch the Dual SIM when the RSSI was weakness?" is by:
# ? You must correct this: /local rsrp-lte1 [/interface lte get lte1 rsrp]; ?
local rsrp-lte1_v1 "-87dBm";
local rsrp-lte1_v2 [/pick $rsrp-lte1_v1 0 [/find $rsrp-lte1_v1 dBm]];
/if ($rsrp-lte1_v2 > -102) do={put "Disable weak lte1 "};
Better is change route and have possibility to check and wait until rsrp cameback to good signal.
the "[/interface lte get lte1 rsrp]"can`t get anything,only "[/interface lte info lte1 once]can display the information about rssi,rsrp.....etc
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Wed Aug 28, 2019 3:49 pm

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.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Wed Aug 28, 2019 11:27 pm

At viewtopic.php?f=9&t=151036&p=747232#p747232 is created script who check RSRP and base on value of rsrp put information and turn proper count of LED1..5 on RouterBoard.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 5:39 am

It was successded,because the "/interface lte info [find name="lte1"] once as-value",the info don`t have dBm after rsrp number,If use "$isRsrp<-105dBm",the script can`t switch the sim,change the "$isRsrp<-105dBm" to "$isRsrp<-105",the script will be run and switch the sim
Last edited by intensex on Thu Aug 29, 2019 10:11 am, edited 1 time in total.
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 9:09 am

Base on

Image
because I cannot do it at my RB ROS:
Screenshot_1.jpg
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};
You do not have the required permissions to view the files attached to this post.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 10:17 am

Base on

Image
because I cannot do it at my RB ROS:
Screenshot_1.jpg
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 can`t run because you don`t have interface "lte1".
the second script when I copy to CLI,it`s 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 don`t know what`s happened,when I fix the incorrect word,it was work good
Last edited by intensex on Thu Aug 29, 2019 10:42 am, edited 1 time in total.
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 10:41 am

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!.
Screenshot_4.jpg
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?
You do not have the required permissions to view the files attached to this post.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 10:48 am

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!.
Screenshot_4.jpg

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
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 11:03 am

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 viewtopic.php?f=9&t=151036#p747253 and check yourself the LED and printing.

Picture:
Screenshot_5.jpg
You do not have the required permissions to view the files attached to this post.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 11:22 am

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 viewtopic.php?f=9&t=151036#p747253 and check yourself the LED and printing.

Picture:
Screenshot_5.jpg
Image
You do not have the required permissions to view the files attached to this post.
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 11:31 am

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";
        }
      }
    }
  }
}

}
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 11:40 am

check this, only display in terminal, the /led settings are from other post:
{

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 ***
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 11:50 am

Many routerboard don`t have the LED1,LED2.....etc,if the routerboard have this LEDS,it`s can work and don`t need script like LTAP
ltap.PNG
You do not have the required permissions to view the files attached to this post.
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 11:58 am

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};
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 12:09 pm

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!
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 12:53 pm

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
}
}
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 1:22 pm

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
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 2:23 pm

When you paste a code please use this button
Screenshot_7.jpg
and paste your code between the code marks.
Screenshot_8.jpg
.

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
}
}
You do not have the required permissions to view the files attached to this post.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 3:12 pm

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
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Thu Aug 29, 2019 3:57 pm

"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
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Thu Aug 29, 2019 4:34 pm

I don't know which is better between your script and my modified.
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"
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Fri Aug 30, 2019 3:53 am

{
# 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
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Fri Aug 30, 2019 9:57 am

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 ,don`t need switch the sim,so it`s to disable the sim switch script Scheduler,when the speed>1.5km/h,enable the Scheduler
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Sat Aug 31, 2019 7:40 pm

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
       }
}
My version is witch:
  # 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..
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Mon Sep 02, 2019 3:31 am

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 ?

It`s don`t 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 don`t detected the LTE module or dongle,not the LTE don`t init or not run, and this function not change sim-slot,it`s simple to reset the usb power;the".....slot No sim Switch simslot to Sim....."is not for this ,it`s 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............"can`t get anything,maybe my LTE module don`t 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!
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Mon Sep 02, 2019 5:13 am

It`s don`t 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............"can`t get anything,maybe my LTE module don`t support this function,and Cell-Monitor like this
Anything here:
Screenshot_14.jpg
You do not have the required permissions to view the files attached to this post.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Mon Sep 02, 2019 12:35 pm

It`s don`t 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 ...“ it`s 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...",it`s 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............"can`t get anything,maybe my LTE module don`t 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
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Mon Sep 02, 2019 3:13 pm

I found the YT clip with show the full settings with band. Mikrotik SXT LTE v2 Dual SIM & Band Select
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Mon Sep 02, 2019 3:31 pm

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
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Mon Sep 02, 2019 4:26 pm

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.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Tue Sep 03, 2019 1:48 am

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 ?
 
User avatar
SiB
Member Candidate
Member Candidate
Posts: 178
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

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

Tue Sep 03, 2019 2:38 am

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.
MTCNA + MTCRE + MTCINE | ~600 users at ~150 RouterBoards in EMEA | Telegram: @SiB_PL | WebChat: Tokonda
WinBox Tip: F6 works as ALT+TAB | Gliffy.com - free network schematic | prnt.sc - free ScreenShot software
 
intensex
newbie
Topic Author
Posts: 33
Joined: Tue Aug 27, 2019 10:34 am

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

Tue Sep 03, 2019 8:14 am

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.

Who is online

Users browsing this forum: No registered users and 101 guests