The Shelly 1 Smart Relay: Is it better than the Sonoff Basic?

Today on the hookup we’re going to take a look at a new product called the Shelly 1 that directly competes with everyone’s favorite $5 smart switch.  Does it have the right features to dethrone the sonoff as the go to device for DIY smart home enthusiasts? Lets find out.

A few weeks ago I was contacted by the CEO of a Bulgarian robotics company called Allterco Robotics, they had just launched a new wifi enabled relay that was designed specifically with makers in mind and he was wondering if I’d like to review it on The Hook Up.  I told him that I would love to check it out, with the understanding that I would give an unbiased and honest review, and here it is.

I’ve had the Shelly 1 for about a week now and I’ve been putting it through its paces.  Lets start out by talking about the completely unmodified stock firmware experience.  My first impression taking it out of the box was that I couldn’t believe how small it was.  If you’ve ever tried to fit a sonoff basic in a standard switch box, you know that it can’t happen without modification to the casing.  The shelly 1 is about the size of two oreos stacked on top of each other, which allows it to easily hide behind your existing switches.

The shelly 1 comes with firmware pre-installed to use with the shelly app for iphone and android, and the shelly cloud.  It behaves pretty much like any other off the shelf smart home product in that regard.  You hook it up, open the app, connect to the shelly via it’s broadcasted SSID, and put in your personal wifi information.

 

The app is nice, it has options for scenes, rooms, and schedules and they have a google home and amazon echo skill to enable voice control.  The app gives you the option to control the device locally, or connect it to the shelly cloud.  They have a well documented REST API, so even though a home assistant integration isn’t available yet, it shouldn’t be hard to create one.  I did monitor the non-cloud enabled shelly’s traffic with wireshark for 24 hours and I didn’t see any outgoing packets, only local multicast requests, so that’s encouraging.

But If you watch this channel, you probably already know that using this app isn’t really an option for my smart home.  I prefer to have complete control over my devices, which means knowing exactly what’s in the firmware’s code.

The great news is that the shelly 1 is actually made to have it’s firmware changed, and you don’t need to have a 3d printed part or a soldering iron to do it, you don’t even need to open the case (although I did brute force it open in order to satisfy my curiosity about how they fit everything into such a small package, more on that later).

On the back of the shelly 1 is an exposed set of female headers for RX, TX, VCC, Ground and GPIO-zero.  And if you’ve ever worked with a sonoff you know those are the 5 pins you need to access in order to flash the ESP8266.

Before we talk about custom firmware, lets look at some of the interesting differences between the hardware of a sonoff and a shelly1.

On the shelly 1 the relay is isolated, it doesn’t just send the 120 or 240V AC through to the output like a sonoff does, the shelly 1 has a relay in and a relay out terminal, meaning you can use this to switch low voltage if you want.

The shelly 1 is rated to 16 amps. Most people see the 10A rating on the sonoff and figure that it doesn’t matter since they probably won’t be pulling 10A through a singe device anyways.  The advantage of having the shelly rated as 16A is that it ensures that the shelly will not be the device that fails in an overcurrent situation.  Since most household switches are tied to 15A breakers, a sonoff could be as much as 50% over it’s rated current without tripping the breaker, which could result in a fire.  Since the shelly should be able to handle 16A based on its rating, it means that the breaker should trip before the shelly fails.

It's worth noting that some sonoffs are rated for 16 amps like the TH16, but they are about 3 times the price of a standard sonoff basic, and quite a bit bigger.

The shelly can also be operated on 24-60V DC, sonoff makes a the sonoff SV that can be operated between 5 and 24 volts DC, but again, it’s a separate device.

The shelly 1 GPIO cannot and should not be used while connected to mains voltage. While the sonoff makes reasonable efforts to isolate the high voltage and low voltage side of the board, the GPIO headers on the shelly are directly tied to the AC lines.  Specifically the ground on the header is tied directly to the hot wire or line voltage pin from the AC input.  I repeat, do not ever attempt to use the GPIO header of the shelly 1 when it is connected to mains voltage because the ground is referenced to your mains voltage.  Which leads me to my last point:

When using a sonoff we often use the GPIO pins to connect external switches or push buttons. As I said before, this would be extremely unsafe on the shelly 1 because those pins are carrying high voltage in reference to the neutral or ground wire in your house, which could result in a serious shock.  So how do you switch the shelly 1 manually?  The shelly includes a switching terminal labeled SW.  Applying mains voltage to the SW pin grounds GPIO5 on the ESP8266 and triggers the relay.  This means you are welcome to keep using your existing AC switch since it is rated for mains voltage, but you can’t use a low voltage switch like people often do with the sonoff.

Now that we’ve covered the hardware, lets look at the software. The most valuable addition to a sonoff basic, and the reason it has become such a favorite among DIY smart home enthusiasts is the ability to flash the custom tasmota firmware maintained by Theo Arends.  So naturally, I had to see how the shelly 1 handled tasmota.

Obviously, with the shelly 1 we get to skip a few steps in the process since our header pins are available from outside the cover.  You’ll still need to have an FTDI adapter, and you still need to make sure it has the 3.3V output selected, or you’ll fry the chip.  Hook up some jumper wires according to this wiring diagram and you’re ready to go.

Tasmota uploads and flashes exactly like a sonoff basic.  If you’ve never flashed tasmota, you should watch watch DrZzs video on the most current way to get that done.  When I uploaded the stock tasmota image and arrived at the web interface I noticed that the toggle button didn’t immediately do anything.

That’s okay, we just need to set up the GPIO pins correctly for this particular unit.  If you go to configuration and then configure module you can select generic from the drop down menu and then put GPIO4 as relay1 and GPIO5 as switch1.  Hit save and now you’ll be able to toggle the relay via the web interface.  Great.  But the switch still wasn’t functioning for me, at first I thought the shelly documents might be incorrect and the switch wasn’t actually on GPIO5, so I tested all of the pins.  None of them worked.  Combing through the shelly 1 documentation I noticed that it said that it was made for the SW pin to float when not switched on, but the tasmota firmware activates a pullup resistor on each GPIO when they are configured.  To get the switch working I had to edit the sonoff.ino file to use the pinmode “input” instead of “input_pullup” and reflash the firmware.  I also took this opportunity to add a custom profile in the sonoff_template file for the shelly1 so you can select it from the devices drop down menu.

I’ve posted the .bin file with the updated parts of the code in the video description so you can use the esp flash easy tool instead of fooling with the Arduino IDE.  I’ll be contacting Theo to see if there’s a way we can set the switch on this particular device to not be an input_pullup, but for now, my .bin file includes tasmota 6.1.1 with a fully working profile for the shelly 1.

Shelly1Tasmota Bin File: https://github.com/thehookup/shelly1tasmota/blob/master/shelly1tasmota.bin

To hook up the shelly 1 you will need to have a small length of white copper wire and 3 small lengths of black copper wire of the same gauge as the incoming line, this is usually 14 gauge for standard 15 amp circuits.

I figure this goes without saying, but I’m going to say it anyways: Mains voltage can kill you, if you get into your switch and there’s something strange going on that you don’t understand, it’s time to either get researching and learn about electrical building code and best practices, or hire a professional.

Before disconnecting anything make sure your breaker is off.  Flip the switch before you turn the breaker off to make sure the lights are working, then flip the breaker for that circuit and then test the switch again, if the lights don’t turn on you’re good to go.

Disconnect the hot line coming from your breaker to your switch and attach the two new black strands of wire to it using a wire nut.  Connect one strand to the L terminal of the shelly 1, and the other strand to the I terminal.  “L” stands for line voltage, “I” stands for input voltage for the relay. You’ll also need to have a neutral wire in the box for the shelly, you’ll probably have a bundle of neutrals, if so add your short white wire to the neutral bundle using a wire nut, you may need to have a larger wire nut if it won’t fit with the previous bundle.   Attach that neutral to your shelly 1.  Remove the wire going to the light from the top side of the switch and attach it to the O terminal of the shelly 1.  Replace that wire with a short length of black wire that will go to the SW terminal on the shelly 1.  Make sure all the screws are secure, but not over tightened.  Push the shelly 1 to the back of the switch box, screw the switch back in and you’re all done.  You can configure your switch in home assistant just like you would any other tasmota device and it will function just the same.

So is the Shelly 1 actually better than the sonoff basic?  Lets compare.

First lets consider price: A shelly 1 costs about 11 dollars from the shelly website vs the 6 dollar and 50 cent average price of the sonoff basic.  At the time of publishing this video searching for shelly 1 on amazon doesn’t yield any results, but the CEO of Allterco robotics sent me some direct links to the amazon pages for the shelly 1 that are priced at 11 dollars and 90 cents with amazon prime shipping.  Those links are down in the description. The shelly 2, a dual 8A relay switch with the same form factor as the shelly1, but without exposed GPIO headers is also available through those direct links with a price of $19.90, which is much better than the price of $35 that comes up from the normal amazon search. Even with the lower prices and amazon prime shipping the sonoff basic wins this category, and I think it will be nearly impossible for any company to compete with the crazy low price of the sonoff basic, but of course, price isn’t the only important thing.

Shelly 1 Amazon US: https://amzn.to/2BzVDYs
Shelly 2 Amazon US: https://amzn.to/2PqtE0i
Shelly 2 Amazon UK: https://amzn.to/2OYJezl

Next lets consider intended use:  The shelly is intended to be inside of a switch box, and the sonoff basic is intended to be used in line with a wall plug.  The shelly 1 should probably not be used outside of a switch box, and based on the fact that the housing of the sonoff has to be modified to fit into a switchbox it probably shouldn’t be used inside of a switchbox. There’s no clear winner in this category, your use case will decide which product will be best.

