USI (Unified Status Interface) is a unified status query interface provided by the RobustOS Pro system, used to view device running status, network connection information, traffic statistics, and various other system information in real-time.
# Query single status
usi get <status_path>
# Examples
usi get system.firmware_version # Query firmware version
usi get active_link.ip # Query current IP address
usi get gps.latitude # Query GPS latitude
Permission Note: To keep examples concise, most commands in this document don't explicitly add sudo; in non-root environments, please add sudo before commands or run as root user. Example:
sudo usi get system.firmware_version
Query commands require root privileges or sudo execution
Status data is real-time information reflecting current device running status
List item indexes start from 1, e.g., wan_links.link_status[1]
Sync First, Then Query:
For values that change dynamically, execute usi sync
html 错误:Message timeout after 5 minutes
Common modules requiring synchronization: cellular, lan_links, modem, wan_links, system, gps, wireless, openvpn, wireguard, route, ipsec, dmvpn, captive_portal, gre, emmc
Example:
# Sync cellular status before querying signal quality
usi sync cellular
usi get cellular.status[1].rsrp
| Query Command | Description | Example Output |
|---|---|---|
| usi get system.firmware_version | Firmware version | 2.4.0 |
| usi get system.firmware_version_full | Full firmware version | 2.4.0 (fde355d5d) |
| usi get system.kernel_version | Kernel version | 5.4.70-imx8mp |
| usi get system.hardware_version | Hardware version | 1.1 |
| usi get system.device_model | Device model | EG5120-A2CAZ-4L-A06GL |
| usi get system.serial_number | Serial number | 09070422100002 |
| usi get system.operation_system | Operating system | Debian GNU/Linux 11.11 |
Query Example:
# Query basic device information
echo "Device Model: $(usi get system.device_model)"
echo "Serial Number: $(usi get system.serial_number)"
echo "Firmware Version: $(usi get system.firmware_version)"
echo "Hardware Version: $(usi get system.hardware_version)"
| Query Command | Description |
|---|---|
| usi get ethernet.port_num | Number of Ethernet ports |
Query currently active network connection information
| Query Command | Description | Example Output |
|---|---|---|
| usi get active_link.desc | Active interface name | wwan, eth0, eth1, wlan0 |
| usi get active_link.ip | IP address/mask | 10.1.2.3/24 |
| usi get active_link.gateway | Gateway address | 10.1.2.1 |
| usi get active_link.dns | DNS servers | 8.8.8.8 8.8.4.4 |
| usi get active_link.ipv6_dns | IPv6 DNS servers | 2001:4860:4860::8888 |
Query Example:
# Sync WAN link status before querying
usi sync wan_links
# View current network connection status
echo "Current Interface: $(usi get active_link.desc)"
echo "IP Address: $(usi get active_link.ip)"
echo "Gateway: $(usi get active_link.gateway)"
echo "DNS: $(usi get active_link.dns)"
Query WAN interface connection status (supports multiple WAN links)
| Query Command | Description | Possible Values |
|---|---|---|
| usi get wan_links.link_status[1].interface | Interface name | wwan, eth0, eth1, wlan0 |
| usi get wan_links.link_status[1].status | Connection status | Connected, Disconnected, Connecting |
| usi get wan_links.link_status[1].mac | MAC address | 00:11:22:33:44:55 |
| usi get wan_links.link_status[1].ip4_addr | IPv4 address | 10.1.2.3/24 |
| usi get wan_links.link_status[1].ip4_gateway | IPv4 gateway | 10.1.2.1 |
| usi get wan_links.link_status[1].ip4_dns | IPv4 DNS | 8.8.8.8 8.8.4.4 |
| usi get wan_links.link_status[1].ip6_addr | IPv6 address | 2001::1/64 |
| usi get wan_links.link_status[1].ip6_gateway | IPv6 gateway | 2001::1 |
| usi get wan_links.link_status[1].ip6_dns | IPv6 DNS | 2001:4860:4860::8888 |
Query Example:
# Sync WAN link status before querying
usi sync wan_links
# Query first WAN link
echo "Interface: $(usi get wan_links.link_status[1].interface)"
echo "Status: $(usi get wan_links.link_status[1].status)"
echo "IP: $(usi get wan_links.link_status[1].ip4_addr)"
# Query second WAN link
echo "Interface: $(usi get wan_links.link_status[2].interface)"
echo "Status: $(usi get wan_links.link_status[2].status)"
# Batch query all WAN link statuses
for i in 1 2 3; do
status=$(usi get wan_links.link_status[$i].status 2>/dev/null)
if [ -n "$status" ]; then
interface=$(usi get wan_links.link_status[$i].interface)
ip=$(usi get wan_links.link_status[$i].ip4_addr)
echo "WAN$i: $interface - $status - $ip"
fi
done
| Query Command | Description | Example Output |
|---|---|---|
| usi get wan_links.link_traffic[1].interface | Interface name | wwan |
| usi get wan_links.link_traffic[1].tx | Transmitted traffic | 1024KiB |
| usi get wan_links.link_traffic[1].rx | Received traffic | 2048KiB |
| usi get wan_links.link_traffic[1].all | Total traffic | 3MiB |
Query Example:
# Sync WAN link status before querying
usi sync wan_links
# Query first WAN link traffic
echo "Interface: $(usi get wan_links.link_traffic[1].interface)"
echo "Sent: $(usi get wan_links.link_traffic[1].tx)"
echo "Received: $(usi get wan_links.link_traffic[1].rx)"
echo "Total: $(usi get wan_links.link_traffic[1].all)"
Query LAN interface information
| Query Command | Description | Example Output |
|---|---|---|
| usi get lan_links.link_status[1].interface | Interface name | br_lan |
| usi get lan_links.link_status[1].mac | MAC address | 34:FA:40:21:BC:C6 |
| usi get lan_links.link_status[1].ip4_addr | IPv4 address | 192.168.0.1/24 |
| usi get lan_links.link_status[1].ip6_addr | IPv6 address | fe80::e124:ead5:d152:f430/64 |
| usi get lan_links.link_status[1].rx_bytes | Received bytes | 555858 |
| usi get lan_links.link_status[1].tx_bytes | Transmitted bytes | 6892928 |
| usi get lan_links.link_status[1].rx_packets | Received packets | 3289 |
| usi get lan_links.link_status[1].tx_packets | Transmitted packets | 4874 |
Query Example:
# Sync LAN link status before querying
usi sync lan_links
# Query LAN interface information
echo "LAN IP: $(usi get lan_links.link_status[1].ip4_addr)"
echo "LAN MAC: $(usi get lan_links.link_status[1].mac)"
Query list of devices connected to LAN
| Query Command | Description | Example Output |
|---|---|---|
| usi get lan_links.connected_device[1].ip | Device IP address | 192.168.0.3 |
| usi get lan_links.connected_device[1].mac | Device MAC address | 74:39:89:A1:7A:13 |
| usi get lan_links.connected_device[1].interface | Connected interface | br_lan |
| usi get lan_links.connected_device[1].inactive_time | Inactive time | 0s |
Query Example:
# Sync LAN link status before querying
usi sync lan_links
# Query all connected devices
echo "=== LAN Connected Devices ==="
for i in {1..50}; do
ip=$(usi get lan_links.connected_device[$i].ip 2>/dev/null)
if [ -n "$ip" ]; then
mac=$(usi get lan_links.connected_device[$i].mac)
interface=$(usi get lan_links.connected_device[$i].interface)
inactive=$(usi get lan_links.connected_device[$i].inactive_time)
echo "Device $i: $ip ($mac) - $interface - Inactive time: $inactive"
fi
done
| Query Command | Description | Example Output |
|---|---|---|
| usi get route.route_table[1].destination | Destination network | 192.168.0.0 |
| usi get route.route_table[1].netmask | Subnet mask | 255.255.255.0 |
| usi get route.route_table[1].gateway | Gateway address | 0.0.0.0 |
| usi get route.route_table[1].interface | Outgoing interface | br_lan |
| usi get route.route_table[1].metric | Route metric | 425 |
Field Description:
destination/netmask: 0.0.0.0/0 represents default route.
gateway: Next hop address.
interface: Outgoing network interface, e.g., wlan0, eth0.
metric: Route priority metric value, smaller values have higher priority.
Query Example:
# Sync route status before querying
usi sync route
# Query route table entry 1 (example output below)
echo "=== Route Table Entry 1 ==="
echo "Destination: $(usi get route.route_table[1].destination)"
echo "Mask: $(usi get route.route_table[1].netmask)"
echo "Gateway: $(usi get route.route_table[1].gateway)"
echo "Interface: $(usi get route.route_table[1].interface)"
echo "Metric: $(usi get route.route_table[1].metric)"
# Iterate through first several routes and print valid entries
for i in {1..50}; do
dest=$(usi get route.route_table[$i].destination 2>/dev/null)
if [ -n "$dest" ]; then
mask=$(usi get route.route_table[$i].netmask)
gw=$(usi get route.route_table[$i].gateway)
ifname=$(usi get route.route_table[$i].interface)
metric=$(usi get route.route_table[$i].metric)
echo "[$i] $dest/$mask via $gw dev $ifname metric $metric"
fi
done
| Query Command | Description | Example Output |
|---|---|---|
| usi get modem.connection_type | Connection type | usbnet, qmi |
| usi get modem.support_5g | 5G support | true, false |
| usi get modem.sr_preferred_operator_support | Preferred operator support | true, false |
| Query Command | Description |
|---|---|
| usi get modem.monthly_rx_bytes_sim1 | SIM1 monthly received traffic |
| usi get modem.monthly_tx_bytes_sim1 | SIM1 monthly transmitted traffic |
| usi get modem.monthly_rx_bytes_sim2 | SIM2 monthly received traffic |
| usi get modem.monthly_tx_bytes_sim2 | SIM2 monthly transmitted traffic |
| usi get modem.daily_rx_bytes_sim1 | SIM1 daily received traffic |
| usi get modem.daily_tx_bytes_sim1 | SIM1 daily transmitted traffic |
| usi get modem.daily_rx_bytes_sim2 | SIM2 daily received traffic |
| usi get modem.daily_tx_bytes_sim2 | SIM2 daily transmitted traffic |
Query Example:
# Query SIM card traffic
echo "=== SIM1 Traffic Statistics ==="
echo "Monthly RX: $(usi get modem.monthly_rx_bytes_sim1)"
echo "Monthly TX: $(usi get modem.monthly_tx_bytes_sim1)"
echo "Daily RX: $(usi get modem.daily_rx_bytes_sim1)"
echo "Daily TX: $(usi get modem.daily_tx_bytes_sim1)"
Query signal strength, band, cell information, etc.
| Query Command | Description | Example Output |
|---|---|---|
| usi get cellular.status[1].band | Band | 3, 7, 20 |
| usi get cellular.status[1].pci | Physical cell ID | 123 |
| usi get cellular.status[1].tac | Tracking area code | 1234 |
| usi get cellular.status[1].cell_id | Cell ID | 12345678 |
| usi get cellular.status[1].arfcn | Absolute RF channel number | 1234 |
| usi get cellular.status[1].rsrp | Reference signal received power | -80 dBm |
| usi get cellular.status[1].rsrp_value | RSRP value | -80 |
| usi get cellular.status[1].rsrq | Reference signal received quality | -10 dB |
| usi get cellular.status[1].rsrq_value | RSRQ value | -10 |
| usi get cellular.status[1].sinr | Signal-to-interference-plus-noise ratio | 15 dB |
| usi get cellular.status[1].sinr_value | SINR value | 15 |
| usi get cellular.status[1].ecio | Ec/Io value (3G) | -5.0 dBm |
| usi get cellular.status[1].lte_sccs | LTE secondary carrier count | 1 |
| usi get cellular.status[1].nr_sccs | 5G secondary carrier count | 0 |
Query Example:
# Sync cellular status before querying
usi sync cellular
# Query cellular network signal quality
echo "=== Signal Status ==="
echo "Band: $(usi get cellular.status[1].band)"
echo "RSRP: $(usi get cellular.status[1].rsrp)"
echo "RSRQ: $(usi get cellular.status[1].rsrq)"
echo "SINR: $(usi get cellular.status[1].sinr)"
echo "Cell ID: $(usi get cellular.status[1].cell_id)"
| Query Command | Description | Possible Values |
|---|---|---|
| usi get smart_roaming.state | Roaming state | Disabled, Starting, Scanning…, Connecting, Connected, Testing |
| usi get smart_roaming.oper_selection_mode | Operator selection mode | Pending, Automatic, Manual, User specified, Site Survey |
| usi get smart_roaming.cops_search_tm | Network search time | 2025-01-15 10:30:00 |
| usi get smart_roaming.cops_search_start_tm | Search start time | 2025-01-15 10:25:00 |
Query Example:
# Query smart roaming status
echo "Roaming Status: $(usi get smart_roaming.state)"
echo "Selection Mode: $(usi get smart_roaming.oper_selection_mode)"
| Query Command | Description | Example Output |
|---|---|---|
| usi get gps.status | GPS status | Fixed, No Fix, Invalid |
| usi get gps.time | UTC time | 2025-01-15 10:30:45 |
| usi get gps.latitude | Latitude | 39.904200 |
| usi get gps.longitude | Longitude | 116.407400 |
| usi get gps.altitude | Altitude | 50.00 m |
| usi get gps.speed | Speed | 0.00 m/s |
| usi get gps.satellite_in_use | Satellites in use | 12 |
| usi get gps.satellite_in_view | Satellites in view | GPS(8), Galileo(4), BeiDou(6), GLONASS(5) |
| usi get gps.last_fixed_time | Last fix time | 2025-01-15 10:30:00 UTC |
| usi get gps.data_report | Data report status | true, false |
| usi get gps.data_report_232 | RS232 report status | true, false |
Query Example:
# Sync GPS status before querying
usi sync gps
# Query GPS positioning information
echo "=== GPS Positioning Information ==="
echo "Status: $(usi get gps.status)"
echo "Time: $(usi get gps.time)"
echo "Latitude: $(usi get gps.latitude)"
echo "Longitude: $(usi get gps.longitude)"
echo "Altitude: $(usi get gps.altitude)"
echo "Speed: $(usi get gps.speed)"
echo "Satellites in Use: $(usi get gps.satellite_in_use)"
echo "Satellites in View: $(usi get gps.satellite_in_view)"
| Query Command | Description | Example Output |
|---|---|---|
| usi get serial_port.enable | Serial passthrough feature enabled | true |
| usi get serial_port.port[1].type | Serial port 1 type | RS232 |
| usi get serial_port.port[1].link_status | Serial port 1 network connection status | up |
| usi get serial_port.port[1].rx_bytes | Serial port 1 received bytes | 1024B |
| usi get serial_port.port[1].tx_bytes | Serial port 1 transmitted bytes | 2048B |
Status Description:
link_status:
up: Connection established (e.g., TCP client connected, or TCP server has client connected)
down: Connection disconnected
establish: Port initialized (e.g., in UDP mode)
Query Example:
# Query serial port 1 status and traffic
echo "Serial Port 1 Type: $(usi get serial_port.port[1].type)"
echo "Serial Port 1 Connection Status: $(usi get serial_port.port[1].link_status)"
echo "Serial Port 1 RX: $(usi get serial_port.port[1].rx_bytes)"
echo "Serial Port 1 TX: $(usi get serial_port.port[1].tx_bytes)"
| Query Command | Description | Example Output |
|---|---|---|
| usi get dido.di[1].name | DI name | DI1 |
| usi get dido.di[1].level | Current level status | High |
| usi get dido.di[1].status | Alarm status | Alarm Off |
| usi get dido.di[1].count | Count value (counter mode only) | 123 |
Status Value Description:
level:
High: High level
Low: Low level
status:
Alarm on: Alarm triggered
Alarm off: Alarm off
Query Example:
# Query DI1 status
echo "DI1 Level: $(usi get dido.di[1].level)"
echo "DI1 Status: $(usi get dido.di[1].status)"
echo "DI1 Count: $(usi get dido.di[1].count)"
| Query Command | Description | Example Output |
|---|---|---|
| usi get dido.do[1].name | DO name | DO1 |
| usi get dido.do[1].level | Current output status | ON(Low) |
Status Value Description:
level:
Open / OFF(High): DO open or at high level (specific value depends on device model)
Closed / ON(Low): DO closed or at low level (specific value depends on device model)
Pulse: Pulse mode (instantaneous state)
Query Example:
# Query DO1 status
echo "DO1 Status: $(usi get dido.do[1].level)"
| Query Command | Description | Example Output |
|---|---|---|
| usi get internet_traffic.total_traffic | Total traffic (Bytes) | 28476280 |
| Query Command | Description | Example Output |
|---|---|---|
| usi get wan.link_uptime | Link uptime (seconds) | 3867 |
| usi get wan.monthly_rx_bytes | Monthly received traffic (Bytes) | 8192 |
| usi get wan.monthly_tx_bytes | Monthly transmitted traffic (Bytes) | 4096 |
| usi get wan.daily_rx_bytes | Daily received traffic (Bytes) | 2048 |
| usi get wan.daily_tx_bytes | Daily transmitted traffic (Bytes) | 1024 |
Query Example:
# Query WAN traffic
echo "=== WAN Traffic Statistics ==="
echo "Uptime: $(usi get wan.link_uptime)"
echo "Monthly RX: $(usi get wan.monthly_rx_bytes)"
echo "Monthly TX: $(usi get wan.monthly_tx_bytes)"
echo "Daily RX: $(usi get wan.daily_rx_bytes)"
echo "Daily TX: $(usi get wan.daily_tx_bytes)"
| Query Command | Description | Example Output |
|---|---|---|
| usi get wlan.monthly_rx_bytes | Monthly received traffic (Bytes) | 5731920 |
| usi get wlan.monthly_tx_bytes | Monthly transmitted traffic (Bytes) | 22971688 |
| usi get wlan.daily_rx_bytes | Daily received traffic (Bytes) | 1256606 |
| usi get wlan.daily_tx_bytes | Daily transmitted traffic (Bytes) | 6532600 |
| Query Command | Description | Example Output |
|---|---|---|
| usi get ntp.last_update_time | Last update time |
| Query Command | Description | Example Output |
|---|---|---|
| usi get uci.board | Board type | eg5120 |
| usi get uci.sim_num | SIM card count | 2 |
| usi get uci.supported_sims | Supported SIM cards | sim1 sim2 |
| usi get uci.supported_do | Supported DOs | 1 2 |
| usi get uci.supported_wifi_modes | Supported WiFi modes | 11bgnax 11bgn 11b 11g 11n 11an 11ac 11anacax |
| usi get uci.wifi_24g_channels | 2.4G WiFi channels | auto 1 2 3 4 5 6 7 8 9 10 11 12 13 |
| usi get uci.wifi_5g_channels | 5G WiFi channels | auto 36 40 44 48 149 153 157 161 165 |
Note: Scripts in this section are executed by default in root environment; if running as regular user, please add sudo before usi commands in scripts.
#!/bin/bash
# Sync common modules to ensure data is up-to-date
usi sync system
usi sync wan_links
usi sync gps
usi sync cellular
echo "========================================="
echo " Robustel Device Status Report"
echo "========================================="
echo ""
# System information
echo "=== System Information ==="
echo "Device Model: $(usi get system.device_model)"
echo "Serial Number: $(usi get system.serial_number)"
echo "Firmware Version: $(usi get system.firmware_version)"
echo "Hardware Version: $(usi get system.hardware_version)"
echo ""
# Network status
echo "=== Network Status ==="
echo "Active Interface: $(usi get active_link.desc)"
echo "IP Address: $(usi get active_link.ip)"
echo "Gateway: $(usi get active_link.gateway)"
echo "DNS: $(usi get active_link.dns)"
echo ""
# WAN link status
echo "=== WAN Link Status ==="
for i in 1 2 3; do
status=$(usi get wan_links.link_status[$i].status 2>/dev/null)
if [ -n "$status" ]; then
interface=$(usi get wan_links.link_status[$i].interface)
ip=$(usi get wan_links.link_status[$i].ip4_addr)
echo "WAN$i ($interface): $status - $ip"
fi
done
echo ""
# GPS status
echo "=== GPS Status ==="
echo "Status: $(usi get gps.status)"
echo "Latitude: $(usi get gps.latitude)"
echo "Longitude: $(usi get gps.longitude)"
echo "Satellites: $(usi get gps.satellite_in_use)"
echo ""
# Signal quality
echo "=== Cellular Signal ==="
echo "Band: $(usi get cellular.status[1].band)"
echo "RSRP: $(usi get cellular.status[1].rsrp)"
echo "RSRQ: $(usi get cellular.status[1].rsrq)"
echo "SINR: $(usi get cellular.status[1].sinr)"
echo ""
# Traffic statistics
echo "=== Traffic Statistics ==="
echo "Total Traffic: $(usi get internet_traffic.total_traffic)"
echo "WAN Monthly RX: $(usi get wan.monthly_rx_bytes)"
echo "WAN Monthly TX: $(usi get wan.monthly_tx_bytes)"
echo ""
echo "========================================="
echo " Report Generated: $(date)"
echo "========================================="
#!/bin/bash
# Continuously monitor network connection status
while true; do
clear
echo "=== Network Connection Monitor - $(date) ==="
echo ""
# Sync WAN link status before each query
usi sync wan_links
# Active connection
echo "Current Active Connection:"
echo " Interface: $(usi get active_link.desc)"
echo " IP: $(usi get active_link.ip)"
echo ""
# WAN links
echo "WAN Link Status:"
for i in 1 2 3; do
status=$(usi get wan_links.link_status[$i].status 2>/dev/null)
if [ -n "$status" ]; then
interface=$(usi get wan_links.link_status[$i].interface)
ip=$(usi get wan_links.link_status[$i].ip4_addr)
printf " WAN%d %-8s: %-15s %s\n" $i "($interface)" "$status" "$ip"
fi
done
sleep 5
done
#!/bin/bash
# Monitor cellular signal quality
while true; do
clear
echo "=== Signal Quality Monitor - $(date) ==="
echo ""
# Sync cellular status before each query
usi sync cellular
band=$(usi get cellular.status[1].band)
rsrp=$(usi get cellular.status[1].rsrp)
rsrq=$(usi get cellular.status[1].rsrq)
sinr=$(usi get cellular.status[1].sinr)
echo "Band: $band"
echo "RSRP: $rsrp"
echo "RSRQ: $rsrq"
echo "SINR: $sinr"
echo ""
# Simple signal quality assessment
rsrp_val=$(echo $rsrp | grep -oP '[-]?\d+' | head -1)
if [ -n "$rsrp_val" ]; then
if [ $rsrp_val -ge -80 ]; then
echo "Signal Quality: Excellent"
elif [ $rsrp_val -ge -90 ]; then
echo "Signal Quality: Good"
elif [ $rsrp_val -ge -100 ]; then
echo "Signal Quality: Fair"
else
echo "Signal Quality: Poor"
fi
fi
sleep 3
done
#!/bin/bash
# GPS position tracking log
LOG_FILE="/tmp/gps_track.log"
echo "Starting GPS tracking, log saved to: $LOG_FILE"
echo "Press Ctrl+C to stop tracking"
echo ""
while true; do
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
# Sync GPS status before each query
usi sync gps
status=$(usi get gps.status)
if [ "$status" = "Fixed" ]; then
lat=$(usi get gps.latitude)
lon=$(usi get gps.longitude)
alt=$(usi get gps.altitude)
speed=$(usi get gps.speed)
sats=$(usi get gps.satellite_in_use)
log_entry="$timestamp | $status | Lat: $lat | Lon: $lon | Alt: $alt | Speed: $speed | Sats: $sats"
echo "$log_entry"
echo "$log_entry" >> "$LOG_FILE"
else
log_entry="$timestamp | $status | Waiting for fix..."
echo "$log_entry"
echo "$log_entry" >> "$LOG_FILE"
fi
sleep 5
done
#!/bin/bash
# Sync related modules before generating report
usi sync wan_links
usi sync cellular
usi sync wireless
# Generate traffic usage report
echo "========================================="
echo " Traffic Usage Report"
echo "========================================="
echo " Generated: $(date)"
echo "========================================="
echo ""
# Total traffic
echo "=== Total Traffic ==="
echo "Total: $(usi get internet_traffic.total_traffic)"
echo ""
# WAN traffic
echo "=== WAN Traffic ==="
echo "Monthly RX: $(usi get wan.monthly_rx_bytes)"
echo "Monthly TX: $(usi get wan.monthly_tx_bytes)"
echo "Daily RX: $(usi get wan.daily_rx_bytes)"
echo "Daily TX: $(usi get wan.daily_tx_bytes)"
echo ""
# WLAN traffic
echo "=== WLAN Traffic ==="
echo "Monthly RX: $(usi get wlan.monthly_rx_bytes)"
echo "Monthly TX: $(usi get wlan.monthly_tx_bytes)"
echo "Daily RX: $(usi get wlan.daily_rx_bytes)"
echo "Daily TX: $(usi get wlan.daily_tx_bytes)"
echo ""
# SIM card traffic
echo "=== SIM1 Traffic ==="
echo "Monthly RX: $(usi get modem.monthly_rx_bytes_sim1)"
echo "Monthly TX: $(usi get modem.monthly_tx_bytes_sim1)"
echo "Daily RX: $(usi get modem.daily_rx_bytes_sim1)"
echo "Daily TX: $(usi get modem.daily_tx_bytes_sim1)"
echo ""
sim2_rx=$(usi get modem.monthly_rx_bytes_sim2 2>/dev/null)
if [ -n "$sim2_rx" ]; then
echo "=== SIM2 Traffic ==="
echo "Monthly RX: $(usi get modem.monthly_rx_bytes_sim2)"
echo "Monthly TX: $(usi get modem.monthly_tx_bytes_sim2)"
echo "Daily RX: $(usi get modem.daily_rx_bytes_sim2)"
echo "Daily TX: $(usi get modem.daily_tx_bytes_sim2)"
echo ""
fi
# Traffic for each WAN link
echo "=== Link Traffic ==="
for i in 1 2 3; do
interface=$(usi get wan_links.link_traffic[$i].interface 2>/dev/null)
if [ -n "$interface" ]; then
tx=$(usi get wan_links.link_traffic[$i].tx)
rx=$(usi get wan_links.link_traffic[$i].rx)
all=$(usi get wan_links.link_traffic[$i].all)
echo "Link $i ($interface):"
echo " TX: $tx"
echo " RX: $rx"
echo " Total: $all"
echo ""
fi
done
echo "========================================="
Problem: Some query commands return empty value or "status not found"
Possible Causes:
Corresponding function not enabled (e.g., cannot query GPS status when GPS is disabled)
Parameter name spelling error
List index out of range
Solution:
# First sync corresponding module (using GPS as example)
usi sync gps
# Use 2>/dev/null to ignore error messages
value=$(usi get gps.status 2>/dev/null)
if [ -z "$value" ]; then
echo "GPS function not enabled or status unavailable"
fi
#!/bin/bash
# First sync WAN link status
usi sync wan_links
# Check network connection status
status=$(usi get wan_links.link_status[1].status)
if [ "$status" = "Connected" ]; then
ip=$(usi get wan_links.link_status[1].ip4_addr)
echo "Network connected - IP: $ip"
else
echo "Network not connected - Status: $status"
fi
#!/bin/bash
# Iterate through all possible WAN links
for i in {1..10}; do
interface=$(usi get wan_links.link_status[$i].interface 2>/dev/null)
if [ -n "$interface" ]; then
status=$(usi get wan_links.link_status[$i].status)
echo "WAN$i: $interface - $status"
fi
done