ESPHome modbus Growatt ShineWiFi-S

Does anybody got the ShineWifi-F Stick working with the SPF5000 Inverter?

I have flashed it with ESPHome and it works, but the received Data makes no sense.

It is plugged in the original Port.

Kind regards!

1 Like

I used your code with an ESP32 (instead of esp8266) on my SPF5000ES but i got the following errors. Seems there are missing function ref (03 for read holding register/04 for read input register)?
I used Pin 7 and 8 for the A/B on RS485-TTL adapter but do you need to connect the GND to any RJ45 pin?
I also used the RS485 port (RJ45) for my setup.

[04:38:32][C][logger:301]: Logger:
[04:38:32][C][logger:302]:   Level: DEBUG
[04:38:32][C][logger:303]:   Log Baud Rate: 0
[04:38:32][C][logger:305]:   Hardware UART: UART0
[04:38:32][C][uart.arduino_esp32:124]: UART Bus 0:
[04:38:32][C][uart.arduino_esp32:125]:   TX Pin: GPIO1
[04:38:32][C][uart.arduino_esp32:126]:   RX Pin: GPIO3
[04:38:32][C][uart.arduino_esp32:128]:   RX Buffer Size: 256
[04:38:32][C][uart.arduino_esp32:130]:   Baud Rate: 9600 baud
[04:38:32][C][uart.arduino_esp32:131]:   Data Bits: 8
[04:38:32][C][uart.arduino_esp32:132]:   Parity: NONE
[04:38:32][C][uart.arduino_esp32:133]:   Stop bits: 1
[04:38:32][C][modbus:143]: Modbus:
[04:38:32][C][modbus:145]:   Send Wait Time: 250 ms
[04:38:32][C][modbus:146]:   CRC Disabled: NO
[04:38:32][C][template.text_sensor:020]: Template Sensor 'Growatt Inverter Status'
[04:38:32][C][template.text_sensor:020]:   Icon: 'mdi:eye'
[04:38:33][C][modbus_controller:275]: ModbusController:
[04:38:33][C][modbus_controller:276]:   Address: 0x01
[04:38:33][D][modbus_controller:032]: Modbus command to device=1 register=0x00 countdown=0 no response received - removed from send queue
[04:38:33][W][modbus_controller:113]: Duplicate modbus command found: type=0x3 address=37 count=2
[04:38:33][W][modbus_controller:113]: Duplicate modbus command found: type=0x3 address=95 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=3 count=2
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=7 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=10 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=14 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=17 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=48 count=2
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=57 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=68 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=70 count=1
[04:38:34][W][modbus_controller:113]: Duplicate modbus command found: type=0x4 address=82 count=1
[04:38:35][D][modbus_controller:032]: Modbus command to device=1 register=0x30 countdown=0 no response received - removed from send queue

Hi. Post your code.

substitutions:
  device_name: inverter
  friendly_name: "Growatt Inverter"
  device_description: "Growatt SPF 5000 ES"
  

esphome:
  name: $device_name
  friendly_name: $friendly_name

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  baud_rate: 0
  level: DEBUG
# Enable Home Assistant API
api:
  encryption:
    key: "xxxxx"

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret wifi_password

captive_portal:

time:
  - platform: homeassistant
    id: homeassistant_time

uart:
  id: mod_bus
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600
  #baud_rate: 115200
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
     delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

modbus:
  id: modbus1
  uart_id: mod_bus
#  flow_control_pin: GPIO4

modbus_controller:
  - id: growatt
    address: 0x1
    modbus_id: modbus1
    setup_priority: -10  
    update_interval: 10s 
button:
  - platform: restart
    name: "${device_name} Restart"

