Pylontech-monitor (in Real-time)
An ESPHome component that reads Pylontech battery racks (US2000/3000/5000) over the console port, with optional W5500 wired Ethernet for stable monitoring.
저자 소개
이 컴포넌트는 @Dackara 가 @kjm5759 의 원작을 기반으로 ESPHome 공식 스타일의 외부 컴포넌트로 구조화한 것입니다. Dackara는 실제 Pylontech 배터리(US2000/US5000)를 운용하는 사용자이자 기여자로, 2024년 초 ESPHome 커뮤니티에 Pylontech의 SOH·배터리 수·잔여 전류·사이클 값을 추가해 달라는 기능 요청을 올린 이력이 있습니다(콘솔 CLI의 pwrsys·getpwr·stat 명령 활용을 직접 제안). 즉 "자신이 필요해서 만든" 실사용 기반 프로젝트로 보이며, 원저작자 크레딧을 명확히 표기하는 오픈소스 예의를 지키고 있습니다. (본인이 영어가 모국어가 아님을 밝힌 바 있어, 프랑스어권 등 비영어권 사용자로 추정되나 단정하지는 않습니다..)
| Component | Notes | Qty |
|---|---|---|
| ESP32 / ESP32-S3 | ESPHome 실행 (S3에서 테스트됨) | x 1 |
| WIZnet W5500 이더넷 모듈 | 옵션 유선 이더넷(SPI) — WiFi 대안, 안정성 권장 | x 1 |
| Pylontech 배터리 랙 | US2000B/US2000C/US3000/US5000 (최대 10팩 × 15셀) | x 1~10 |
| RS232-to-TTL 어댑터 | MAX3232 등 — 콘솔 포트(RS232 TTL)와 ESP32 UART 사이 | x 1 |
| 릴레이 (옵션) | ESP32에서 직접 트리거 (HA 없이 동작) | x 1 |
프로젝트가 하는 일
ESPHome Pylontech Monitor는 Pylontech 배터리 랙(US2000·US3000·US5000) 을 ESP32로 모니터링하는 ESPHome 외부 컴포넌트입니다. 마스터 배터리의 콘솔 포트(RS232 TTL) 에 연결해 Pylontech CLI 명령(pwrsys, pwr, getpwr N, stat N)으로 데이터를 읽습니다. 최대 10팩 × 15셀을 지원합니다.
- 랙 전체: 전압·전류·SOC·SOH·용량·전력
- 팩별: 전압·전류·온도·셀 전압(×15)·사이클·쿨롱·SOH
- 이중 갱신 주기: 빠른 주기(기본 2초,
pwrsys+pwr→ SOC/전압/전류) + 느린 주기(기본 60초,getpwr+stat→ 셀 전압·사이클·쿨롱) - 옵션 통합 릴레이: Home Assistant 없이 ESP32에서 직접 트리거 (예: 태양광 잉여 전력으로 온수기 가동)
- 네트워크: WiFi 또는 W5500 유선 이더넷 (패키지로 손쉽게 전환)
- ESP32-S3 + Pylontech US2000/US5000에서 테스트됨
WIZnet이 들어가는 위치
이 컴포넌트의 네트워크 연결 옵션으로 W5500 유선 이더넷이 지원됩니다. README는 "안정성을 위해 W5500 권장" 이라고 명시합니다.
- 역할: ESP32가 배터리에서 읽은 데이터를 W5500 유선 이더넷으로 Home Assistant/네트워크에 전송. WiFi 대신 유선을 쓰면 끊김 없이 안정적으로 모니터링됩니다.
- 연결: SPI. ESPHome 표준
ethernet:플랫폼type: W5500로 설정. - 핀맵(ESP32-S3 기준, README 명시):
- MOSI = GPIO11 · MISO = GPIO13 · SCLK = GPIO12 · CS = GPIO10 · INT = GPIO9 · RST = GPIO14 · 3.3V · GND
- ESPHome YAML의
packages:를 쓰면 WiFi ↔ W5500 이더넷 전환이 쉽습니다.
즉 W5500은 배터리 모니터링 데이터를 안정적인 유선 이더넷으로 실어 나르는 네트워크 계층입니다. 배터리 ESS는 보통 상시 가동·장기 모니터링이 필요하므로, WiFi 끊김에 취약한 환경에서 유선 W5500이 신뢰성을 높여줍니다.
배선 메모 (콘솔 포트)
- ⚠️ 이 컴포넌트는 CAN/RS485 BMS 포트가 아니라 마스터 배터리의 콘솔 포트(RJ45) 를 사용합니다.
- 콘솔 포트는 RS232 TTL 레벨이라, Pylontech와 ESP32 UART 사이에 RS232-to-TTL 어댑터(MAX3232 등) 가 필요합니다.
- ⚠️ 클래식 ESP32(비 S3)의 GPIO1/GPIO3 충돌: 이 핀은 UART0(USB/로깅)와 겹칩니다. Pylontech UART는 다른 핀(예: GPIO16=RX / GPIO17=TX) 을 쓰세요. ESP32-S3는 이 제약이 없습니다.
- ⚠️ US2000B 보드율 초기화: US5000·최근 US2000C는 115200으로 바로 시작하지만, 구형 US2000B는 전원 인가 후 1200 baud로 시작합니다. US2000B 마스터는 1200 baud에서 초기화 시퀀스를 보내 115200으로 전환해야 하며, 이 자동 초기화는 현재 버전 미구현(US5000/US2000C엔 불필요)입니다.
구현 메모
- 플랫폼: ESPHome 외부 컴포넌트(
external_components:로 추가). 언어는 ESPHome/C++. - 설정 예:
uart:(tx/rx/baud 115200/rx_buffer 8192) +pylontech_monitor:(battery_count 1~10, update_interval, slow_interval, 시스템/팩/셀 센서, 옵션 relay). - 릴레이 로직: SOC ≥ 임계 AND 전압 ≥ 임계면 ON, SOC < (임계−히스테리시스) OR 전압 < 임계면 OFF.
- 테스트: US2000C·US5000 (펌웨어 V2.8/V3.x)에서 확인.
유사 프로젝트
https://maker.wiznet.io/gunn/projects/esp32-s3-ethernet-w5500-modbus-tcp-connect-to-modbus-poll/
두 프로젝트는 모두 ESP32-S3 + W5500으로 에너지/배터리 데이터를 유선 이더넷으로 전송한다는 점에서 유사합니다. Pylontech Monitor는 Pylontech 배터리를 콘솔 포트로 읽어 모니터링하고, gunn의 프로젝트는 전압·전류·온도를 Modbus TCP로 전송하는 예제입니다. 둘 다 전압·전류·온도 같은 배터리/에너지 데이터를 다룹니다.
| 항목 | Pylontech Monitor | ESP32-S3 W5500 Modbus TCP (gunn) |
|---|---|---|
| 목적 | Pylontech 배터리 모니터링 | Modbus TCP 데이터 전송 |
| MCU | ESP32 / ESP32-S3 | ESP32-S3 |
| 데이터 | SOC·전압·전류·온도·셀 | 전압·전류·온도·알람 |
| W5500 | 옵션 유선 이더넷(SPI) | 유선 이더넷(SPI) |
| 프레임워크 | ESPHome | Arduino/Modbus |
FAQ
Q: 이 프로젝트는 무엇인가요? A: Pylontech 배터리 랙을 콘솔 포트로 읽어 ESPHome/Home Assistant에서 모니터링하는 컴포넌트입니다. 최대 10팩·15셀을 지원합니다.
Q: W5500은 어떻게 쓰이나요? A: 네트워크 연결을 WiFi 대신 W5500 유선 이더넷(SPI)으로 할 수 있습니다. ESPHome ethernet: type: W5500 로 설정하며, 안정성을 위해 권장됩니다.
Q: W5500 핀은 무엇인가요? (ESP32-S3) A: MOSI=GPIO11, MISO=GPIO13, SCLK=GPIO12, CS=GPIO10, INT=GPIO9, RST=GPIO14 입니다.
Q: 어떤 포트에 연결하나요? A: CAN/RS485 BMS 포트가 아니라 마스터 배터리의 콘솔 포트(RS232 TTL)입니다. RS232-TTL 어댑터가 필요합니다.
About the Author
This component is structured by @Dackara, based on original work by @kjm5759, as an ESPHome official-style external component. Dackara is an actual Pylontech user (US2000/US5000) and contributor: in early 2024 he opened an ESPHome feature request asking to add State of Health, battery count, residual current, and cycle count for Pylontech, proposing use of the console CLI commands (pwrsys, getpwr, stat). In other words, this reads as a real-use, "built because I needed it" project, and it credits the original author clearly per open-source etiquette. (He has noted English isn't his first language, suggesting a non-English-speaking — possibly French-speaking — user)
What the Project Does
ESPHome Pylontech Monitor is an ESPHome external component that monitors Pylontech battery racks (US2000, US3000, US5000) with an ESP32. It connects to the master battery's console port (RS232 TTL) and reads data via the Pylontech CLI (pwrsys, pwr, getpwr N, stat N). It supports up to 10 packs × 15 cells.
- Whole rack: voltage, current, SOC, SOH, capacity, power
- Per pack: voltage, current, temperature, cell voltages (×15), cycles, coulomb, SOH
- Dual update rate: fast (default 2 s,
pwrsys+pwr→ SOC/voltage/current) + slow (default 60 s,getpwr+stat→ cell voltages, cycles, coulomb) - Optional integrated relay: triggers directly on the ESP32 without Home Assistant (e.g., a water heater on solar surplus)
- Network: WiFi or W5500 wired Ethernet (easy to switch via packages)
- Tested on ESP32-S3 with Pylontech US2000/US5000
Where WIZnet Fits
The component's network option is W5500 wired Ethernet, which the README explicitly recommends for stability.
- Role: the ESP32 sends the battery data it reads out over W5500 wired Ethernet to Home Assistant/the network — a wired link keeps monitoring stable where WiFi drops.
- Connection: SPI, configured via ESPHome's standard
ethernet:platform withtype: W5500. - Pin map (ESP32-S3, per README): MOSI = GPIO11 · MISO = GPIO13 · SCLK = GPIO12 · CS = GPIO10 · INT = GPIO9 · RST = GPIO14 · 3.3V · GND
- ESPHome
packages:make it easy to switch between WiFi and W5500 Ethernet.
So the W5500 is the network layer that carries battery-monitoring data over a stable wired link. Since battery ESS installations usually need always-on, long-term monitoring, wired W5500 improves reliability where WiFi is unreliable.
Wiring Notes (console port)
- ⚠️ This component uses the console port (RJ45) of the master battery — not the CAN or RS485 BMS port.
- The console port is RS232 TTL, so you need an RS232-to-TTL adapter (MAX3232 or similar) between the Pylontech and the ESP32 UART.
- ⚠️ GPIO1/GPIO3 conflict on classic ESP32 (not S3): those are UART0 (USB/logging). Use different GPIOs for the Pylontech UART (e.g., GPIO16=RX / GPIO17=TX). ESP32-S3 doesn't have this restriction.
- ⚠️ US2000B baud init: US5000 and recent US2000C start at 115200 directly, but older US2000B starts at 1200 baud after a power cycle and needs an init sequence to switch to 115200 — this auto-init is not yet implemented (not needed for US5000/US2000C).
Implementation Notes
- Platform: ESPHome external component (added via
external_components:), ESPHome/C++. - Config:
uart:(tx/rx/baud 115200/rx_buffer 8192) +pylontech_monitor:(battery_count 1–10, update_interval, slow_interval, system/per-pack/cell sensors, optional relay). - Relay logic: ON if SOC ≥ threshold AND voltage ≥ threshold; OFF if SOC < (threshold − hysteresis) OR voltage < threshold.
- Tested: US2000C and US5000 (firmware V2.8/V3.x).
Similar Project
https://maker.wiznet.io/gunn/projects/esp32-s3-ethernet-w5500-modbus-tcp-connect-to-modbus-poll/
Both use an ESP32-S3 + W5500 to send energy/battery data over wired Ethernet. Pylontech Monitor reads and monitors Pylontech batteries over the console port; gunn's project transmits voltage/current/temperature over Modbus TCP. Both handle battery/energy data such as voltage, current, and temperature.
| Item | Pylontech Monitor | ESP32-S3 W5500 Modbus TCP (gunn) |
|---|---|---|
| Purpose | Monitor Pylontech batteries | Modbus TCP data transmission |
| MCU | ESP32 / ESP32-S3 | ESP32-S3 |
| Data | SOC·voltage·current·temp·cells | voltage·current·temp·alarm |
| W5500 | Optional wired Ethernet (SPI) | Wired Ethernet (SPI) |
| Framework | ESPHome | Arduino/Modbus |
FAQ
Q: What is this project? A: An ESPHome component that reads Pylontech battery racks over the console port for monitoring in ESPHome/Home Assistant, supporting up to 10 packs × 15 cells.
Q: How is the W5500 used? A: As the network option instead of WiFi — W5500 wired Ethernet (SPI), set via ESPHome ethernet: type: W5500, recommended for stability.
Q: What are the W5500 pins (ESP32-S3)? A: MOSI=GPIO11, MISO=GPIO13, SCLK=GPIO12, CS=GPIO10, INT=GPIO9, RST=GPIO14.
Q: Which port does it connect to? A: The master battery's console port (RS232 TTL), not the CAN/RS485 BMS port. An RS232-to-TTL adapter is required.
Bottom metadata fields
- Programming Language: C++ (ESPHome external component) · YAML
- Application: 배터리 모니터링 · ESS · ESPHome/Home Assistant · 에너지
- Tags: W5500, ESP32, ESP32-S3, ESPHome, Home-Assistant, Pylontech, battery, BMS, monitoring, RS232, Ethernet, MIT
