FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
698 views 7 comments
by anonymous
This is more of a diagnostic question more than anything else ... I'm trying to determine precisely when Vodefone (Portugal) is switching off various LTE/5G bands overnight.

I have great connection with B1, B3 and N78 however there is a point in time where all three bands seem to be unreachable for about 10~15 minutes at approx. 00:40 each evening.

I have read elsewhere that bands are often sequentially shutdown & restarted at various times between 00:00~02:00... But it would be nice to have a log running and get some actual data.

(The purpose is so I can schedule the RUTX50 to switch to a 'less favourable' band during Vodafone's shutdown, instead of suffering a connection blackout because of my manual band selection / lock.)

Thanks!

2 Answers

0 votes
by anonymous

p.s: For what this is worth ... RSSI logged in Home Assistant (96 hours of data from RUTX50 modbus).

It's quite easy to see Vodafone's mobile signal dropping off around at 00:00 then resuming normal service at 06:45. As mentioned above my RUTX50 is locked on bands B1, B3 and N78.

Fun stuff :)

RUTX50 RSSI signal strength

0 votes
by anonymous

Hello,

  

The easiest way I could think of at the moment would be to use a Custom Modbus Register. It works by collecting the data from your specified commands, putting them into a Modbus register, and then you can either read this register from a Modbus Master or send it using Data to Server feature. Information on how to set up a Custom Modbus Register can be found here.

The command that can be used to find the connected cell information (for both - RUTX50 and RUT955) could be

ubus call gsm.modem0 get_ca_info

As it outputs the carrier aggregation information (will output serving cell on RUT955) as well as the signal parameters:

root@Teltonika-RUTX50:~# ubus call gsm.modem0 get_ca_info

{
        "list": [
                {
                        "primary": true,
                        "frequency": 9435,
                        "bandwidth": "5",
                        "bandwidth_id": 3,
                        "net_mode": "lte",
                        "net_mode_id": 21,
                        "band": "LTE B28",
                        "band_id": 131072,
                        "cell_state": "registered",
                        "cell_state_id": 1,
                        "pcid": 264,
                        "rsrp": -81,
                        "rsrq": -9,
                        "rssi": -56,
                        "rssnr": 11
                },
                {
                        "primary": false,
                        "frequency": 1850,
                        "bandwidth": "20",
                        "bandwidth_id": 6,
                        "net_mode": "lte",
                        "net_mode_id": 21,
                        "band": "LTE B3",
                        "band_id": 8,
                        "cell_state": "deactivated",
                        "cell_state_id": 1,
                        "pcid": 264,
                        "rsrp": -87,
                        "rsrq": -19,
                        "rssi": -59,
                        "rssnr": -5
                },
                {
                        "primary": false,
                        "frequency": 75,
                        "bandwidth": "15",
                        "bandwidth_id": 5,
                        "net_mode": "lte",
                        "net_mode_id": 21,
                        "band": "LTE B1",
                        "band_id": 2,
                        "cell_state": "deactivated",
                        "cell_state_id": 1,
                        "pcid": 264,
                        "rsrp": -109,
                        "rsrq": -14,
                        "rssi": -84,
                        "rssnr": 4
                },
                {
                        "primary": false,
                        "frequency": 468250,
                        "bandwidth": "15",
                        "bandwidth_id": 5,
                        "net_mode": "nr5g",
                        "net_mode_id": 23,
                        "band": "5G N40",
                        "band_id": 131072,
                        "cell_state": "deactivated",
                        "cell_state_id": 1
                }
        ]
}

The relevant information can be parsed, put in the Custom Modbus register, and retrieved by/sent to the Home Assistant.

Let me know if any more information is needed!

  

Best regards,
DaumantasG 

by anonymous
Amazing thank you! I will have an opportunity to try this tomorrow or Thursday, and I'll reply here with feedback.
by anonymous

One question: Modbus messages are limited to 125 registers and the ubus call returns a pretty large chunk of data (in my case, about 840 characters / 420 registers).

I'm not familiar with the ubus command – is there any way to grab a few specific keys of get_ca_info? Instead of the whole lot? I'd want primary, band, band_id, registered, net_mode and rssi. The rest I could skip.

Incidentally I also tried ubus call gsm.modem0 get_serving_cell but I'm not quite sure what the unparsed data is telling me. It looks like signal strength and band etc. etc. but the 4G and 5G data are laid out differently.

{

"list": [

{

"ue_state": 3,

"ue_state_str": "Camping on cell",

"access_technology": "LTE",

"tdd_mode": "FDD",

"mcc": 268,

"mnc": 1,

"unparsed": "44C4829,381,1300,3,5,5,2C9,-86,-8,-59,9,8,110,-"

},

{

"ue_state": 3,

"ue_state_str": "Camping on cell",

"access_technology": "NR5G-NSA",

"mcc": 268,

"mnc": 1,

"unparsed": "381,-75,5,-14,154570,28,1,1"

}

]

}