text_sensor:
  - platform: template
    name: "${friendly_name} Status"
    icon: mdi:eye
    entity_category: diagnostic
    lambda: |-
      if ((id(status).state) == 1) {
          return {"Normal"};
        } else if ((id(status).state) == 0)  {
          return {"Standby"};
        } else if ((id(status).state) == 2)  {
          return {"Discharge"};
        } else if ((id(status).state) == 3)  {
          return {"Fault"};
        } else if ((id(status).state) == 4)  {
          return {"Flash"};
        } else if ((id(status).state) == 5)  {
          return {"PV Charging"};
        } else if ((id(status).state) == 6)  {
          return {"AC Charging"};
        } else if ((id(status).state) == 7)  {
          return {"Combined Charging"};
        } else if ((id(status).state) == 8)  {
          return {"Combined Charging & Bypass"};
        } else if ((id(status).state) == 9)  {
          return {"PV Charging & Bypass"};
        } else if ((id(status).state) == 10)  {
          return {"AC Charging & Bypass"};
        } else if ((id(status).state) == 11)  {
          return {"Bypass"};
        } else if (id(status).state == 12)  {
          return {"PV Charge and Discharge"};
        } else {
          return {"Unknown"};
        }

sensor:

  - platform: modbus_controller
    address: 0
    register_type: "read"
    internal: true
    accuracy_decimals: 0
    id: status

  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s

# PPV 1 since only 1 PV input 
  - platform: modbus_controller
    name: "PV1 voltage "
    address: 1
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "PV1 Power"
    id: pv1_power_high
    address: 3
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 0
    internal: true    
    filters:
    - multiply: 0.1

# Load Related 
  - platform: modbus_controller
    name: "Load Consumption"
    id: op_power_high
    address: 9
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 0
    internal: true
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "Load Consumption (VA)"
    id: op_apparent_power
    address: 11
    register_type: "read"
    unit_of_measurement: VA
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 0
    internal: true
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "Load %"
    address: 27
    register_type: "read"
    unit_of_measurement: "%"
    device_class: POWER_FACTOR
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 0
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "Load Input Current (A) in AC"
    address: 34
    register_type: "read"
    unit_of_measurement: A
    device_class: power
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "AC Output Voltage"
    address: 22
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "DC Output Voltage"
    address: 24
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "Load Input Current (A)"
    address: 7
    register_type: "read"
    unit_of_measurement: A
    device_class: power
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
# Temperatures Monitors

  - platform: modbus_controller
    name: "Inverter Temperature"
    address: 25
    register_type: "read"
    unit_of_measurement: °C
    device_class: temperature
    entity_category: diagnostic
    state_class: measurement
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  
  - platform: modbus_controller
    name: "PV Temperature"
    address: 32
    register_type: "read"
    unit_of_measurement: °C
    device_class: temperature
    entity_category: diagnostic
    state_class: measurement
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    name: "DC Bus Temperature"
    address: 26
    register_type: "read"
    unit_of_measurement: °C
    device_class: temperature
    entity_category: diagnostic
    state_class: measurement
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

## %percentages ## 

  - platform: modbus_controller
    name: "Battery Voltage"
    address: 17
    register_type: "read"
    unit_of_measurement: "V"
    device_class: voltage
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.01

  - platform: modbus_controller
    name: "Battery SoC"
    address: 18
    register_type: "read"
    unit_of_measurement: "%"
    device_class: POWER_FACTOR
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 0
    filters:
    - multiply: 1

  - platform: modbus_controller
    name: "MPPT Charger fan speed"
    address: 81
    register_type: "read"
    unit_of_measurement: "%"
    device_class: POWER_FACTOR
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 0
    filters:
    - multiply: 1

  - platform: modbus_controller
    name: "Inverter fan speed"
    address: 82
    register_type: "read"
    unit_of_measurement: "%"
    device_class: POWER_FACTOR
    state_class: measurement
    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 0
    filters:
    - multiply: 1

Hi,

Try this and see if is working for you.

platform: modbus_controller
    name: "${devicename} Energy Imported from grid Total"
    address: 1046
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:transmission-tower-export
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

The address is for importing data with esp home from inverter, not from smart meter

Hello Chris,
I’d like to use this solution. I’m new to Home Assistant, and ESPhome so I have a lot of learning to do.
I have a Growatt MIN 3600TL-XE . I’ve put together a D1mini, TTL 485 board and got your code loaded onto it. It seems to startup and occasionally the TX led flashes on the TTL board but no data. I attach the log file.

