TS-MPPT-60 driver module
Python driver module for reading status data from a TS-MPPT-60 charge controller.
The public API exposes the following controller groups:
Battery- Battery Voltage
- Target Voltage
- Charge Current
- Output Power
- Battery Temperature
SolarArray- Array Voltage
- Array Current
- Sweep Vmp
- Sweep Voc
- Sweep Pmax
ChargeController- LED State
- Charge State
- Heat Sink Temperature
- Amp Hours
- Kilowatt Hours
Requirements
- Python 3.11 or later, before 3.15
Installation
pip install tsmppt60-driver
The package installs both the Python API and the tsmppt60cli command.
To install the CLI from a local checkout, run this command from the repository
root:
python -m pip install .
Usage
Command-line interface
Read all controller groups by specifying the controller's host name or IP address:
tsmppt60cli --host 192.168.1.20
By default, the command writes the status as JSON to standard output, using the same structure as the Python API result shown below. To save it to a file:
tsmppt60cli --host 192.168.1.20 > status.json
Available options:
| Option | Description | Default |
|---|---|---|
--host HOST |
Controller host name or IP address | localhost |
--port PORT |
Controller port number | 80 |
--debug |
Enable debug mode and include logging metadata in the output | Disabled |
-h, --help |
Show help and exit |
For example, specify a different port and enable debug mode:
tsmppt60cli --host 192.168.1.20 --port 8080 --debug
With --debug, the output includes a timestamp, logger name, and log level
before the JSON payload, so it is no longer plain JSON.
Python API
TsMppt60 reads all controller groups by default. The result contains a
top-level measured_at string and a dictionary for each selected group,
with each group's status keyed by label.
from tsmppt60_driver import TsMppt60
status = TsMppt60("192.168.1.20")
print(status.get())
The result has the following structure:
{
"measured_at": "2026-11-22T02:11:24.148712+00:00",
"Battery": {
"Battery Voltage": {"value": 23.93, "unit": "V"},
"Target Voltage": {"value": 28.6, "unit": "V"},
"Charge Current": {"value": 3.2, "unit": "A"},
"Output Power": {"value": 76.0, "unit": "W"},
"Battery Temperature": {"value": 25, "unit": "C"},
},
"SolarArray": {
"Array Voltage": {"value": 53.41, "unit": "V"},
"Array Current": {"value": 1.4, "unit": "A"},
"Sweep Vmp": {"value": 53.41, "unit": "V"},
"Sweep Voc": {"value": 60.05, "unit": "V"},
"Sweep Pmax": {"value": 73.0, "unit": "W"},
},
"ChargeController": {
"LED State": {"value": 11, "unit": "Numbers"},
"Charge State": {"value": 3, "unit": "Numbers"},
"Heat Sink Temperature": {"value": 30, "unit": "C"},
"Amp Hours": {"value": 18097.9, "unit": "Ah"},
"Kilowatt Hours": {"value": 237, "unit": "kWh"},
},
}
measured_at is an ISO 8601 timestamp with the UTC offset +00:00,
generated from the host's clock immediately before reading the controller
groups. It records the start of the read operation. Values are read
sequentially and may represent different instants.
To read only selected groups, pass their names using the keyword-only
groups argument. The result still includes measured_at:
status.get(groups={"Battery"})
The groups property returns the available group names:
print(status.groups)
# {'Battery', 'SolarArray', 'ChargeController'}
When iterating over group data, use status.groups and select the groups
present in the result:
data = status.get(groups={"Battery"})
for group in status.groups:
if group in data:
for label, measurement in data[group].items():
print(group, label, measurement["value"], measurement["unit"])
Individual controllers are also available from the top-level package:
from tsmppt60_driver import Battery
battery = Battery("192.168.1.20", 80)
print(battery.labels)
print(battery.get())
To serialize the result as JSON:
import json
print(json.dumps(status.get()))
Migrating from v0.2.3 to v1.0.0
Version 1.0.0 changes the public Python API and the returned data structure.
The examples below compare the v0.2.3 tag with version 1.0.0.
Replace SystemStatus with TsMppt60
Before (v0.2.3):
from tsmppt60_driver import SystemStatus
status = SystemStatus("192.168.1.20", port=80)
data = status.get(False)
voltage = data["Battery Voltage"]["value"]
After (v1.0.0):
from tsmppt60_driver import TsMppt60
status = TsMppt60("192.168.1.20", port=80)
data = status.get()
voltage = data["Battery"]["Battery Voltage"]["value"]
SystemStatus is no longer exported. The is_limit argument to get()
has been removed: replace both get(False) and get(is_limit=False) with
get(). The new default reads all available labels, including Output Power,
Battery Temperature, and the sweep values that were excluded by the old
default get().
Update data consumers and group selection
Previously, results were keyed directly by label, and each item contained
group, value, and unit. Results are now keyed first by group, then by
label; each item contains only value and unit. Update stored JSON
consumers and scripts to use the new nesting as well.
| v0.2.3 group | v1.0.0 group | Labels |
|---|---|---|
Battery |
Battery |
Battery Voltage, Target Voltage, Charge Current, Output Power |
Array |
SolarArray |
Array Voltage, Array Current, Sweep Vmp, Sweep Voc, Sweep Pmax |
Temperature |
Battery |
Battery Temperature |
Temperature |
ChargeController |
Heat Sink Temperature |
Counter |
ChargeController |
Amp Hours, Kilowatt Hours |
Condition |
ChargeController |
LED State, Charge State |
Use the keyword-only groups argument to read selected groups:
data = status.get(groups={"Battery", "SolarArray"})
The old SystemStatus iteration and len(status) interfaces are no longer
available. Use status.groups to discover group names. For direct controller
access, replace BatteryStatus with Battery, SolarArrayStatus with
SolarArray, and the temperature, counter, and operating-condition
controllers with the groups listed above. Construct these controllers with
(host, port) rather than a ManagementBase instance, and use get()
instead of get_status_all(). To select individual labels, use, for example,
Battery("192.168.1.20", 80).get(target_labels=["Battery Voltage"]).
Use the installed CLI for shell scripts
The new tsmppt60cli command replaces the need for a Python one-liner.
For example, the old jq selector '."Battery Voltage"' becomes
'.Battery["Battery Voltage"]':
tsmppt60cli --host 192.168.1.20 | jq '.Battery["Battery Voltage"]'
Use tsmppt60cli as the CLI entry point; python -m tsmppt60_driver is
not supported.
Metadata
Release files for tsmppt60-driver 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tsmppt60_driver-1.0.2.tar.gz | 17.6 kB | With provenance | Details for tsmppt60_driver-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tsmppt60_driver-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for tsmppt60_driver-1.0.2-py3-none-any.whl |
Total release size: 34.3 kB
Release files / tsmppt60_driver-1.0.2.tar.gz
| Download URL | tsmppt60_driver-1.0.2.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ddb8be9d87934d9d87d6ede73ff220bb4b38e9c7f20ee06e6c7ec79a2a87ab9
|
|
BLAKE2b-256 checksum How to use checksums |
620829e2e0cb8dd5da34f0873d5c47c041122e972b013b3ffee1124c5b75cf92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logRelease files / tsmppt60_driver-1.0.2-py3-none-any.whl
| Download URL | tsmppt60_driver-1.0.2-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb103267061ef9699168720ca5c256ab3762405cfa01b12f7d9c732555ba5066
|
|
BLAKE2b-256 checksum How to use checksums |
ede54fc5a8c24738a1e074fc1b74769c8745ee48b9a7ac8709091f2045a1253b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logSecurity for tsmppt60-driver 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tsmppt60_driver-1.0.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.