If all else fails, I can make 4 or 5 modbus requests, starting from register 1025 count 125, 1150 count 125, 1275 count 125 etc. etc. then reassemble at the other end ... but that feels a bit clunky :)

Thanks,

Dan

by anonymous

Hello,

  

In that case, there are a few options:

  • Parsing the ubus command output on the device before sending it. Since you are using RUTX50, it has some more storage, RAM, and a more powerful CPU than the RUT device, thus you could install Python, and parse the output, as well as write it to the file instead of using a shell script. This makes parsing JSON quite easy as demonstrated here.
  • Parse the direct AT command output. A few commands could be of use here:

gsmctl -A 'AT+QCAINFO'

Output:

root@Teltonika-RUTX50:~# gsmctl -A 'AT+QCAINFO'
+QCAINFO: "PCC",9435,25,"LTE BAND 28",1,264,-83,-13,-55,7
+QCAINFO: "SCC",1850,100,"LTE BAND 3",1,264,-92,-20,-63,-7,0,-,-
+QCAINFO: "SCC",75,75,"LTE BAND 1",1,264,-106,-13,-85,0,0,-,-
+QCAINFO: "SCC",468250,8,"NR5G BAND 40",264

Where taking the first line as an example:

  • PCC - primary band (SCC - secondary);
  • 9435 - EARFCN;
  • 25 - Bandwidth:
    • 6 - 1.4MHz;
    • 15 - 3MHz;
    • 25 - 5MHz;
    • 50 - 10MHz;
    • 75 - 15MHz;
    • 100 - 20MHz;
  • LTE/5G band - the connected band number;
  • 1 - Cell state - (Not serving - 0; Registered -  1);
  • 264 - PCID;
  • -83 - RSRP;
  • -13 - RSRQ;
  • -55 - RSSI;
  • 7 - SINR;
This command would most likely be the smallest option to transmit. Let me know if there is anything else I can help with!

  

Best regards,
DaumantasG 

by anonymous

Fantastic, thank you for the explanation. Your suggestion fixes my issue. I'll reply later with modbus, /tmp/regfile, Home Assistant setup steps for anyone else interested (once I get it figured out).

Last night I stumbled across gsmctl after looking for ubus documentation, and managed to bodge together:

gsmctl --modemtime 2 -jCtbqo

Which gives me:

23/04/12,10:17:06
Connected
76543210
5G-NSA
LTE_B3
RSSI: -60
RSRP: -87
SINR: 8
RSRQ: -9
vodafone

Which fits into one single modbus request of approx. 50 registers. However your reply is more in line with what I need.

Have  a great day, Dan

by anonymous
That is also an option. Let us know how it goes!

Best regards,
DaumantasG
by anonymous

I've now got this script running on the router, launches after boot-up. The combination of gsmctl + grep + echo creates a /tmp/regfile which is always greater than 250 characters in size. I have my modbus request set to 125 registers (the maximum) so I need a minimum of 250 characters in /tmp/regfile otherwise I get modbus server errors. The '000...' just pad out the file.

#! /bin/ash

while true

do

gsmctl -CA 'AT+QCAINFO' -o --modemtime 2 grep pattern file | tr '\n\r,\"' ',' > /tmp/regfile

echo '0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000' >> /tmp/regfile

sleep 8

done

And after following the Teltonika documentation about Custom Modbus Registers (aka reading and broadcasting /tmp/regfile) I'm now able to log primary and secondary GSM bands, signal strength data, serving cell etc. etc. in Home Assistant.

Using the script above, my /tmp/regfile looks like the text below – comma delimited ASCII, which is easy enough for Home Assistant to parse:
 

72108043,+QCAINFO: ,PCC,,6300,50,,LTE BAND 20,,1,381,-84,-11,-54,0,,+QCAINFO: ,SCC,,103,100,,LTE BAND 1,,1,381,-95,-12,-73,8,0,-,-,,+QCAINFO: ,SCC,,1300,100,,LTE BAND 3,,1,381,-90,-11,-71,5,0,-,-,,+QCAINFO: ,SCC,,154570,1,,NR5G BAND 28,,381,,,vodafone P,23/04/13,22:06:17,0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000 0000000000

And the Home Assistant monitoring page looks something like this. I'm trying to diagnose midnight connection blackouts, so this should help.



And finally I'm happy to share the Home Assistant yaml setup if anyone needs ... but if I paste all that into this comment I'm bumping up against the maximum word count :)
 

by anonymous
Hello,

  

Glad you were able to find a working solution, as the data seems to be laid out very nicely! Setups like these can aid greatly in troubleshooting mobile-connection-related issues.

As for the HA yaml setup, if possible, please attach it as a .txt file to the original post. If anyone else needs it, please contact me and I will be able to share it.

Once again, thank you for providing the solution!

  

Best regards,
DaumantasG