I have a suspicion that I may be using the wrong pins on the SYS-COM port of the inverter. Most people say 3 and 4 but the manual on my inverter doesn’t clearly indicate if these are Modbus ports… I also attach a picture of that part of the manual.

I’d be very grateful for any pointers.
Eric

Logs

INFO Reading configuration /config/growatt-data.yaml...
INFO Detected timezone 'Etc/UTC'
INFO Generating C++ source...
INFO Compiling app...
Processing growatt (board: esp01_1m; framework: arduino; platform: platformio/espressif8266 @ 3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- ESPAsyncTCP-esphome @ 1.2.3
|   |-- Hash @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|   |-- libsodium @ 1.10018.1
RAM:   [====      ]  43.0% (used 35260 bytes from 81920 bytes)
Flash: [=====     ]  50.3% (used 514685 bytes from 1023984 bytes)
========================= [SUCCESS] Took 3.00 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of growatt.local
INFO  -> 192.168.1.100
INFO Uploading /config/.esphome/build/growatt/.pioenvs/growatt/firmware.bin (518832 bytes)
INFO Compressed to 363011 bytes
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from growatt.local using esphome API
WARNING Can't connect to ESPHome API for growatt.local: Error resolving IP address: [Errno -3] Temporary failure in name resolution
INFO Trying to reconnect to growatt.local in the background
INFO Successfully connected to growatt.local
[16:35:47][I][app:102]: ESPHome version 2023.4.4 compiled on Jun  3 2023, 15:48:20
[16:35:47][C][wifi:505]: WiFi:
[16:35:47][C][wifi:363]:   Local MAC: EC:FA:BC:AD:8A:57
[16:35:47][C][wifi:364]:   SSID: 'PLUSNET-CSC28J'[redacted]
[16:35:47][C][wifi:365]:   IP Address: 192.168.1.100
[16:35:47][C][wifi:366]:   BSSID: C8:99:B2:04:30:8D[redacted]
[16:35:47][C][wifi:368]:   Hostname: 'growatt'
[16:35:47][C][wifi:370]:   Signal strength: -78 dB ▂▄▆█
[16:35:47][C][wifi:374]:   Channel: 1
[16:35:47][C][wifi:375]:   Subnet: 255.255.255.0
[16:35:47][C][wifi:376]:   Gateway: 192.168.1.254
[16:35:47][C][wifi:377]:   DNS1: 192.168.1.254
[16:35:47][C][wifi:378]:   DNS2: 0.0.0.0
[16:35:47][C][logger:294]: Logger:
[16:35:47][C][logger:295]:   Level: DEBUG
[16:35:47][C][logger:296]:   Log Baud Rate: 0
[16:35:47][C][logger:297]:   Hardware UART: UART0
[16:35:47][C][uart.arduino_esp8266:102]: UART Bus:
[16:35:47][C][uart.arduino_esp8266:103]:   TX Pin: GPIO1
[16:35:47][C][uart.arduino_esp8266:104]:   RX Pin: GPIO3
[16:35:47][C][uart.arduino_esp8266:106]:   RX Buffer Size: 256
[16:35:47][C][uart.arduino_esp8266:108]:   Baud Rate: 9600 baud
[16:35:47][C][uart.arduino_esp8266:109]:   Data Bits: 8
[16:35:47][C][uart.arduino_esp8266:110]:   Parity: NONE
[16:35:47][C][uart.arduino_esp8266:111]:   Stop bits: 1
[16:35:47][C][uart.arduino_esp8266:113]:   Using hardware serial interface.
[16:35:47][C][modbus:143]: Modbus:
[16:35:47][C][modbus:145]:   Send Wait Time: 250 ms
[16:35:47][C][modbus:146]:   CRC Disabled: NO
[16:35:47][C][homeassistant.time:010]: Home Assistant Time:
[16:35:47][C][homeassistant.time:011]:   Timezone: 'UTC0'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter DcPower'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'power'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'W'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter DcVoltage'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'voltage'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'V'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter DcInputCurrent'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'current'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'A'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter AcFrequency'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'Hz'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter AcVoltage'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'voltage'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'V'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter AcOutputCurrent'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'current'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'A'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter AcPower'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'power'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'W'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter EnergyToday'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'energy'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'kWh'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter EnergyTotal'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'energy'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: 'total_increasing'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'kWh'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:flash'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensorModbus Controller Sensor 'Growatt Inverter Temperature'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Device Class: 'temperature'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  State Class: ''
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Unit of Measurement: 'C'
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Accuracy Decimals: 1
[16:35:47][C][modbus_controller.sensor:010]: modbus_controller.sensor  Icon: 'mdi:thermometer'
[16:35:47][C][captive_portal:088]: Captive Portal:
[16:35:48][C][mdns:108]: mDNS:
[16:35:48][C][mdns:109]:   Hostname: growatt
[16:35:48][C][ota:093]: Over-The-Air Updates:
[16:35:48][C][ota:094]:   Address: growatt.local:8266
[16:35:48][C][ota:097]:   Using Password.
[16:35:48][C][api:138]: API Server:
[16:35:48][C][api:139]:   Address: growatt.local:6053
[16:35:48][C][api:141]:   Using noise encryption: YES
[16:35:48][C][modbus_controller:275]: ModbusController:
[16:35:48][C][modbus_controller:276]:   Address: 0x01
[16:35:48][D][modbus_controller:029]: Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue
[16:35:49][D][modbus_controller:029]: Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue
[16:35:51][D][modbus_controller:029]: Modbus command to device=1 register=0x5D countdown=0 no response received - removed from send queue
[16:35:59][D][api:102]: Accepted 192.168.1.75
[16:36:00][D][api.connection:961]: Home Assistant 2023.5.2 (192.168.1.75): Connected successfully
[16:36:00][D][time:044]: Synchronized time: 2023-06-05 15:36:00
[16:36:29][D][modbus_controller:029]: Modbus command to device=1 register=0x03 countdown=0 no response received - removed from send queue
[16:36:30][D][modbus_controller:029]: Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue
[16:36:31][D][modbus_controller:029]: Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue
[16:36:33][D][modbus_controller:029]: Modbus command to device=1 register=0x5D countdown=0 no response received - removed from send queue
[16:37:29][D][modbus_controller:029]: Modbus command to device=1 register=0x03 countdown=0 no response received - removed from send queue
[16:37:30][D][modbus_controller:029]: Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue
[16:37:31][D][modbus_controller:029]: Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue
[16:37:33][D][modbus_controller:029]: Modbus command to device=1 register=0x5D countdown=0 no response received - removed from send queue
[16:38:29][D][modbus_controller:029]: Modbus command to device=1 register=0x03 countdown=0 no response received - removed from send queue
[16:38:30][D][modbus_controller:029]: Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue
[16:38:31][D][modbus_controller:029]: Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue
[16:38:33][D][modbus_controller:029]: Modbus command to device=1 register=0x5D countdown=0 no response received - removed from send queue

I’m in the same boat. I’ve also tried connecting to pins 5 and 6 (“RS485A1: Signal for Meter” and “RS485B1: Signal for Meter” ) instead of 3 and 4, as @chopwood indicated (3 and 4 are “RS485 Connect MinShineBus or Third Party Monitoring Equipment”). My inverter is a MIN-6000TL-XH.

Everything seems to be connected, but there’s no info coming from the inverter. All I get is this.

[15:50:00][D][modbus_controller:032]: Modbus command to device=1 register=0x03 countdown=0 no response received - removed from send queue 
[15:50:02][D][modbus_controller:032]: Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue 
[15:50:03][D][modbus_controller:032]: Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue 
[15:50:04][D][modbus_controller:032]: Modbus command to device=1 register=0xC15 countdown=0 no response received - removed from send queue

Anybody with a MIN series inverter has been able to make it work? Thanks.

@chopwood Your code + picture posted a year ago works great for me with a MIN6000TL-XH. I also have batteries, but none of the other sample codes work with my system. Any chance you can take a look at the battery register address for Battery Percentage, or point me in the right direction?

Thanks.

Hello,

I have the SDM72 Smartmeter on the Inverter. and the ESPHome Firmware on the Shinewifi-X.

I want to read the Smartmeter Register. Because the Original Firmware can read this Data.

Is the Shinewifi the Master or Slave in the Modbus ?

The Smartmeter have the Modbus address 2 the Inverter 1.


modbus:

  id: modbus1

  uart_id: mod_bus

 

modbus_controller:

 - id: growatt

    address: 0x1

    modbus_id: modbus1

    update_interval: 10s



-id: SDM72

address: 0x2

modbus_id: modbus1

update_interval: 10s

´´´

if i do the second ID i get a error massage and cant install the file.

i got some results... but the values are zero at the moment.

´´´

captive_portal:

time:
  - platform: homeassistant
    id: homeassistant_time

output:
  # Blue Led
  - id: light_bl
    platform: gpio
    pin: 16
  # Green Led
  - id: light_gr
    platform: gpio
    pin: 0
  # Red Led
  - id: light_rd
    platform: gpio
    pin: 2

uart:
  id: mod_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 115200
  
modbus:
  id: modbus1
  uart_id: mod_bus
  
modbus_controller:
  - id: growatt
    address: 0x1
    modbus_id: modbus1
    update_interval: 10s
    
  - id: smartmeter
    address: 0x2
    modbus_id: modbus1
    update_interval: 10s

button:
  - platform: restart
    name: "${device_name} Restart"


sensor:
  - platform: modbus_controller
    id: growatt_dc_power
    modbus_controller_id: growatt
    name: "${devicename} DcPower"
    address: 5
    register_type: read
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: smartmeter_power_Import
    modbus_controller_id: smartmeter
    name: "${devicename} SmartMeterPower"
    address: 12
    register_type: read
    ## reimplement using custom_command
    # 0x2 : modbus device address
    # 0x4 : modbus function code
    # 0x1 : high byte of modbus register address
    # 0x56: low byte of modbus register address
    # 0x00: high byte of total number of registers requested
    # 0x02: low byte of total number of registers requested
    # custom_command: [ 0x2, 0x4, 0x75, 0x55,0x00, 0x02]
    register_count: 2
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:flash
    value_type: FP32
    accuracy_decimals: 1

´´´´

19:30:53][D][modbus_controller.sensor:025]: Sensor new state: 446.00
[19:30:53][D][sensor:093]: '${devicename} DcPower': Sending state 44.60000 W with 1 decimals of accuracy
[19:30:57][D][modbus_controller.sensor:025]: Sensor new state: 0.00
[19:30:57][D][sensor:093]: '${devicename} SmartMeterPower': Sending state 0.00000 W with 1 decimals of accuracy
[19:31:03][D][modbus_controller.sensor:025]: Sensor new state: 479.00
[19:31:03][D][sensor:093]: '${devicename} DcPower': Sending state 47.90000 W with 1 decimals of accuracy
[19:31:07][D][modbus_controller.sensor:025]: Sensor new state: 0.00
[19:31:07][D][sensor:093]: '${devicename} SmartMeterPower': Sending state 0.00000 W with 1 decimals of accuracy

´´´
1 Like

Here are the Battery Register.

´´´
1559. StatusInfo_0x15 SOC 0-100 %
1560. StatusInfo_0x16 Voltage 10mV
1561. StatusInfo_0x17 Current 10mA

´´´

hope its help.

I’ll try that. Thanks!

Hello Guys,

I got the SDM Smartmeter behind the Inverter working. So you can Use Zero export (if you want) or

use it for the Energy Dashboard.


captive_portal:

time:
  - platform: homeassistant
    id: homeassistant_time

output:
  # Blue Led
  - id: light_bl
    platform: gpio
    pin: 16
  # Green Led
  - id: light_gr
    platform: gpio
    pin: 0
  # Red Led
  - id: light_rd
    platform: gpio
    pin: 2

uart:
  id: mod_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 115200
  
modbus:
  id: modbus1
  uart_id: mod_bus
  
modbus_controller:
  - id: growatt
    address: 001
    modbus_id: modbus1
    update_interval: 10s
    
button:
  - platform: restart
    name: "Restart"

text_sensor:
  - platform: template
    name: "Status"
    icon: mdi:eye
    entity_category: diagnostic
    lambda: |-
      if (id(status).state == 1) {
        return {"Normal"};
      } else if (id(status).state == 0)  {
        return {"Waiting"};
      } else {
        return {"Fault!"};
      }

switch:
  - platform: modbus_controller
    modbus_controller_id: growatt
    name: "On Off"
    address: 0
    register_type: holding

number:
  - platform: modbus_controller
    modbus_controller_id: growatt
    name: "Max Output Power"
    address: 3
    value_type: U_WORD
    min_value: 0
    max_value: 100
    entity_category: config

sensor:
  - platform: modbus_controller
    modbus_controller_id: growatt
    address: 0
    register_type: "read"
    internal: true
    id: status

  - platform: modbus_controller
    id: growatt_dc_power
    modbus_controller_id: growatt
    name: "Dc Power"
    address: 5
    register_type: read
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: growatt_dc_voltage
    modbus_controller_id: growatt
    name: "Dc Voltage"
    address: 3003 
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: growatt_dc_curennt
    modbus_controller_id: growatt
    name: "Dc Current"
    address: 3004
    register_type: "read"
    unit_of_measurement: A
    device_class: current
    state_class: measurement
    icon: mdi:solar-power-variant
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1  

  - platform: modbus_controller
    id: growatt_energy_today 
    modbus_controller_id: growatt
    name: "Energy Today"
    address: 53
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1


  #Smartmeter Daten>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


  - platform: modbus_controller
    id: growatt_Power_consumtion
    modbus_controller_id: growatt
    name: "Power Consumption"
    address: 3046
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:transmission-tower
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1  

  - platform: modbus_controller
    id: growatt_Export_To_Grid
    modbus_controller_id: growatt
    name: "Export to Grid"
    address: 3044
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:transmission-tower-export
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: growatt_Import_from_Grid
    modbus_controller_id: growatt
    name: "Import from Grid"
    address: 3042
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    icon: mdi:transmission-tower-import
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: growatt_Today_Power_consumtion
    modbus_controller_id: growatt
    name: "Today Power Consumption"
    address: 3076
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total
    icon: mdi:transmission-tower
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1  

  - platform: modbus_controller
    id: growatt_Today_Export_To_Grid
    modbus_controller_id: growatt
    name: "Today Export to Grid"
    address: 3072
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total
    icon: mdi:transmission-tower-export
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

  - platform: modbus_controller
    id: growatt_Today_Import_from_Grid
    modbus_controller_id: growatt
    name: "Today Import from Grid"
    address: 3068
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    state_class: total
    icon: mdi:transmission-tower-import
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

We have to Use the right Modbus Table. V1.20 Release Date 28.04.2020 Works

3 Likes

Hello, I am just starting my first attempts with ESPHome.
However, I come from IoBroker, the API doesn’t work there. That’s why I used mqtt. I have the following problem: I read my Growatt and get the values ​​via MQTT. Now I want to change the output power with MQTT and a slider in the web interface would be great. So far I’m failing at this. My approach so far looks like this.

number:
    - platform: modbus_controller
      name: "${devicename} Max Output Active Power"
      id: poweroutput
      address: 3
      value_type: U_WORD
      min_value: 0
      max_value: 100
      entity_category: config
      step: 1

    - platform: template
      name: "Power Output"
      id: "Power_Output"
      optimistic: true
      min_value: 0
      initial_value: 100
      max_value: 100
      step: 1
      set_action:
       then:
        - lambda: id(poweroutput) = x;

sensor:

  - platform: mqtt_subscribe
    name: "mqtttest"
    id: mqtttest
    topic: the/topic 

With MQTT subscribe I get values, but I don’t know how to send them to the Growatt with Modbus

Hi guys. For some reason after update the esphome and the HA I Lost communication with the inverter. Did happen to someone else? Cheers

Which versions?
HA?
ESPHome?
ESPHome Firmware?

