ESPHome modbus Growatt ShineWiFi-S

Correct, standard CAT5 terminated with an RJ45 (B… I think…) connected to RS485-3 of the inverter.

Curious to see if it works for you…

Yes, but no success.

I think you should try with the original usb/RS data logger. I replace the original esp with a new one flashed with esphome. Then after I get what I want I put the original one in place.

Hello Pavel,
I finally got it to work. I think my problem was the power supply I was using.
I connected the network cable to port 485-1 on the inverter.
The pins used are:
Pin1 orange/white (B-)
Pin5 blue/white (A+)
The communication setting on the inverter is set to VPP
Here is a Photo of my configuration:

1 Like

Hi Izi, I will give it a try tomorrow. What exactly you mean by “problems with power supply” ? At the beginning it did not work for you and now it is working - what exactly did you change to make it work? What was the problem? Thanks, Pavel

Hello Pavel, for my initial setup I used a usb powerbank as power source. Yesterday I have done the setup again and changed it to a normal power supply from a Raspberry pi. Maybe this was the reason.

Plawa, one more question, there are other examples online (GitHub etc) indicating a 120mohm resistor is required somewhere in the connection. Did you include one or does it work without resistor?

Nope, what you see is all I have…

1 Like

Hi

I tried using this for my spf5000es but i just crc errors. I am connected via the RJ45 RS485 port and im using a max485 ttl converter so i am using the flow control pin

    [08:05:03][D][uart_debug:158]: <<< "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\b\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
    [08:05:03][W][modbus:108]: Modbus CRC Check failed! C071!=210
    [08:05:03][W][modbus:108]: Modbus CRC Check failed! C071!=00
    [08:05:03][W][modbus:108]: Modbus CRC Check failed! C071!=00

My Yaml

substitutions:
  device_name: inv1
  friendly_name: "inv1"
  device_description: "Growatt SPF 5000 ES"

esphome:
  name: '${device_name}'
  comment: '${device_description}'

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "API Key"

ota:
  password: "OTA Pass"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.8.27
    gateway: 192.168.8.1
    subnet: 255.255.255.0
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test2 Fallback Hotspot"
    password: "4igHBNw5StRu"

captive_portal:

uart:
  id: mod_bus
  tx_pin: 0
  rx_pin: 4
  baud_rate: 9600
  stop_bits: 1
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

modbus:
  flow_control_pin: 16
  id: modbus1
  uart_id: mod_bus
  #disable_crc: true

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

sensor:
  - 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

Any help will be much appreciated

Did you manage to get this working?

Is anyone able to force discharge the battery? My set up is an SPH-8000 / Growatt ark 15kwh with 4.7kwp solar panels DC connected and 1.8kwp Enphase (AC connected). Net metering (Netherlands) and a dynamic contract.

Use case: force discharge battery to grid at the time when prices are highest. This creates two opportunities: 1/ optimize overall cost/profit 2./ Create space to charge the battery for the next sunny day

Typically I generate 2 times the amount of solar energy I use on a given date. I would like to store as much as possible when prices are low, use from battery when prices are high and sell my excess stored energy in the early evening leaving a buffer to “survive the night”

Hi. On my first attempt to read the inverter I miss the pins on the RJ45, I can’t confirm but I think that is the orange wires.

I’m a little confused and looking for guidance. Here you have 1044 as inverter priority, but in your earlier post ESPHome modbus Growatt ShineWiFi-S - #135 by Plawa 1044 is ‘Energy to User’

How are the two things differentiated? I’m getting lost in the Growatt Inverter Modbus RTU Protocol (v1.2) document. I have a SPH6000 inverter.

One of them is a holding register, i.e. something you can read and change, the other one is an input register which you can only read - I’m absolutely not a modbus expert but this is how I understand it, plus you can see even in the Growatt docs one of the listed under 4.2 - Input Registers and the other one under 4.1 - Holding Reg…

1 Like

