Skip to content

Instantly share code, notes, and snippets.

@kralo
Created November 27, 2024 16:33
Show Gist options
  • Save kralo/732ace2501af1a47c3f31239c346e293 to your computer and use it in GitHub Desktop.
Save kralo/732ace2501af1a47c3f31239c346e293 to your computer and use it in GitHub Desktop.
Readout pass.telekom.de usage data locally on LTE connected teltonika router

(tested with rutx11).

Sometimes you want to know how much data your field router has already consumed on a mobile link. T-Mobile (Telekom Deutschland) provides pass.telekom.de as status page and has a handy json output.

If you reach your teltonika remotely, you can periodically fetch the site to produce output like:

Wed Nov 27 17:32:13 CET 2024

used:
32,13 GB

remaining:
3 Tage 06 Std.

This is an example to fetch the json, parse it, store it and be able to serve it locally via http:

A. Create the script vi /etc/telekomdata.sh:

#!/bin/ash

date
DATA=$(curl -sL http://pass.telekom.de/api/service/generic/v1/status)

echo -e '\nused: '
echo $DATA | jsonfilter -e "@.usedVolumeStr"
echo -e '\nremaining: '
echo $DATA | jsonfilter -e "@.remainingTimeStr"

echo -e '\n\n'

echo $DATA

and make it executable chmod +x /etc/telekomdata.sh

B. Add to crontab, crontab -e (this is a vi also!) */15 * * * * /etc/telekomdata.sh > /www/usage.txt

C. Wait for the quarter to pass and look at http://ip-to-your-teltonika/usage.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment