Shelly Plus Plug S - ESPHOME

Hi all,

I also now have 4 softbricked Shelly Plugs V2, because I was able to install ESPhome Firmware once, but now cannot OTA anything. OTA says it’s running through fine, but does not really update the device.
There should be a warning on that Shelly Plug Plus S Template page that OTA is not working when you are using the stock ESPhome Firmware.

Other than that, is there any way back without having to crack up the case? There are no screws anymore on the V2 Plug :frowning:

I would be very grateful for any help!

cool image,
have you set power save mode to high

I think tasmota uses that by default, and so far everyone having this issue or a higher power usage by esphome was helped by this setting.

your image looks awesome,
I don’t think the OTA update is going to work for me as there are issues with the latest shelly fw.
I have 2 questions.

  • how did you disassemble the Shelly Plus Plug S? I can’t find any screws.
  • where did you find those extremely long dupont pins? I want them too.

I removed the sticker on the inside,
but I can’t find a way to remove this screw
image
I checked with the original Shelly Plug S there is screwed from the other side using a philips screwdriver.
this Shelly Plus Plug S v2 it’s screwed from the inside, but the lines are so thin I can’t can a flat-blade to have any kind of grip.

I might can apply the power-drill to it, But I’m afraid I will never be able to remove the remains of the screw,
any advise would be helpful.

[Edit:] applying the power drill looses the screw, still there is no movement on the led ring. is this might be glued? or is there some outer mounting point I’m missing.

1 Like


So i did pull it and it broke it(the inductor broke on the second layer), so i would not advise to do it, trying to flash esphome on the broken one as a test however the esphome code of the site has repeated parts??? that does not validate, trying to make it work.

Is there any way to unbrick the v2 version? Im trying to unbrick it with esptool, and it gives this error.


In the image I’m trying to get esphome in the thing via serial but it just cant find the port for some reason.The serial to USB I’m using is PL2303HXA

You have to find the correct port.

Did you pull the transparent ring. Or pulled something else. From what I try there is no movement at all.
I hope to make a copy of the original firmware. So it might can be used to improve the ota update process.

so i have multiple open, the one im working on I cut the side of the plug near the circuit, but in the beginning, I pulled the transparent ring. What holds the transparent ring is a hollow cylinder of plastic that contains the screw.By removing the screw by drilling the head you can cut the cylinder from the inside with a knife or screw driver.I do not recommend removing plastic of the bottom part by force, you will break a fragile circuit component.

i fixed the problem(driver problem) but now im having a hard time with tx and rx.Having a hard time obtaning a stable connection. Had somting like that the first time but then it failed.
Here is the cmd of my atempt to flash esphome bin into the plug via serial.

