Shelly Plus Plug S - ESPHOME

hi all,
I would like to make my shelly plus plug s work additionally as a ble gateway (for esphome(dot)io/cookbook/ble_itag.html).
my first try failed while flashing with esp32_ble_tracker and ble_client modules - firmware was too big for one of two partitions left from shelly (2x almost 2MB), but was ok to flash something smaller.
then I found a way to re-partition flash to make one big app partition Safeboot Partition Layout - Tasmota and used esphome temporary “proof of concept” firmware with one Itag and … it became permanent. it worked, itag works, relay works, but thats it, I cant flash it any more wirelessly. it says “conneciton reset by peer”. even with the minimum firmware (ota and wifi module).

so I think as follows: if safeboot partition with tasmota-safeboot (tasmota32-safeboot.bin) still exists in flash, it would be enough to boot from it and flash whatever we need - like in api tasmota (HTTP API to switch to and from factory partition by s-hadinger · Pull Request #15506 · arendst/Tasmota · GitHub) - but I didn’t find anything similar over the internet for esphome.
what do you think, is that way possible at all?

or serial is my only way? shelly support didn’t provide me pinout (obviously) and I couldn’t find it as well by myself. from 18 pins would not be so easy to find rx tx etc
thank you

1 Like

For everyone who is interested on the PinOut Points. I successfully flashed ESPHome over TTL Serial.


@homeass1

5 Likes

I made a quick fix using pins to hit the points.

3 Likes

Thanks for this informations.
I will try reflash it using this pins :slight_smile:

having 2 of these just fine in the Shelly integration, I wonder why would you want to flash them in the first place?

1 Like

Because if I need to do some “advanced” functions Im more familiar with esphome coding(yaml) than Shelly scripts… Also If with Shelly FW I want in plug get some data from other HA sensor I need to use MQTT or some API calls to HA which is more complex than simple calling sensor from esphome code…
For simple on/off switching and reading power usage I think normal fw is ok… Also this is my view and maybe all thing can also be done with Shelly scripts…

Cool. Still new to Esphome myself, I try to learn from all of you, and understand the deeper options.

1 Like

@fanningert did you solder contacts on ESP board or are only pushed on them? Did you use hard wire to make contact or I see sewing needles? :slight_smile:

@fanningert thanks for pinout diagram. Today Im sucesfully reflash my Shelly Plus Plug S.

@DejanBukovec yes i used sewing needles and they are only pushed on the contacts. :slight_smile: It was a quick and dirty construction. I am currently creating a pcb for easy flashing. But this need some time.

1 Like

I opened a pull request to change the platform to esp-idf.
since we do have the “ESP32 RMT LED Strip” platform with esphome 2023.5, it is possible to address the LEDs when using the esp-idf framework.
With this it is possible to use the plug as a bluetooth proxy too, because of the much smaller footprint.

If you want to get inspiration until the pr is merged, you can take a look at my proposed changes:

Hi,
many thankes for the PinOut Points.
My Shells Plus Plug S ist defekt after 10 Days. There is nothing of reaktion at the device.
No reset ist possible, also is no power betwen GND and 3,3Volt.
Is there any to find out, ore some poit to check?

How did you open the plug?
Mine has no screws like the older models…

My have them inside contact holes…

It is one screw, and it is placed in the hole for “ground”. You’ll need a narrow and long screwdriver for it.

I’ll be trying the pinout flash soon, cause my new ESPHome firmware gets uploaded but the plug is not booting with the new firmware version 🥲

Hmm… this solution did not work for me.
First I tried to migrate via the software way. Migrated from Shelly Software to tasmota is easy. But I was not able to migrate from tasmota to ESPHome. Tried it the hole day along.
So I decided to open this thing and but the needles on it. I flashed with esptools on a raspberry. (tig's Blog)

The software said that the bin file is copied correct. But the plug is dead. I tried a second one. Also dead.

**daniel@raspberrypi**:**~ $** esptool.py --port /dev/ttyS0 write_flash 0x0000 ~/shelly-plus-plug-s-3.bin
esptool.py v4.6.2
Serial port /dev/ttyS0
Connecting...
Failed to get PID of a device on /dev/ttyS0, using standard reset sequence.
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Failed to get PID of a device on /dev/ttyS0, using standard reset sequence.
Detecting chip type... ESP32
Chip is ESP32-U4WDH (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, Embedded Flash, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: b0:b2:1c:0f:9a:80
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x000d9fff...
Compressed 892336 bytes to 589471...
Wrote 892336 bytes (589471 compressed) at 0x00000000 in 53.5 seconds (effective 133.5 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
**daniel@raspberrypi**:**~ $**

No reaction if I put 3,3 Volt and Ground directly on the pins. No reaction if I put in the wall outlet.
Oh no, I killed my two plugs. :frowning:

Any ideas? Maybe it is better to buy the ATHOM plugs with pre flashed ESPHome?

Found the solution in this thread: Guide for flashing ESPHome firmware with esptools on Linux

If the firmware file doesn’t end on “-factory.bin” it is likely not the modern version. If you flash the legacy version, the ESP will get stuck in a boot loop. I guess the difference between modern and legacy is, that legacy comes without a bootloader, but I never really checked that.

So I get out the needles again an do all the procedure from beginn till the end - with success! The first plug is now on ESPHome. :slight_smile:

3 Likes

Weird,
had the opposite experience.
Flashed the tasmota and then the esphome in modern format, however I always received an error. As soon as I used the legacy one everything worked. All via GUI.
In between I also “bricked” one, which I had to revive via TTL and the only way I could achieve it was with the legacy esphome one I built and esphome-flasher. Was not able to flash via web.esphome.io and modern format.

BTW: was anyonoe able to use bluetooth proxy already? Gave it a try, after I found out that this needs to be flashed via TTL, however the plug seems to be stuck in a boot loop now.

Okay, that’s really weird. But good that it works now. :slight_smile:

I do not setup the proxy function now but I will do this to in the near future. I use this plug to monitor the washing machine. The goal is to get a device that holds the full intelligence and reports only the actual status as a text sensor to Home Assistant. My ESPHome software is now fully functional but the last thing to perfection is to connect a (bluetooth) door sensor directly to this plug.

Therefore I have to setup the bluetooth integration in the future. But first I have to find a native working bluetooth door sensor. The Xiaomi is not such a thing. Maybe the Shelly Blu will work.

So you already implemented and flashed esphome including the bluetooth part?
If so, mind sharing the bluetooth parts you used?
The unsuccesfull part I used to try was:

esp32_ble_tracker:
  scan_parameters:
    active: false

bluetooth_proxy:
  active: true

The needle setup looks pretty similar to mine here XD.
Will probably give the bluetooth part another try at the weekend.