Skip to main content

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 is a dictionary keyed by 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:

{
    "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"},
    },
}

To read only selected groups, pass their names using the keyword-only groups argument:

status.get(groups={"Battery"})

The groups property returns the available group names:

print(status.groups)
# {'Battery', 'SolarArray', 'ChargeController'}

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsmppt60-driver 1.0.1
File Size Uploaded Provenance Actions
tsmppt60_driver-1.0.1.tar.gz 16.9 kB With provenance Details for tsmppt60_driver-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tsmppt60-driver 1.0.1
File Interpreter ABI Platform Actions
tsmppt60_driver-1.0.1-py3-none-any.whl Python 3 none any Details for tsmppt60_driver-1.0.1-py3-none-any.whl

Total release size: 33.2 kB

Release files / tsmppt60_driver-1.0.1.tar.gz

Download URL tsmppt60_driver-1.0.1.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4700243fadcce65eb40cb5021f5a12f07cbb9ed221538797ea1119568731314e
BLAKE2b-256 checksum
How to use checksums
cddc200956a3e8cd92d2d2c05daf6f55f01d0d7d25e80e17f355b7cf926b82ed
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 8, 2026.

Transparency log

Release files / tsmppt60_driver-1.0.1-py3-none-any.whl

Download URL tsmppt60_driver-1.0.1-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acb622a9e07b0daa37af261e4d45c49045d3e5f8b3a6304d1130a2f6faaeef5b
BLAKE2b-256 checksum
How to use checksums
ee93e97da1bebaadf7a23ead179ff87efee34e2c1c769f30643ad6f584522afb
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 8, 2026.

Transparency log

Security for tsmppt60-driver 1.0.1

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.

Select from 2 files

Attestation for tsmppt60_driver-1.0.1.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 8, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page