Skip to content

Latest commit

 

History

History
207 lines (162 loc) · 6.77 KB

pylontech.rst

File metadata and controls

207 lines (162 loc) · 6.77 KB

Pylontech Battery

.. seo::
    :description: Instructions for setting up Pylontech Battery in ESPHome.
    :image: pylontech.jpg

The Pylontech component allows you to pull data from Pylontech Batteries into ESPHome. It uses :ref:`UART <uart>` for communication.

Once configured, you can use sensors as described below for your projects.

images/pylontech.jpg

Pylontech Batteries

Hardware Setup

You can connect to Pylontech Batteries using the port labeled "Console". Any connections via CAN or RS485 (e.g. to an inverter) are untouched and remain functional.

The console port offers a RS232 interface using a RJ11 or RJ45 connector. The voltage levels are not TTL-compatible. A RS232 transceiver must be placed between the Batteries and the ESPHome device. MAX3232-based transceivers have been tested and work well.

If you have multiple batteries you need to connect to the master battery's console port.

Pylontech RJ45 Console Port (US2000C, US3000C, US5000C)
RJ45 Pin TIA-568B Color TIA-568A Color Function Connect to
3 White/Green White/Orange Pylontech TX ESPHome RX via transceiver
6 Green Orange Pylontech RX ESPHome TX via transceiver
8 Brown Brown GND GND
images/rj45_pinout.jpg

RJ45 pinout

Pylontech RJ11 Console Pinout (US2000B, US2000)
RJ11 Pin Function Connect to
2 Pylontech RX ESPHome TX via transceiver
3 Pylontech TX ESPHome RX via transceiver
4 GND GND

Component/Hub

# Example configuration entry
pylontech:

Configuration variables:

  • id (Required, :ref:`config-id`): The id to use for this Pylontech component.
  • uart_id (Optional): The uart Bus ID
  • update_interval (Optional, :ref:`config-time`): The interval to check the sensor. Defaults to 60s.

Sensor

All values are reported for every Pylontech battery individually.

# Example configuration entry
sensor:
  - platform: pylontech
    battery: 1

    voltage:
      name: "Battery1 Voltage"
    current:
      name: "Battery1 Current"
    coulomb:
      name: "Battery1 State of Charge"

Configuration variables:

Text Sensor

# Example configuration entry
text_sensor:
  - platform: pylontech
    pylontech_id: pylontech0
    battery: 1

    base_state:
      id: bat1_base_state
      name: "Battery1 Base State"

Configuration variables:

Energy Monitoring

By combining :doc:`template sensors </components/sensor/template>` and :doc:`integration sensors </components/sensor/integration>` one can monitor the energy flowing into and out of all batteries combined, ready for Homeassistant Energy Monitoring.

sensor:
  - platform: template
    id: pylontech_power
    name: "Pylontech power"
    unit_of_measurement: W
    lambda: |-
      auto pwr1 = id(bat1_voltage).state * id(bat1_current).state;
      auto pwr2 = id(bat2_voltage).state * id(bat2_current).state;
      auto pwr = pwr1 + pwr2;
      id(combined_charge_power).publish_state(max(pwr, 0.0f));
      id(combined_discharge_power).publish_state(max(-pwr, 0.0f));
      return pwr;
    update_interval: 5s
    device_class: power
    state_class: measurement

  - platform: template
    id: combined_charge_power

  - platform: template
    id: combined_discharge_power

  - platform: integration
    name: "Pylontech charging"
    sensor: combined_charge_power
    time_unit: h
    state_class: total_increasing
    device_class: energy
    unit_of_measurement: "Wh"

  - platform: integration
    name: "Pylontech discharging"
    sensor: combined_discharge_power
    time_unit: h
    state_class: total_increasing
    device_class: energy
    unit_of_measurement: "Wh"

See Also