C:\Users\migue\.esphome\.esphome\build\shelly-plus-plug-s-3\.pioenvs\shelly-plus-plug-s-3>python -m esptool --port COM4 write_flash -fs 1MB -fm dout 0x0 firmware-factory.bin
esptool.py v4.7.0
Serial port COM4
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP32
Chip is ESP32-U4WDH (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: b0:b2:1c:18:fd:20
Uploading stub...
Running stub...
Stub running...
WARNING: Failed to communicate with the flash chip, read/write operations will fail. Try checking the chip connections or removing any other hardware connected to IOs.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x000d0fff...
Compressed 855008 bytes to 531207...
Writing at 0x0000bd38... (6 %)Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\esptool\__init__.py", line 1139, in _main
    main()
  File "C:\Python310\lib\site-packages\esptool\__init__.py", line 923, in main
    operation_func(esp, args)
  File "C:\Python310\lib\site-packages\esptool\cmds.py", line 598, in write_flash
    esp.flash_defl_block(block, seq, timeout=timeout)
  File "C:\Python310\lib\site-packages\esptool\loader.py", line 131, in inner
    return func(*args, **kwargs)
  File "C:\Python310\lib\site-packages\esptool\loader.py", line 1077, in flash_defl_block
    self.check_command(
  File "C:\Python310\lib\site-packages\esptool\loader.py", line 467, in check_command
    val, data = self.command(op, data, chk, timeout=timeout)
  File "C:\Python310\lib\site-packages\esptool\loader.py", line 436, in command
    p = self.read()
  File "C:\Python310\lib\site-packages\esptool\loader.py", line 369, in read
    return next(self._slip_reader)
StopIteration

A fatal error occurred: The chip stopped responding.

all info is in this thread, but not a step by step guide,
So I wrote down the step by step actions I took on my windows laptop

1. setup ubuntu vm on hyper-v
  make sure you have enough diskspace 12BG is not enough 50GB is.
  connect VM to your local network, not to the virtual switch
  install openssh-server if desired

2. run the following line bij line and install all required stuff

https://esphome.io/guides/contributing.html#setting-up-development-environment
# Clone repos
git clone https://github.com/angelnu/esphome-1.git

# Install ESPHome
cd esphome-1/
script/setup
# Start a new feature branch
git checkout extend_ota
cd ..

3. create test.yaml

esphome:
  name: test
  platformio_options:
    board_build.flash_mode: dio
esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf
    platform_version: 6.4.0
    version: 5.1.1
wifi:
  id: wifiId
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "${device_name}"
    password: !secret wifi_password
ota:
  unprotected_writes: True # This is mandatory if you want to flash the partition table or bootloader!
logger:
web_server:
button:
- platform: restart
  name: Restart

4. compile to check if it builds and if upload-factory-ota at leas is available
  cd esphome-1/
  source venv/bin/activate
  python -m esphome compile ../test.yaml

  cp /home/bart/.esphome/build/test/.pioenvs/test/firmware.bin ~/firmware.bin

  python -m esphome upload-factory-ota ../test.yaml

5. install tasmota according the the manual. 
including migratation to the saveboot partition,
https://github.com/tasmota/mgos32-to-tasmota32

6. upload the firmware.bin using the browser on ubuntu.
7 upload factory ota 
  cd esphome-1/
  source venv/bin/activate
  python -m esphome upload-factory-ota ../test.yaml

8. now build a test.yaml from the HA addon and wireless update

just in case it helps someone

1 Like

I have created a comprehensive step-by-step guide for flashing ESPHome onto the Shelly Plus Plug S (I had the V2 version) from the information accumulated in this thread.
Unfortunately the forum won’t let me post it, because it has too many links in it.
But it is available on my github. Feel free to add improvements!

3 Likes

Thanks a lot. That really helped a lot and for the first time my shelly plug works with bluetooth \o/

1 Like

If someone has, please share working BLE configuration for Shelly Plus Plug S V2.
Because it’s has solo chip (1 core CPU) wrong configuration can brick it, so for V2 version which heavy to open it’s can be real nightmare.
Thanks in advance.

Specially i’m interesting for esp32 section which without BLE usually looks like:

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf

But for solo chips and BLE configuration should looks something like described here and here

@Chaos_666 @kadam12g

I have shelly plus PM mini, which also have single core esp and i’ve had to add “board_build.f_cpu” to my esphome part. Here’s my config:

esphome:
  name: biodom-boiler
  platformio_options:
    board_build.f_cpu: 160000000L

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_FREERTOS_UNICORE: y
      COMPILER_OPTIMIZATION_SIZE: y
    advanced:
      ignore_efuse_mac_crc: true
  .....

Important line was “board_build.f_cpu”, without it my shelly was unresponsive - i’ve had to re-flash it via uart.
I’m not sure if that’s only thing you need, but i hope it helps.

Thanks for sharing! And in this config you have esp32_ble_tracker and it’s working?

I don’t have ble tracking on this device anymore, but, yes, it worked.
But, as said, without above lines esp didn’t run at all - it didn’t connect neither to wifi or HA and log on module’s Rx/tTx threw only some errors out (can’t remember what, though). I would guess that whole thing was compiled for 240MHz, while module, as it seems, runs on 160MHz.

Thanks for update! Will keep looking for Shelly Plus Plug S V2 config and if no one share it, will try your, hopefully it’s will work or at least not brick the plug :wink:

I can confirm that Protoncek’s config works with esp32_ble_tracker: (active or passive) on the V2

@kadam12g your guide was great but please add a warning that esp32_ble_tracker: will cause a boot loop without additional measures like mentioned above.

2 Likes

A bit of thinking regarding this: perhaps line “board_build.f_cpu: 160000000L” wouldn’t be necesarry at all if i would choose correct board… i generally just copy/paste basic lines from a working yaml. Most of the time it works…
Some additional testing would be necesarry. I won’t be doing that right now since i have my mini nicely installed and if i brick it i’ll have to “dig it out”. Perhaps when i buy another one…