Next lets recap the hardware differences:  The sonoff basic has mostly isolated GPIO pins which allow for the use of low voltage switches and buttons with the sonoff.  As a number of youtube commenters have pointed out, these switches and buttons have a small chance of becoming energized with mains potentials if a power surge compromises the electrical traces on the board.  The shelly 1 has a high voltage switch terminal, which should only be used with high voltage rated switches with a proper ground connection.  The way that shelly has implemented switches limits options, but it also adds an amount of safety to the process by ensuring that the switches will always be properly grounded.  The shelly is rated to 16 amps, while the sonoff basic is only rated for 10 amps, as I said before, this ensures that a 15 amp circuit breaker will trip before the shelly 1 exceeds its rated voltage.  The shelly is also amazingly small, which means that the voltage creep tolerances are also small, but that doesn’t matter as much since we aren’t exposed to any non-grounded circuitry once the shelly is installed.  In this category I would say that the shelly comes out ahead from both a safety perspective, and a utility perspective.

I’m not ready to say that everyone should stop buying the sonoff basic and start buying the shelly 1 instead, but I do think that for the specific application of installation behind an existing switch, the shelly is clearly the better designed product.  If you’ve been looking for an affordable tasmota compatible product to convert your existing dumb switches into smart ones without the need for soldering you should check out the shelly 1 open source.

Shelly sent me a couple of other products to try out including the shelly 2 and the shelly4pro.  I’m currently in the process of running those through their paces and getting tasmota properly installed and working on them.  I’ll have reviews of those devices coming out in the next few weeks.  Let me know down in the comments if I missed any important information, or if you have questions about this product.  I said it before, but I’ll say it again, shelly is not paying me to do this review.  I agreed to do this review because I thought it looked like a great solution for smart home users like me who prefer to use custom firmware and non-cloud based solutions.  If you enjoyed this video, please consider subscribing, and as always, thanks for watching the hookup.

US Links:
Shelly 1 Amazon US: https://amzn.to/2BzVDYs
Shelly 2 Amazon US: https://amzn.to/2PqtE0i
FTDI Adapter Amazon US: https://amzn.to/2PpcoZv
Jumper Wires Amazon US: https://amzn.to/2o0Moa1

UK Links:
Shelly 2 Amazon UK: https://amzn.to/2OYJezl
FTDI Adapter Amazon UK: https://amzn.to/2w0kPlW
Jumper Wires Amazon UK: https://amzn.to/2MGyA2K

Shelly Website: https://shelly.cloud/

Shelly1Tasmota Bin File: https://github.com/thehookup/shelly1tasmota/blob/master/shelly1tasmota.bin

Visit my website: http://www.TheSmartHomeHookUp.com
Follow me on Twitter: @TheHookUp1

Support my channel:
Patreon: https://www.patreon.com/thehookup
US Amazon: https://amzn.to/2tphvyr
UK Amazon: https://amzn.to/2IytdMD

Music by www.BenSound.com

16 thoughts on “The Shelly 1 Smart Relay: Is it better than the Sonoff Basic?”

  1. Interesting device!
    Is it possible to connect a pushbutton to it? For me, it would be disturbing to switch on, then via software it switches off and the wall-switch is still in the same position.

      1. Just proofed it, I connected a pushbutton instead of the usual switch and set switchmode 3 in the tasmota console. So, thats easy going!
        Many thanks!

  2. So, with a physical switch connected, it is possible to toggle the state of the relais?
    Example situation: Turn on the light with the physical switch, turn it off via Web And then, if i switch the physical switch again (back to off position), the relais would switch on again?

      1. Hey! Are the switch modes available in Tasmota too? Just built my shelly1 into the wall and noticed that there is no MQTT support without flashing MongooseOS/Tasmota.

  3. I have tried to flash the tasmota, but no AP appears to configure it, used espeasy to flash.

    Can you perhapse share the code, so I can configure my AP in the bin file?

  4. Hi could you please reverse engineer the power part of the shelly ? I have some serious doubts that it has a good design and the lifespan of this devices is so small due to the fact that it does not have a good power

    1. That’s not really my expertise. I know a fair amount about electrical components, but I’m not an electrical engineer.

  5. Hello!

    First of all I would like to compliment you on your video, great tutorial!

    I myself have two Shelly 1’s. One I have flashed with the Tasmota firmware by using PlatformIO and this tutorial: https://youtu.be/sIVjeYZeLNU

    I also made your suggested changes to the sonoff.ino file regarding the pullup resistors. Having flashed the firmware, the sonoff perfectly pops up as an access point to which I connect succesfully. I can select the Shelly from the profile list. And then I ran into the problem.

    It seems the switch input is hovering and causing random switch behaviour. Sometimes the relays switches twice within 5 seconds. It switches all the time, no matter if I deselect it as a Shelly device. MQTT is not configured yet so it can’t be due to that. I am shure that it has to do with the Tasmota firmware because I don’t see the behaviour with the stock Shelly firmware.

    Do you have any suggestions on how to fix this?

Leave a Reply

Your email address will not be published. Required fields are marked *