Skip to content

Hassio addon to monitor pylontech batteries through serial port

License

Notifications You must be signed in to change notification settings

bennieswart/hassio-pylontech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a hassio addon to monitor pylontech batteries.

The battery is connected by RS232 and data is published as JSON to an MQTT broker. It publishes the data to the following topic:

  • 'power/pylon' for the data from the master battery and slaves

You can then configure the sensors in Home Assistant like this:

sensors:
  - platform: mqtt
    name: "Battery1 SOC"
    state_topic: "power/pylon"
    unit_of_measurement: '%'
    value_template: "{{ value_json[0].Coulomb }}"

See the function get_power in monitor.py for the values published on power/pylon.

Install

Add https://github.com/bennieswart/home-assistant-addons to the addon store repositories and you will get a Pylontech Battery listed there. Note that this assumes the battery is /dev/ttyUSB. If you have other USB to Serial devices connected this might be wrong.

Manual build and run

# Build the docker image
docker build --build-arg BUILD_FROM=alpine -t pylon-monitor .

# Run the container
# You will need to edit options.json or add the proper environment variables
docker run                                     \
    -dit                                       \
    --name pylon-monitor                       \
    --device /dev/ttyUSB0                      \
    -v $(pwd)/options.json:/data/options.json  \
    -e MQTT_CLIENT_ID=pylon0                   \
    --restart unless-stopped                   \
    pylon-monitor

Connection

You will need a pylontech console cable (RS232) to connect the master battery to your monitoring device's USB port. This code only supports RS232 communication and will not work with RS485.

Known working configurations

  • Four Pylontech US3000C running on Raspberry Pi 4.

About

Hassio addon to monitor pylontech batteries through serial port

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published