I have no problems with the following versions:
Home Assistant: 2023.6.3
Supervisor: 2023.06.2
Operating System: 10.3
ESPHome: 2023.6.2
ESPHome Firmware on Shine Wifi X Stick: Firmware: 2023.3.0 (Mar 22 2023, 16:15:01)

hi @jim_os
the same versions but i’m using a esp8266 with a ttl adapter and the code on the post 145
i’m lost i can’t control the inverter :sob: :sob: :grin:
its something related to the modbus i gess.

Home Assistant 2023.6.3
Supervisor 2023.06.2
Operating System 10.3
ESPHome 2023.6.2

queue
[18:56:55][D][uart_debug:158]: <<< “\x02M\n”
[18:56:55][W][modbus:135]: Got Modbus frame from unknown address 0x02!
[18:56:55][D][uart_debug:158]: <<< “\x05\x01d\x01\x01\x90\x15|\x15\x16H@”
[18:56:56][D][modbus_controller:029]: Modbus command to device=1 register=0x39 countdown=0 no response received - removed from send queue
[18:56:57][D][uart_debug:158]: <<< “\x03M\n”
[18:56:57][W][modbus:135]: Got Modbus frame from unknown address 0x03!
[18:56:57][D][uart_debug:158]: <<< “\x05\x01d\x01\x01\x90\x15|\x15\x16J\xC1”
[18:56:57][D][modbus_controller:029]: Modbus command to device=1 register=0x44 countdown=0 no response received - removed from send queue
[18:56:58][D][uart_debug:158]: <<< “\x02M\n”
[18:56:58][W][modbus:135]: Got Modbus frame from unknown address 0x02!
[18:56:58][D][uart_debug:158]: <<< “\x05\x01d\x01\x01\x90\x15|\x14\xD8\xC8D”
[18:56:59][D][modbus_controller:029]: Modbus command to device=1 register=0x52 countdown=0 no response received - removed from send queue

this is part of the code.
growatt spf5000es working like a charm until 3 days ago.


uart:
  id: mod_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 9600
  #baud_rate: 115200
  debug:
    direction: RX
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

modbus:
  id: modbus1
  uart_id: mod_bus
#  flow_control_pin: GPIO4

modbus_controller:
  - id: growatt
    address: 0x1
    modbus_id: modbus1
    setup_priority: -10  
    update_interval: 30s 


text_sensor:
  - platform: template
    name: "${friendly_name} Status"
    icon: mdi:eye
#    entity_category: diagnostic
    lambda: |-
      if ((id(status).state) == 1) {
        return {"Normal"};
      } else if ((id(status).state) == 0)  {
        return {"Standby"};
      } else if ((id(status).state) == 2)  {
        return {"Discharge"};
      } else if ((id(status).state) == 3)  {
        return {"Fault"};
      } else if ((id(status).state) == 4)  {
        return {"Flash"};
      } else if ((id(status).state) == 5)  {
        return {"PV Charging"};
      } else if ((id(status).state) == 6)  {
        return {"AC Charging"};
      } else if ((id(status).state) == 7)  {
        return {"Combined Charging"};
      } else if ((id(status).state) == 8)  {
        return {"Combined Charging & Bypass"};
      } else if ((id(status).state) == 9)  {
        return {"PV Charging & Bypass"};
      } else if ((id(status).state) == 10)  {
        return {"AC Charging & Bypass"};
      } else if ((id(status).state) == 11)  {
        return {"Bypass"};
      } else if (id(status).state == 12)  {
        return {"PV Charge and Discharge"};
      } else {
        return {"Unknown"};
      }

sensor:
#  - platform: wifi_signal
#    name: "WiFi Signal Sensor"
#    update_interval: 60s
    
  - platform: modbus_controller
    address: 0
    register_type: "read"
    internal: true
    accuracy_decimals: 0
    id: status
    
#### temp ###
 
  - platform: modbus_controller
    name: "${friendly_name} Inverter Temperature"
    address: 25
    register_type: "read"
    unit_of_measurement: °C
    device_class: temperature
