Skip to content

syssi/esphome-smg-ii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

101 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esphome-smg-ii

GitHub actions GitHub stars GitHub forks GitHub watchers "Buy Me A Coffee"

ESPHome configuration to monitor and control a ISolar/EASUN SMG II inverter via RS232

Supported devices

  • ISolar SMG II
  • EASUN SMG II
  • SMG III 6.2kW 48V (mostly supported, some registers may not work)
  • PowMr POW-HVM5.5K-48V / POW-HVM5.5K-48V-P
  • Qoltec 53963 (supports SUF output priority)
  • Anenji 3kW-24Vdc-120Vac (supports SUF output priority)
  • Anenji 6200W-WiFi (charging priority "Utility first" probably not supported)

Requirements

  • ESPHome 2024.6.0 or higher.
  • One half of an ethernet cable with RJ45 connector
  • RS232-to-TTL module (MAX3232CSE f.e.)
  • Generic ESP32 or ESP8266 board

Schematics

               RS232                     UART-TTL
┌──────────┐              ┌──────────┐                ┌─────────┐
│          │              │          │<----- RX ----->│         │
│          │<---- TX ---->│  RS232   │<----- TX ----->│ ESP32/  │
│  SMG-II  │<---- RX ---->│  to TTL  │<----- GND ---->│ ESP8266 │
│          │<---- GND --->│  module  │<-- 3.3V VCC -->│         │<--- VCC
│          │              │          │                │         │<--- GND
└──────────┘              └──────────┘                └─────────┘

RJ45 jack

Pin Purpose MAX3232 pin Color T-568B
1 TX P13 (RIN1) White-Orange
2 RX P14 (DOUT1) Orange
3
4 VCC 12V - Blue
5
6
7
8 GND P15 (GND) Brown

Please be aware of the different RJ45 pinout colors (T-568A vs. T-568B).

Alternative: USB-A COM port (6KW firmware variant)

Some SMG II units (confirmed: 6KW/48V) expose RS232 via a USB-A COM port instead of the RJ45 jack. The USB data lines carry RS232 signals — VBUS and GND retain their standard meaning.

               RS232 via USB-A             UART-TTL
┌──────────┐                ┌──────────┐                ┌─────────┐
│          │  D+ ──── TX ──>│          │<----- RX ─────>│         │
│  SMG-II  │  D- ──── RX ──<│  MAX3232 │<----- TX ─────>│ ESP32   │
│  6KW     │  GND ─── GND ─>│  module  │<----- GND ────>│ S2 Mini │
│  USB-A   │  VBUS not used │          │<── 3.3V VCC ──>│         │
└──────────┘                └──────────┘                └─────────┘

USB-A COM port pinout

USB-A pin Label RS232 signal Wire color (example)
1 VBUS not connected red (unused)
2 D- RX (inverter → ESP) yellow
3 D+ TX (ESP → inverter) blue
4 GND GND black

A generic USB-A male DIP breakout board is the easiest way to access these pins without cutting a cable.

Wakeup sequence

This firmware variant requires a proprietary wakeup frame before the first Modbus read. One transmission at boot is sufficient — the inverter stays awake as long as polls arrive within ≤10 s:

01 AA 06 DE A2

Register map (6KW firmware)

⚠️ This firmware uses different register addresses than the standard SMG II firmware documented in the Protocol section below. The addresses 201+ do not respond on these units. The following registers were confirmed by empirical scan:

Address (hex) Address (dec) Description Scale Unit Signed
0x0050 80 Grid voltage ×0.1 V No
0x0052 82 Grid frequency ×0.01 Hz No
0x0058 88 Output voltage ×0.1 V No
0x005A 90 Output frequency ×0.01 Hz No
0x0159 345 Battery voltage ×0.1 V No
0x015C 348 Float voltage ×0.1 V No
0x015D 349 Battery current ×0.1 A Yes
0x0177 375 Bulk charge voltage ×0.1 V No

Use esp32-s2-mini-usb-a-example.yaml as a starting point for this hardware variant.

MAX3232

Pin Label ESPHome ESP8266 example ESP32 example
P11 (DIN1) TXD tx_pin GPIO4 GPIO16
P12 (ROUT1) RXD rx_pin GPIO5 GPIO17
P16 (VCC) VCC
P15 (GND) GND

Installation

Use the esp32-example.yaml / esp8266-example.yaml as proof of concept:

# Install esphome
pip3 install esphome

# Clone this project
git clone https://github.com/syssi/esphome-smg-ii.git
cd esphome-smg-ii

# Create a secret.yaml containing some setup specific secrets
cat > secrets.yaml <<EOF
wifi_ssid: MY_WIFI_SSID
wifi_password: MY_WIFI_PASSWORD

mqtt_host: MY_MQTT_HOST
mqtt_username: MY_MQTT_USERNAME
mqtt_password: MY_MQTT_PASSWORD
EOF

# Validate the configuration, create a binary, upload it, and start logs
# If you use a esp8266 run the esp8266-examle.yaml
esphome run esp32-example.yaml

Protocol

The protocol is Modbus RTU via RS232.

