Skip to main content

pylon2mqtt

pylon2mqtt can periodically poll data from a Pylon Battery debug interface and publish to MQTT. It should run on Linux and Windows but since most people will likely run this on something like a Raspberry Pi, only instructions for Linux are shown here.

Required Hardware

You will need some sort of serial connection to the Pylontech battery. You can either build your own or buy a premade cable that embeds a USB->RS232 chip on one side and the custom RJ45 pinout on the other.

Installing

Get it from PyPI (you might want to do this in a virtualenv):

$ pip install pylon2mqtt

You should then have the pylon2mqtt CLI on your path.

Setting Up

First, it's probably a good idea to test if it works at all. Assuming your serial adapter is /dev/ttyUSB0, run:

$ pylon2mqtt test -s /dev/ttyUSB0

which should spit out values for all connected batteries. After confirming the basics work, you can give exporting to MQTT a try:

$ pylon2mqtt run -s /dev/ttyUSB0 -h mymqtthost.example.org

once you have it working with the desired flags, you can generate a systemd unit. Just replace run with generate-systemd and you'll get a systemd unit file that should use the right virtualenv/interpreter and set the flags you specified:

$ pylon2mqtt generate-systemd -s /dev/ttyUSB0 -h mymqtthost.example.org

Dealing with multiple serial adapters

If you have multiple USB->serial adapters plugged in, it might be a good idea to get a stable device symlink for it to avoid confusion. Use the following command to generate a udev rule to create a symlink:

$ pylon2mqtt generate-udev-rule -s /dev/ttyUSB0 

put the output into a rules file in /etc/udev/rules.d/ and then use the symlink instead of ttyUSB0.

Metadata

Release files for pylon2mqtt 0.3.0

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

Source distribution (sdist)

Source distribution for pylon2mqtt 0.3.0
File Size Uploaded Provenance Actions
pylon2mqtt-0.3.0.tar.gz 17.7 kB Without provenance Details for pylon2mqtt-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pylon2mqtt 0.3.0
File Interpreter ABI Platform Actions
pylon2mqtt-0.3.0-py3-none-any.whl Python 3 none any Details for pylon2mqtt-0.3.0-py3-none-any.whl

Total release size: 32.6 kB

Release files / pylon2mqtt-0.3.0.tar.gz

Download URL pylon2mqtt-0.3.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b4d2c0f48ef993bf4eb18040c70af0451d97a4b83aca037a943b6f54261ba84c
BLAKE2b-256 checksum
How to use checksums
72bcddddcb1cd0153d01f8d22bb3004597b65ee863963b23d6a264e0515feded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.6

Release files / pylon2mqtt-0.3.0-py3-none-any.whl

Download URL pylon2mqtt-0.3.0-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe2ba6bbc1cba50d7442d523887802ef5ae9000a01b55caa41eb6f94df8074bc
BLAKE2b-256 checksum
How to use checksums
68845d05bcd13ccb7aa5729038226eeb16cfe1125fcf89ad7be5ce30d9a26ecf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.6

Security for pylon2mqtt 0.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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