Skip to content

About

A Home Assistant integration for reading values from Pylontech batteries.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Pylontech Serial Integration for Home Assistant

HACS Custom

Connect your Pylontech US2000/US3000 battery stack directly to Home Assistant using a USB-to-RS232/RS485 cable.

Features

  • Direct Serial Connection: Reads battery data directly from the Console port.
  • Home Assistant Native: No MQTT or Docker containers required.
  • Energy Dashboard Ready: Includes calculated Energy (kWh) sensors for proper dashboard Integration.
  • Per-Battery Monitoring: Voltage, Current, SOC, Temperature, and Status for each module.
  • Per-Battery Configuration: Individually tune the capacity of each battery module (Number entity) to accurately compute total stored energy.
  • Diagnostics & Raw Data: Track system health (SOH), cycle count, firmware version, and view raw serial responses for debugging.
  • Time Synchronization: Automatically or manually sync Home Assistant's time with your BMS internal clock.
  • Custom Commands: Send arbitrary raw serial commands directly to the BMS using the built-in Home Assistant service.

Warning

Disclaimer: This integration interacts directly with your hardware. Incorrect configuration or usage could potentially cause damage to your batteries or connected devices. The creators and contributors of this integration take no responsibility for any damage, data loss, or other issues that may arise from using this software. Use at your own risk.

Important

This integration is not affiliated with or endorsed by Pylontech. It is a completely independent project, backed up by the community, and based on official documentation, commands, and reverse engineering.

Note

USB Auto-Discovery: Currently, only the Prolic PL2303 scanner (VID 067B, PID 2303) is supported for auto-discovery. If you have a different adapter, it will not be automatically detected, but you can still manually select the port during configuration.

To add auto-discovery support for your device, please see CONTRIBUTING.md.

Note

Disclaimer: this project has been generated mainly by AI. Even though it has been reviewed and tested by a professional programmer, I feel like it's important to disclose this fact.

Installation

Via HACS (Recommended)

  1. Ensure you have HACS installed.
  2. Go to HACS > Integrations.
  3. Click the 3 dots (top right) > Custom repositories.
  4. Add the URL of this repository.
  5. Category: Integration.
  6. Click Add, then find and install Pylontech Serial.
  7. Restart Home Assistant.

Manual Installation

  1. Locate your configuration directory: Find your Home Assistant config folder (where configuration.yaml lives).
  2. Create custom_components: If it doesn't exist, create a folder named custom_components inside your config folder.
  3. Copy files: Copy the pylontech_serial folder from custom_components/ in this repository to your Home Assistant's custom_components/ folder.
    • Resulting path: /config/custom_components/pylontech_serial/
  4. Restart Home Assistant: This is crucial for HA to recognize the new component.

Configuration

  1. Connect your Pylontech battery to the machine running Home Assistant via USB.
  2. In Home Assistant, go to Settings > Devices & Services.
  3. Click + ADD INTEGRATION in the bottom right.
  4. Search for Pylontech Serial.
  5. Select your Serial Port from the list.
  6. Configure the Baud Rate (Default 115200) and Poll Interval (Default 15 seconds) if needed.
  7. Click Submit.

Battery Capacity Configuration

Instead of a global configuration, this integration provides a Number Entity for each detected battery module. Once the integration is added, navigate to the device page for each module to adjust its capacity (in kWh). This ensures that the integration accurately calculates the total stored energy across batteries of different sizes.

Hardware Configuration

Ensure your battery DIP switches are configured correctly for communication. For US2000/US3000, all DIP switches OFF selects the default baud rate of 115200.

DIP Switches Pylontech US2000 with all DIP switches OFF

Energy Dashboard Setup

To track your battery usage in the Energy Dashboard:

  1. Go to Settings > Dashboards > Energy.
  2. Find the Battery Systems section and click Add Battery System.
  3. For Energy going in to the battery, select: sensor.pylontech_stack_system_energy_charged
  4. For Energy coming out of the battery, select: sensor.pylontech_stack_system_energy_discharged
  5. Click Save.

Troubleshooting

  • No data?: Check that the correct serial port is selected and that the cable is plugged into the Console port of the Master battery (not CAN/RS485 unless using a specific adapter).
  • Permissions: If running Home Assistant Core in Docker (not OS), ensure the device is passed through (--device /dev/ttyUSB0).

About

A Home Assistant integration for reading values from Pylontech batteries.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages