Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Growatt ShineWifi-F reflashed with ESPHome

Featured Replies

Hi folks,

I was given a ShineWifi-F dongle by @Demo after his Growatt inverter was water damaged. There are a few threads about reprogramming the Shine-Wifi-F dongles (e.g. https://diysolarforum.com/threads/hacking-the-new-growatt-wifi-f-modules.43231/), but one of the constant problems is programming it, because of the RS-232 transceiver connected to the ESP07 modules RX and TX pins. Some folks desoldered the transceiver, others cut traces, etc. Some had success with particular USB-TTL adapters, but the CP2102 that was said to work there didn't work for me. Others had problems providing enough power.

I approached it somewhat differently, starting with a USB-RS232 dongle, and a RS232 breakout board. I cut a USB extension cable in half, and connected the white wire to the TX pin (pin 2) of the breakout, and the green wire to the RX pin (pin 3). Black obviously went to pin 5 (Ground), and red went to pin 9 (Ring Indicator). In fact, the red wire doesn't need to be connected to the breakout at all, but it simplified things physically. I also had a 12V supply, which I connected to pin 9 and pin 5, to provide power to the dongle. I also put a jumper between Ground and GPIO0 on the dongle to put it into programming mode when power was applied.

With that done, I could simply run esptool.py to pull the original firmware off as a backup, and then install my own ESPHome firmware on it.

Thanks again to @Demo for the dongle.

image.png

  • Author

Here is the YAML that I came up with. Note that the ESP07S is quite RAM limited, and I ran into "Out of Memory" conditions when enabling too many features. Main symptom of this was failure to connect to WiFi, or failure to complete OTA updates (leaving the esphome program on the client hanging)!

esphome:
  name: growatt
  friendly_name: Growatt

esp8266:
  board: esp07s

# Disable logging
logger:
#  level: VERY_VERBOSE
#  level: INFO

  # the below lines move logging to the alternate UART pins
  # this exposes the TX line on the GD25Q SPI flash CS pin #1
  # which can be snooped with a chip clip or pin grabbers. GND is pin #4
  # If you want to keep the hardware UART for the modbus uart,
  # uncomment the baud_rate, and comment the hardware_uart
  # This is advised for "production" deployment!
#  baud_rate: 0
  hardware_uart: UART0_SWAP

# Make sure that the logger level is at least DEBUG
# This is good for monitoring free heap space, etc
# .debug.yaml simply contains the example configuration from
# https://esphome.io/components/debug.html
# <<: !include .debug.yaml

# Disabled by default, because of limited RAM
# required for the pcf8563
#i2c:
#  scl: GPIO4
#  sda: GPIO5

time:
  - platform: sntp
    id: sntp_time
#    on_time_sync:
#      then:
#        pcf8563.write_time:

#  - platform: pcf8563
#    id: pcf8563_time
#    address: 0x51

# SPI bus is connected to the GD25Qxxxx SPI NOR Flash chip
# Mine was covered with conformal coating, so I couldn't make out the
# exact part number
# e.g. https://eu.mouser.com/datasheet/2/870/gd25q64e_rev1_4_20210820-1825464.pdf
#spi:
#  clk_pin: GPIO14
#  mosi_pin: GPIO13
#  miso_pin: GPIO12

# There's no support for flash chips in ESPHome at the moment
# But the CS pin is GPIO15

# Enable Home Assistant API
api:

ota:
  platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Growatt Fallback Hotspot"

captive_portal:
    
#web_server:

light:
  - platform: status_led
    id: status_led_
    output: led_red
    internal: true

output:
    # Green LED
  - id: led_green
    platform: gpio
    pin: GPIO0

    # Red LED
  - id: led_red
    platform: gpio
    pin: GPIO2

    # Blue LED
  - id: led_blue
    platform: gpio
    pin: GPIO16

uart:
  - id: modbus_uart_master
    baud_rate: 9600
    rx_pin: GPIO3
    tx_pin: GPIO1
#    debug:
#      direction: BOTH

button:
  - platform: safe_mode
    name: "Safe mode"

binary_sensor:
  # The button is connected to the ADC
  - platform: analog_threshold
    name: Button
    sensor_id: adc_button
    threshold: 0.5
    filters:
      invert:

sensor:
  - platform: uptime
    name: Uptime Sensor
    entity_category: diagnostic

  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    update_interval: 60s
    entity_category: diagnostic
    
  - platform: adc
    pin: GPIO17
    id: adc_button
    update_interval: 1s
    filters:
      delta: 0.1

# Use the stream_server for remote modbus RTU access
#external_components:
#  - source: github://oxan/esphome-stream-server

#stream_server:
#  - uart_id: modbus_uart_master
#    port: 502

modbus:
  - id: modbus_master
    uart_id: modbus_uart_master

modbus_controller:
  - id: growatt_master
    address: 0x1
    modbus_id: modbus_master
    setup_priority: -10 

# .growatt.yaml contains the modbus register definitions
packages:
  master_inverter: !include
    file: .growatt.yaml
    vars:
      modbus_device: 1
      modbus_controller_id: growatt_master
      inverter: Master

  • Author

Turns out I was somehow using an older version of ESPHome, which contributed to the Out of Memory problems I was having. Try make sure you have an up-to-date installation. I recovered about 10-14kB doing so! 20%!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.