JGrana
Very Senior Member
Background
I have been spending time working on a script to do some light management of my T-Mobile Sagemcom Gateway.
The main goal was to be able to turn the WiFi radios off/on (since I have an AX88U Pro in front of the gateway) and also be able to reboot the Sagemcom based on spdMerlins reported download speed.
I found that when the Sagemcom/T-Mobile Gateway starts to slow down (less than 12 MBits/sec) a reboot generally gets me back to 150 Mbits/sec+. I added a small hook to spdMerlin that called a script (background so non-blocking) at the end of the speedtest and passes the download and upload speedtest results (arg1 and arg2). Based on the download speed, I would then call tmo with the reboot command.
Its worked fine. I had some time and wanted to learn more about the Linux dialog menuing system. The original Slackware used this (dialog was created by them) and is still in use in many Linux distributions for installing.
So, here is what I have so far!
It can run in menu mode or called as a script. More details in the info below. For the most part, I tried to follow typical AddOn structure. The script (tmo.sh) resides in /jffs/scripts and it's configuration file and data files reside in /jffs/addons. It also creates a symbolic link in /opt/bin for easier use.
Its has an "install" and "uninstall" command that takes care of the above. It does not have an update command, at least at this point.
It is hosted on github https://github.com/JGrana01/tmo
It does require Entware installed since it does some json manipulation, dialog for the menus and a few formatting tools like column. These will be installed during tmo.sh install if they are not present.
Here is the Readme:
Linux shell script to access and change some settings on T-Mobile Sagemcom Fast 5688W Gateway
It supports a menuing system based on Linux dialog or can be run with arguemnts as a script.
This script will allow you to enable/disable the WiFi radios (2.4 and 5Ghz). Helpful when running as just a modem in front of an Asus router. I also added a reboot command.
I found that when my download speeds got low (less than 12 Mbits/sec.) a reboot of the Sagemcom ($ tmo reboot) usually got it back to 100Mbit+.
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/JGrana01/tmo/master/tmo.sh" -o "/jffs/scripts/tmo.sh" && chmod 0755 /jffs/scripts/tmo.sh && /jffs/scripts/tmo.sh install
$ tmo

To run in script mode, pass an argument. I.e.:
$ tmo status
It can also be called from another shell script in script mode. In script mode, after install, you will need to set the password for the Gateway. tmo.sh will encrypt the password and store in the file /jffs/addons/tmo/tmopw.enc for use. You should only need to do this once, unless to change the default admin password on the Gateway itself.
In script mode, you pass it any of these arguments:
config - displays the present configuration of the gateway
status - show the state of the two WiFi bands (enabled or disabled)
signal - show the present state of both the LTE and the 5G radios. Bands, levels etc.
signals - retrieve signal status and store (silently) in /jffs/addons/tmo/config.txt
all - show all the gateway information - both WiFi and Radios
radio [2.4|5] [off|on] - turn the 2.4Ghz or 5Ghz WiFi radios off or on
reboot - reboot the Sagemcom Fast Gateway
password - input the TMO Gateway admin password - needed for most commands
install - create the directory /jffs/addons/tmo, create a conf file and initial encrypted password file and then create a link in /opt/bin to tmo.sh
uninstall - remove everything related to tmo.sh
I have been spending time working on a script to do some light management of my T-Mobile Sagemcom Gateway.
The main goal was to be able to turn the WiFi radios off/on (since I have an AX88U Pro in front of the gateway) and also be able to reboot the Sagemcom based on spdMerlins reported download speed.
I found that when the Sagemcom/T-Mobile Gateway starts to slow down (less than 12 MBits/sec) a reboot generally gets me back to 150 Mbits/sec+. I added a small hook to spdMerlin that called a script (background so non-blocking) at the end of the speedtest and passes the download and upload speedtest results (arg1 and arg2). Based on the download speed, I would then call tmo with the reboot command.
Its worked fine. I had some time and wanted to learn more about the Linux dialog menuing system. The original Slackware used this (dialog was created by them) and is still in use in many Linux distributions for installing.
So, here is what I have so far!
It can run in menu mode or called as a script. More details in the info below. For the most part, I tried to follow typical AddOn structure. The script (tmo.sh) resides in /jffs/scripts and it's configuration file and data files reside in /jffs/addons. It also creates a symbolic link in /opt/bin for easier use.
Its has an "install" and "uninstall" command that takes care of the above. It does not have an update command, at least at this point.
It is hosted on github https://github.com/JGrana01/tmo
It does require Entware installed since it does some json manipulation, dialog for the menus and a few formatting tools like column. These will be installed during tmo.sh install if they are not present.
Here is the Readme:
Linux shell script to access and change some settings on T-Mobile Sagemcom Fast 5688W Gateway
About
Tmo.sh is a Linux shell script (tested on an Asuswrt-Merlin AX88U Pro) based on a MS PowerShell scripts on Nate Taters YouTube channel. I converted it to a Linux shell scripts (with help from ChatGPT!) and added some additional commands to display the 5G/LTE radio information and overall gateway information. Added thanks to @thelonelycoder on snbforums for the password encryption code!It supports a menuing system based on Linux dialog or can be run with arguemnts as a script.
This script will allow you to enable/disable the WiFi radios (2.4 and 5Ghz). Helpful when running as just a modem in front of an Asus router. I also added a reboot command.
I found that when my download speeds got low (less than 12 Mbits/sec.) a reboot of the Sagemcom ($ tmo reboot) usually got it back to 100Mbit+.
Installation
For Asuswrt-merlin based routers, using your preferred SSH client/terminal, copy and paste the following command, then press Enter:/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/JGrana01/tmo/master/tmo.sh" -o "/jffs/scripts/tmo.sh" && chmod 0755 /jffs/scripts/tmo.sh && /jffs/scripts/tmo.sh install
Using
The script runs either in a dialog based menu mode or in a script mode.To run in menu mode, just invoke without any command line argument:$ tmo

To run in script mode, pass an argument. I.e.:
$ tmo status
It can also be called from another shell script in script mode. In script mode, after install, you will need to set the password for the Gateway. tmo.sh will encrypt the password and store in the file /jffs/addons/tmo/tmopw.enc for use. You should only need to do this once, unless to change the default admin password on the Gateway itself.
In script mode, you pass it any of these arguments:
config - displays the present configuration of the gateway
status - show the state of the two WiFi bands (enabled or disabled)
signal - show the present state of both the LTE and the 5G radios. Bands, levels etc.
signals - retrieve signal status and store (silently) in /jffs/addons/tmo/config.txt
all - show all the gateway information - both WiFi and Radios
radio [2.4|5] [off|on] - turn the 2.4Ghz or 5Ghz WiFi radios off or on
reboot - reboot the Sagemcom Fast Gateway
password - input the TMO Gateway admin password - needed for most commands
install - create the directory /jffs/addons/tmo, create a conf file and initial encrypted password file and then create a link in /opt/bin to tmo.sh
uninstall - remove everything related to tmo.sh