Shelly Plus 1 flashing and setup guide/ tutorial

Ah thanks, I figured that it might be the connected to the Pi after googling the error. I’ll add a note to the guide.

Thank you for the comprehensive summary, it worked for me without problems when flashing via AMD64 processor.

Unfortunately, when flashing via the ESPHome integration in Home Assistant on my RPi 4, I get errors

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown

I suppose this is the issue you mentioned regarding ARM devices?
Is there any possibility to fix this?

Thanks and kind regards!

One remark: RX and TX is switched in the screenshot (see here: Picture and Link)
Regarding your solution with the needles, just for information:
It’s also possible to use pin headers with 1.27 mm pitch (0.4 mm square pins)

As i am aware there is no solution for the Pi right now. Maybe in a future update of esphome.

As it says in the picture RX and TX are already transposed so you should be able to just plug in the cables as it says on your Adapter. For someone with absolutely no experience with UART I think it is easier that way.

Great addition with the headers. I was aware that there are matching headers but did not know the right size. Thanks!

If you use the pin headers linked, how are you connecting the headers to the UART adapter?

I thought that would be easier and safer than the needles, but my Dupont cables are too big for the headers. Would I solder the headers to wires?

The pin headers would be the nicer option for sure. Yes you would need to solder your ends of the Dupont cables to it

Easiest way to flash to ESPHome (imo) is to do it in the next order. Using this, you dont need to connect the shelly with wires.

  1. Connect Shelly to local wifi network.

  2. Flash the Shelly to Tasmota, using this link:
    GitHub - tasmota/mgos32-to-tasmota32: ESP32 Mongoose OS to Tasmota32 OTA Firmware Updates for Shelly

  3. Now flash the ESPHome firmware using this link:
    Migrating from Tasmota — ESPHome

In this way I did all my Shelly devices. Works great!


Very cool solution! Seems pretty new and I think it was not available when I flashed mine.
I’ll add your comment to the guide.

1 Like

Can I ask a really dumb question? Only because I am very new to Shelly and ESPHome. What is the advantage of flashing a Shelly Plus 1 to ESPHome rather that just using the HA Shelly integration?

1 Like

I’ve never so much as touched anything Tasmota, so maybe I’m doing something really stupid… But I’m stuck trying to upload the ESPHome firmware. I’ve compressed the binary into a gzip file but the upload fails due to it still being too big (I’ve also commented everything out but the absolute minimum ESPHome setup stuff).

The Tasmota to ESPHome migration page mentions a minimal version of Tasmota being needed, but there doesn’t appear to be an ESP32 based one?

Any help is appreciated. I’ve always just gone the serial method with the regular Shelly’s but figured I’d try a pure OTA method with these.

The only big plus for me is that you can check if HA is reachable. If something doe not work, wifi, HA, what else, you can let the Shelly work as a normal switch and just toggle the light as normal.
Ps. I have smartbulbs.
But the rest of the functionality should work without esphome

Still interested in getting the OTA conversion method to work, but I got inpatient and finally just flashed it over serial. Works fine using the example YAML but my primary use-case was to use it as a BT Proxy (in addition to other things). Unfortunately, after spending several hours going through every permutation I could think of, anytime I included the BT Proxy YAML, while it would compile and let me upload it just fine (OTA or serial), the device would never connect to WiFi and I’d have to serially flash firmware without BT Proxy to get it back.

Has anyone ever figured out a way to get this working? I explicitly was going to use it with a device that requires an active BT connection (SwitchBot lock), so unfortunately the current Shelly firmware doesn’t work either, as it doesn’t support this. May just have to send these back to Amazon…

Are you sure you got the Gen 2 Shelly versions that have a bluetooth chip? The previous generation (Gen 1) did not have bluetooth but are still for sale on Amazon and other channels. I have some of the older Gen 1 Shelly’s and just recently purchased a Shelly 1 Plus (Gen 2) myself and its bluetooth works.

