Skip to main content

Pylon Battery statistics to MQTT exporter

Project description

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylon2mqtt-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylon2mqtt-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pylon2mqtt-0.1.0.tar.gz.

File metadata

  • Download URL: pylon2mqtt-0.1.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for pylon2mqtt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7432851c1825e1c6e435de30caeb06d2ff7dcf00d3d55240becbb5e43effacf4
MD5 c9af4170bf052d2f9f36abf4f26605ca
BLAKE2b-256 109d028e62e61d50d640fccccbfac1ddb12f959942dc08c8769c8aac5eb58b8d

See more details on using hashes here.

File details

Details for the file pylon2mqtt-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pylon2mqtt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56df87675092dc4d8a805432141f85c449957706e60f54ab0e266de9cc99dc0b
MD5 7b5c158bf4b290a92ec126011c84412f
BLAKE2b-256 c4eefa7f1093efe6522e3c77521a9f1f6c6700cc31dd8108ce1743933c75cdbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page