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.
pip install pytmhifrom pytmhi import TmiApiClient
client = TmiApiClient("admin",<admin-password>)
version = client.get_version()All functions are synchronous (blocking).
get_gateway_config()get_gateway_signal()get_cell()get_sim()get_clients()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 |
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.) |
Note: Gateway will reset and may lose communications for several minutes.
reboot_gateway()get_version()rsrq__4g = client.get_gateway_signal()["signal"]["4g"]["rsrq"]ecgi_5g = client.get_cell()["cell"]["5g"]["ecgi"]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)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.