Flash OpenDTU to an ESP32 Wroom

Cover image

A few month ago I installed a small solar panel on my balcony which is attached to a Hoymiles inverter. To read out data from the inverter I use OpenDTU. For this I bought a kit from blinkyparts which is really easy to assemble and came with an already flashed ESP32 which was ready to use. This setup run fine till today my vaccum robot 🤖💥 decided to eat the cable of the ESP32 and in the process the USB connector was ripped of the board. So I had to replace the ESP32 and this time I had to flash and install OpenDTU myself. This process is documented below for my future self and others.

Flash OpenDTU to ESP Wroom-32

  • Install esptool: pip install esptool
  • Download OpenDTU release from: https://github.com/tbnobody/OpenDTU/releases - for the ESP Wroom-32 use opendtu-generic_esp32.bin
  • Attach ESP32 via USB cable to your computer
  • Find port used by the ESP32

    • run ls -l /dev/tty* and look at the date e.g. 18 Nov 15:24 to find the most recent attached device
    • use this port in the following command, in my case /dev/tty.usbserial-0001
  • Press hardware "Boot"-button on ESP32 before running following command. otherwise you get error A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x13)! The chip needs to be in download mode.
  • Flash the ESP32 by running:
esptool.py --port /dev/tty.usbserial-0001 --chip esp32 --before default_reset --after hard_reset \
  write_flash --flash_mode dout --flash_freq 40m --flash_size detect \
  0x0 opendtu-generic_esp32.factory.bin

Configuration

  • Connect to Access Point "OpenDTU-*"
  • Under Settings > Config Management restore ...

    • Main Config

      • if you have a backup of your previous config. Main Config contains Wifi SSID & Password, Inverter Setup, mqtt-config, ...
      • I did not have a backup and therefore had to configure wifi, inverter and mqtt again.
    • Pin mapping

Create backup

I hope I wont need to set up my OpenDTU in the forseeable future, but I don't know what my vaccum robot has in mind so as a final step I created a backup under Settings > Config management for the Main Config (config.json). Be careful to place it at a secure location because it contains the secrets in plain text e.g. the wifi password.

Helpful resources