Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Get the percent of battery charge of an InSeeGo MiFi Router

Aug
2,799
144
While I can view the percent of battery charge of an InSeeGo MiFi router by visiting the website;

Code:
http://192.168.1.1
...I wanted to have the percent of battery charge accessible from the TCC command line.

I added the following function to my PowerShell 5.1 profile;

Code:
function Get-InseegoBattery {
    $ip = "192.168.1.1"
    $result = curl.exe -s "http://$ip/srv/status" | Select-String -Pattern '"statusBarBatteryPercent"\s*:\s*"(\d+)"' | ForEach-Object { $_.Matches.Groups[1].Value }
    return $result
}

I then created a TCC alias;

Code:
bp=`set _bp=%@pshell[Get-InSeeGoBattery] & echo %_bp`

Proof;
Code:
R:\>which bp
bp is an alias : set _bp=%@pshell[Get-InSeeGoBattery] & echo %_bp

R:\>bp
57

Posting for my future reference,
but others may also be interested.

Joe
 
Back
Top