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
.
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.
# 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
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.
- Four Pylontech US3000C running on Raspberry Pi 4.