#    entity_category: diagnostic
    state_class: measurement
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
 # - platform: modbus_controller
 #   name: "${friendly_name} PV Temperature"
 #   address: 32
 #   register_type: "read"
 #   unit_of_measurement: °C
 #   device_class: temperature
 #   state_class: measurement
 #   entity_category: diagnostic
 #   icon: mdi:thermometer
 #   value_type: U_WORD
 #   accuracy_decimals: 1
 #   filters:
 #   - multiply: 0.1

#  - platform: modbus_controller
#    name: "${friendly_name} DC‐DC Temperature "
#    address: 26
#    register_type: "read"
#    unit_of_measurement: °C
#    device_class: temperature
#    entity_category: diagnostic
#    state_class: measurement
#    icon: mdi:thermometer
#    value_type: U_WORD
#    accuracy_decimals: 1
#    filters:
#    - multiply: 0.1


### AC input ### 

#  - platform: modbus_controller
#    name: "${friendly_name} AC Input Hz"
#    address: 21
#    register_type: "read"
#    device_class: FREQUENCY
#    unit_of_measurement: Hz
#    entity_category: diagnostic
#    state_class: measurement
#    icon: mdi:flash
#    value_type: U_WORD
#    accuracy_decimals: 1
#    filters:
#    - multiply: 0.01

  - platform: modbus_controller
    name: "${friendly_name} Grid Voltage "#AC Input Voltage
    address: 20
    register_type: "read"
    unit_of_measurement: V
    device_class: VOLTAGE
    state_class: measurement
#    entity_category: diagnostic
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1


  - platform: modbus_controller
    name: "${friendly_name} Grid Charge Current" # AC Charge Current
    address: 68
    register_type: "read"
    unit_of_measurement: A
    device_class: CURRENT
#    entity_category: diagnostic
    state_class: measurement
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
      - platform: modbus_controller
    name: "${friendly_name} Uti Charge Start Time"
    address: 05
    value_type: U_WORD
    optionsmap:
      "0h": 0
      "1h": 1
      "2h": 2
      "3h": 3
      "4h": 4
      "5h": 5
      "6h": 6
      "7h": 7
      "8h": 8
      "9h": 9
      "10h": 10
      "11h": 11
      "12h": 12
      "13h": 13
      "14h": 14
      "15h": 15
      "16h": 16
      "17h": 17
      "18h": 18
      "19h": 19
      "20h": 20
      "21h": 21
      "22h": 22
      "23h": 23

Unfortunately I can’t tell you much about it. Did you only do an ESPHome update to Version 2023.6.2, or also an update of the ESPHome firmware for the ESP8266?


I still use an old firmware version 2023.3.0 with my Growatt Stick, because otherwise I would have to open it again to flash the firmware.

Is there an error message when you check the ESPHome firmware for the ESP8266?
esp_validate

The Wifi connection to the ESP8266 is activated and working?

My ESPHome code doesn’t differ much from yours, but I also use a different inverter (MIC600)

uart:
  id: mod_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 115200
  
modbus:
  id: modbus1
  uart_id: mod_bus
  
modbus_controller:
  - id: growatt
    ## the Modbus device addr
    address: 0x1
    modbus_id: modbus1
    setup_priority: -10  

text_sensor:
  - platform: modbus_controller
    name: "${devicename} Firmware Version"
    address: 9
    register_count: 3
    register_type: holding
    #internal: true
    entity_category: diagnostic

  - platform: template
    name: "${devicename} Status"
    icon: mdi:eye
    entity_category: diagnostic
    lambda: |-
      if (id(status).state == 1) {
        return {"Normal"};
      } else if (id(status).state == 0)  {
        return {"Waiting"};
      } else {
        return {"Fault!"};
      }

switch:
  - platform: modbus_controller
    name: "${devicename} OnOff"
    address: 0
    register_type: holding

number:
  - platform: modbus_controller
    name: "${devicename} Max Output Power"
    address: 3
    value_type: U_WORD
    min_value: 0
    max_value: 100
    entity_category: config

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s
  
  - platform: modbus_controller
    address: 0
    register_type: "read"
    internal: true
    id: status

  - platform: modbus_controller
    name: "${devicename} DcPower"
    address: 3005 #5
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
...

Hi. Yes I updated the esp. I will wait and see if I discover the problem.