T-Mobile Home Internet API Client
A python client for the T-Mobile Home Internet API.
This package was developed for use by ha-tmobilehome, a Home Assistant integration.
Tested against a Sercomm TMO-G4SE gateway, hardware version R02 and software version 1.03.20.
Installation
pip install pytmhi
Usage
from pytmhi import TmiApiClient
client = TmiApiClient("admin",<admin-password>)
version = client.get_version()
Functions
All functions are synchronous (blocking).
Retrieve gateway device details, basic received signal values, and current time.
get_gateway_config()
Retrieve basic received signal values (same as included in above).
get_gateway_signal()
Retrieve detailed cell tower and received signal values.
get_cell()
Retrieve sim card data.
get_sim()
Retrieve wired and wireless client details.
get_clients()
Retrieve access point (wireless) settings.
get_ap_config(retries, retry_seconds)
After an update to the access point settings by set_ap_config, the gateway will need some time to configure the new settings.
If an attempt is made to access the current settings while the gateway is busy, it will return HTTP 408 instead of data. These
retry settings can be used to give the gateway time to recover.
| Parameter | Type | Required? | Default | Description |
|---|---|---|---|---|
retries |
dict | optional | 0 | Times to retry if gateway is busy |
retry_seconds |
dict | optional | 1 | Seconds between retries |
Set access point (wireless) settings.
Note: Gateway will reconfigure wireless settings and may not respond successfully to subsequent requests for a short period.
set_ap_config(new_ap_config)
| Parameter | Type | Required? | Description |
|---|---|---|---|
new_ap_config |
dict | required | Contains entire contents from get_ap_config() with any changes to be made. (See example below.) |
Cause immediate reboot of gateway.
Note: Gateway will reset and may lose communications for several minutes.
reboot_gateway()
Retrieve current version of API.
get_version()
Examples
Retrieve 4G RSRQ (Reference Signal Received Quality)
rsrq__4g = client.get_gateway_signal()["signal"]["4g"]["rsrq"]
Retrieve 5G Cell Tower ECGI (Cell Global Identifier)
ecgi_5g = client.get_cell()["cell"]["5g"]["ecgi"]
Turn off 2.4GHz Wi-Fi
Do not turn off Wi-Fi unless you are connected to the gateway via a cable!
Note: Gateway will reset and may lose communications for a minute or more.
access_point_config = client.get_ap_config()
access_point_config["2.4ghz"]["isRadioEnabled"] = False
client.set_ap_config(access_point_config)
Acknowledgements
Thanks to Michael R. Torres (micrictor) for providing the original version of this fork. Also thanks to Zachary Wander (zacharee), author of HINTControl, which provided a much-needed API reference.
Metadata
Release files for pytmhi 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytmhi-1.1.1.tar.gz | 8.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytmhi-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.5 kB
Release files / pytmhi-1.1.1.tar.gz
| Download URL | pytmhi-1.1.1.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed29f50892b79e5795fb3ba5be6c86f5a60881e9ea5a25747f85158d1fcc8e6b
|
|
BLAKE2b-256 checksum How to use checksums |
9e4df47e1544d910e9eccb97950a53f9d593081965c3296074693a586540f897
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / pytmhi-1.1.1-py3-none-any.whl
| Download URL | pytmhi-1.1.1-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a469c7443af1cfb57cd5a65dcf6dc44d8c74f55abe6bef79231707b9fe5a98b5
|
|
BLAKE2b-256 checksum How to use checksums |
01489572e184e0ff2b590a1f78d5953447c8eb48ee4eae9bdd123e068d6662f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|