Hi guys, I finally managed to get it working with SPH 10k-TL3 BH-UP :slight_smile: It was a combination of several factors:

  • using a different RS485/TTL adaptor (t.ly/WJrn) instead of this one that did not work: t.ly/-fsu
  • powering RS485/TTL by 3,3V instead of 5V
  • linking RS485/TTL to other pins (19 and 23) on ESP32 than standard RX and TX - this forces the ESP32 to use software instead of hardware conversion
    • modified uart: section to reflect this change:
uart:
  - id: mod_bus
    baud_rate: 9600
    tx_pin: GPIO19
    rx_pin: GPIO23
    debug:
  • using RS485-3 connector on the inverter, pins 1 (white-blue) and 5 (white-orange) linked to B and A inputs of RS485/TTL, and 120 Ohm resistor pluged to A and B
  • using version: 2.0.6 parameter in esp32: section of the ESPHome code
  • using Plawa’s code from this thread (see above)
  • inverter’s RS485 settings set to VPP, RS485 address to 01

Thanks all for assistance :slight_smile:

2 Likes

I got a ShineWifi-x, i flashed it with the shinewifi-x custom firmware, i can see the webserver on the ip, but i dont get any data. in the log i get these entries

21:05:21	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x03 countdown=0 no response received - removed from send queue
21:05:22	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue
21:05:23	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue
21:05:25	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0xC15 countdown=0 no response received - removed from send queue
21:06:21	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x03 countdown=0 no response received - removed from send queue
21:06:22	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue
21:06:23	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue
21:06:25	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0xC15 countdown=0 no response received - removed from send queue
21:07:21	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x03 countdown=0 no response received - removed from send queue
21:07:22	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x25 countdown=0 no response received - removed from send queue
21:07:23	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0x35 countdown=0 no response received - removed from send queue
21:07:25	[D]	[modbus_controller:029]	
Modbus command to device=1 register=0xC15 countdown=0 no response received - removed from send queue
21:07:30	[I]	[ota:113]	
Boot seems successful, resetting boot loop counter.

I got a sph3600, any idea how to proceed from here?

Post your code.

substitutions:
  devicename: "esphome-growatt"
  upper_devicename: "ESPHome Growatt 01"
  
esphome:
  name: $devicename
  platform: ESP8266
  board: esp07s



# Enable logging
logger:
  baud_rate: 0
  
# Enable Home Assistant API
api:

ota:
  password: !secret ota_passwd

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: on
   # ...
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.1.164
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0
 

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "GrowattSolar"
    password: "" 
    
  # Enable Web server
web_server:
  port: 80

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
    ## the Modbus device addr
    address: 0x1
    modbus_id: modbus1
    setup_priority: -10  


sensor:
  - platform: modbus_controller
    name: "${devicename} DcPower"
    address: 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
    
  - platform: modbus_controller
    name: "${devicename} DcVoltage"
    address: 3
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} DcInputCurrent"
    address: 4
    register_type: "read"
    unit_of_measurement: A
    device_class: current
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} AcFrequency"
    address: 37
    register_type: "read"
    unit_of_measurement: Hz
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.01
  
  - platform: modbus_controller
    name: "${devicename} AcVoltage"
    address: 38
    register_type: "read"
    unit_of_measurement: V
    device_class: voltage
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  
  - platform: modbus_controller
    name: "${devicename} AcOutputCurrent"
    address: 39
    register_type: "read"
    unit_of_measurement: A
    device_class: current
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} AcPower"
    address: 40
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} EnergyToday"
    address: 53
    register_type: "read"
    unit_of_measurement: kWh
    device_class: energy
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
    
  - platform: modbus_controller
    name: "${devicename} EnergyTotal"
    address: 55
    register_type: "read"
    unit_of_measurement: kWh
    state_class: total_increasing
    device_class: energy
    icon: mdi:flash
    value_type: U_DWORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

    
  - platform: modbus_controller
    name: "${devicename} Temperature"
    address: 3093
    register_type: "read"
    unit_of_measurement: C
    device_class: temperature
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

Hi. I think the problem is the address. Try this
https://community.home-assistant.io/t/esphome-modbus-growatt-shinewifi-s/369171/148?u=candidotsa

Do you mean The Modbus controller address? I dont have any sensor working, in the web they all show n/a