Description Unit Res Addr Len R/W Values
Fault code ULong 100 2 R
Warning code ULong 108 2 R
Serial number Ascii 186 12 R
Operation Mode UInt 201 1 R 0: Power On
1: Standby
2: Mains
3: Off-Grid
4: Bypass
5: Charging
6: Fault
Effective mains voltage 0.1V Int 202 1 R
Mains Frequency 0.01Hz Int 203 1 R
Average mains power 1W Int 204 1 R
Effective inverter voltage 0.1V Int 205 1 R
Effective inverter current 0.1A Int 206 1 R
Inverter frequency 0.01Hz Int 207 1 R
Average inverter power 1W Int 208 1 R Positive numbers indicate inverter output
Negative numbers indicate inverter input
Inverter charging power 1W Int 209 1 R
Output effective voltage 0.1V Int 210 1 R
Output effective Current 0.1A Int 211 1 R
Output frequency 0.01Hz Int 212 1 R
Output active power 1W Int 213 1 R
Output apparent power 1VA Int 214 1 R
Battery average voltage 0.1V Int 215 1 R
Battery average Current 0.1A Int 216 1 R
Battery average power 1W Int 217 1 R
PV average voltage 0.1V Int 219 1 R
PV average Current 0.1A Int 220 1 R
PV average power 1W Int 223 1 R
PV charging average power 1W Int 224 1 R
Load percentage 1% Int 225 1 R
DCDC Temperature 1°C Int 226 1 R
Inverter Temperature 1°C Int 227 1 R
Battery state of charge 1% UInt 229 1 R
Battery average current 0.1A Int 232 1 R Positive number means charging
Negative number means discharging
Inverter charging average current 0.1A Int 233 1 R
PV charging average current 0.1A Int 234 1 R
Output Mode Uint 300 1 R/W 0: Single
1: Parallel
2: 3 Phase-P1
3: 3 Phase-P2
4: 3 Phase-P3
Output priority Uint 301 1 R/W 0: Utility-PV-Battery (UTI)
1: PV-Utility-Battery (SOL)
2: PV-Battery-Utility (SBU)
3: PV-Utility-Battery (SUB)
4: PV-Utility-Feed (SUF) (some devices only, e.g. Qoltec 53963, Anenji 3kW-24Vdc-120Vac)
Input voltage range Uint 302 1 R/W 0: Wide range
1: Narrow range
Buzzer mode Uint 303 1 R/W 0: Mute in all situations
1: Sound when the input source is changed or there is a specific warning or fault
2: Sound when there is aspecific warning or fault
3: Sound when fault occurs
LCD backlight Uint 305 1 R/W 0: Timed off
1: Always on
LCD automatically returns to the homepage Uint 306 1 R/W 0: Do not return automatically
1: Automatically return after 1 minute
Energy-saving mode Uint 307 1 R/W 0: Energy-saving mode is off
1: Energy-saving mode is on
Overload automatic restart Uint 308 1 R/W 0: Overload failure will not restart
1: Automatic restart after overload failure
Over temperature automatic restart Uint 309 1 R/W 0: Over temperature failure will not restart
1: Automatic restart after over-temperature fault
Overload transfer to bypass enabled Uint 310 1 R/W 0: Disable
1: Enable
Battery Eq mode is enabled Uint 313 1 R/W 0: Disable
1: Enable
Output voltage 0.1V Uint 320 1 R/W
Output frequency 0.01Hz Uint 321 1 R/W
Battery overvoltage protection point 0.1V Uint 323 1 R/W
Max charging voltage 0.1V Uint 324 1 R/W
Floating charging voltage 0.1V Uint 325 1 R/W
Battery discharge recovery point in mains mode 0.1V Uint 326 1 R/W
Battery low voltage protection point in mains mode 0.1V Uint 327 1 R/W
Battery low voltage protection point in off-grid mode 0.1V Uint 329 1 R/W
Battery charging priority Uint 331 1 R/W 0: Utility priority
1: PV priority
2: PV is at the same level as the Utility
3: Only PV charging is allowed
Maximum charging current 0.1A Uint 332 1 R/W
Maximum mains charging current 0.1A Uint 333 1 R/W
Eq Charging voltage 0.1V Uint 334 1 R/W
Battery equalization time min Uint 335 1 R/W Range: 0~900
Equalization timeout exit min Uint 336 1 R/W Range: 0~900
Two equalization charging intervals day Uint 337 1 R/W Range: 1~90
Turn on mode Uint 406 1 R/W 0: Can be turn-on locally or remotely
1: Only local turn-on
2: Only remote turn-on
Remote switch Uint 420 1 R/W 0: Remote shutdown
1: Remote turn-on
Exit the fault mode Uint 426 W 1: Exit the fault state (only when the inverter enters the fault mode, it could be available)
Rated Power W Uint 643 1 R

Known issues

None.

Debugging

If this example doesn't work out of the box for your device please update your configuration to enable the debug output of the UART component and increase the log level to the see outgoing and incoming serial traffic:

logger:
  level: DEBUG
  # Don't write log messages to UART0 (GPIO1/GPIO3) if the inverter is connected to GPIO1/GPIO3
  baud_rate: 0

uart:
  id: uart_0
  baud_rate: 9600
  tx_pin: ${tx_pin}
  rx_pin: ${rx_pin}
  debug:
    direction: BOTH
    dummy_receiver: false

References

About

ESPHome configuration to monitor and control a ISolar/EASUN SMG II inverter via RS232

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors

Languages