The problem is that the Shelly firmware only supports passive BT (as in no back and forth communication, which is required in my case). I also verified this with the second one I had (picked up all my other BT devices except the one that requires an active connection). I was hoping to use ESPHome to get around this limitation but at least at the moment doesn’t appear possible.

And yes, I definitely have the Plus version with the ESP32 chip. :slight_smile:

Or had, I sent them back.

ok, that actually helps me out too then. I just got the Shelly Plus 1 last week hoping to use as proxy for an LD2410 and it’s not working with it, either. Kinda bummed because I figured replacing the fan switch in the bathroom with a Gen2 Shelly would give me a close proxy for the mmWave sensor also in the bathroom. Looks like I’ll just do a regular ESP32 with a physical connection to the LD2410 to save myself the headache.

Thank you for sharing this. I was able to successfully OTA a couple of these devices (Tasmota, then ESPHome), but after doing that, they wouldn’t OTA from ESPHome, I assume due to having Tasmota safeboot. I ended up flashing using sewing needles, and it was a pain in the ass but it did work. The main issue I had was I needed an external 3.3V supply; my FTDI adapter couldn’t provide enough power to keep the Shelly Plus 1’s from browning out constantly.


Another annotation here:
I’ll also update the post on top.
The API password is deprecated since a few months. You need to use a enryption key for that now.
Add the key under api instead of the password.

    key: "your_key_here"

You can get a key here: Native API Component — ESPHome

You should also add this to your config and change the password.
This enables a fallback hotspot if the shelly can’t connect to your wifi.

    ssid: "Shelly Fallback Hotspot"
    password: !secret wifi_ap_password

The second change that can be added to your config is a check if the shelly can reach home assistant.
I configured mine that if it fails to connect to HA, then it changes its operation mode from triggering a service in HA to simply switching the relais. So if my homeassitant is not reachable my lights simply revert back to standard light switch mode.

#Switch input 
  - platform: gpio
    name: "${device_name} Switch"
    pin: GPIO4
        - if:
                - api.connected:
                - switch.turn_on: "relay"
                - homeassistant.service:
                    service: light.toggle
                      entity_id: light.arbeitszimmer
                - logger.log: "It works?"
                - switch.toggle: "relay"
      - delayed_on_off: 50ms

These modifications should help you out if something with your connection fails.

I was able to flash Tasmota using the OTA procedure, but couldn’t flash ESPHome OTA via Tasmota. Uploading the factory.bin image failed due to invalid hash, and compressing the image with gzip and then uploading failed because the image size was too large. I think this is due to the safeboot configuration in Tasmota. Not sure if its possible to skip this step during the upgrade, as the Shelly → Tasmota install procedure says that failing to convert to safeboot will result in the device getting bricked on the next firmware update.

Here’s my $0.02 on this… I bought the Shelly Plus 1’s and thought “cool, I’ll flash them” and I did one to see how it works. In my opinion, I prefer the Shelly firmware over ESPHome in this case. All of my Shelly firmware 1’s work great, while the one I flashed with ESPHome goes on and offline constantly, even though there is an access point 5 feet away, unobstructed. It’s enough of a hassle that I’m going to ditch that ESPHome flashed device and put a regular Shelly in its place.

This was my first dive into Shelly and I’m really impressed with everything about them, enough so that I’ve bought a dozen Shelly’s (and of course they go into my subnet that is 100% blocked from the Internet until I want a firmware update).

Are you doing Bluetooth proxy with the esphone version?

@Budget-Seat, it would be good to edit your original post as with the latest version of Tasmota the process no longer works. Converting to Tasmota is fine but if your end goal is to run ESPHome on the Shelly device then you only get one opportunity to load an ESPHome firmware image. Loading a ESPHome image via the Tasmota web console is fine, and the ESPHome firmware runs as expected. However, after that all OTA updates using ESPHome fail. If you initially flash the ESPHome image via serial then subsequent OTA updates via ESPHome work as expected.

See this issue on github