Community discussions

MikroTik App
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Wed Mar 10, 2021 6:03 pm

Hi

Is it possible to fill a variable with the value of "interface/lte/cellular/Access Technology" in a LtAP Router for example ?
If yes, wath are the possible values like: LTE (CA2), Evolved 3G ...etc.

thx for help, Richard
 
User avatar
SiB
Forum Guru
Forum Guru
Posts: 1888
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Wed Mar 10, 2021 11:03 pm

Is it possible to fill a variable with the value of "interface/lte/cellular/Access Technology" in a LtAP Router for example ?
What you mean ?


If yes, wath are the possible values like: LTE (CA2), Evolved 3G ...etc.
Evolved 3G (LTE) -> you have a LTE connection.
LTE (CA2) -> you have a LTE connection with 2 Bands/Frequency as Carrier Aggregation.
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

Re: Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Thu Mar 11, 2021 12:40 pm

In a script i want to put the actual value of "Access Techbnolgy" in a global variable ... is this possible ?
 
User avatar
SiB
Forum Guru
Forum Guru
Posts: 1888
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Fri Mar 12, 2021 1:11 pm

Check first line of code of this:
Watch LTE parameters: viewtopic.php?f=7&t=155945&p=821262#p821047
 
roe1974
Member Candidate
Member Candidate
Topic Author
Posts: 151
Joined: Mon Dec 31, 2018 2:14 pm

Re: Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Fri Mar 12, 2021 3:09 pm

sorry i can't figure it out ... how must the line look like ? ;-)
 
User avatar
SiB
Forum Guru
Forum Guru
Posts: 1888
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Fri Mar 19, 2021 4:31 pm

In terminal:
RouterOS v6: put ([interface lte info lte1 once as-value ]->"access-technology")
RouterOS v7: put ([interface/lte/monitor lte1 once as-value ]->"access-technology")

and create a global variable for ros6:
global SiB_MyLTEAccTech ([/interface lte info lte1 once as-value ]->"access-technology") ;
 
LaZyLion
newbie
Posts: 32
Joined: Fri May 09, 2014 10:27 am

Re: Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Wed Apr 05, 2023 10:19 pm

Thank you Sib! This had been driving me crazy for over an hour.

For future me googling:
interface/lte/monitor lte1 once
will get you the list of available item names (called keys) and values.

To extract a specific key:
:put ([interface/lte/monitor lte1 once as-value ]->"imei")
or
:local lteStatus ([interface/lte/monitor lte1 once as-value ]->"status"); :put "Lte is $lteStatus";

When you using an "as-value" command from the help docs or forum posts, make sure the "value" is in the list.
On my chateaux 5G running v7.8, "access-technology" is not one of the available items.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12445
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

Thu Apr 06, 2023 11:51 am

Better to do something like this, works regardless if it's v6 or v7.

example code

{
:local cmdname "info" ; :if ([/system resource get version] ~ "^7\\.") do={:set cmdname "monitor"}
:local cmdstring ":return [/interface lte $cmdname ([find]->0) once as-value]"
:local ltemon [[:parse $cmdstring]]

# mode 1

:put "IMEI is $($ltemon->"imei")"
:put "Current Operator is $($ltemon->"current-operator")"

# mode 2, if the values are readed multipe times:

:local lteimei ($ltemon->"imei")
:local lteoperator ($ltemon->"current-operator")
:put "IMEI is $lteimei"
:put "Current Operator is $lteoperator and the IMEI still $lteimei"
}

Who is online

Users browsing this forum: No registered users and 5 guests