[SOLVED] Shelly 1, alternative to Sonoff

Check this out https://www.youtube.com/watch?v=J20hxfUTP9I&t=607s

I bought 2, and deployed one of them yesterday. Using stock firmware with disabled cloud feature and very happy with result. Ordered Shelly 2 to test.


Thank’s for sharing. It looks like a great product for junction box installations.

I LOVE that it is built to support re flashing and that it supports Tasmota.

I moved this posting to the Hardware section and added a couple of tags so people can find it more easily.

Please come back with your experiences once you get it working! Wish these were around when I bought my zwave switches.

How did you manage to control this thing from openHab with its stock firmware? Through the rest api? Or it has mqtt?

Rest api.

Thanks! This device looks very promising to me. Did you connected it to a physical wall switch? How does it work?

Yes, I did connect it to physical switch exactly like it was done by The Hook Up. It works fine, my only issue so far is toggle switch, which is expected to be problem with relay.

I ordered some as well, they are currently out of stock but looking forward to receiving them.
Love the fact they can work as stand alone out in home automation system, think these are great for rental properties where tenant can choose to use or not use a home automation system

Quick update: installed Shelly2 to control 2 light switches (hallway 3 way switch and outdoor single pole). So far so good. It is easy to install if you have enough space in electrical box (not in my case so). Stock firmware is stable, just make sure that it is up to date. Also next update, end of September, should include MQTT support, so it will be easy to integrate with OH. Using api to check relay state has some downside as you know.

1 Like

Shelly release beta firmware with mqtt support. Enabling MQTT disables Shelly Cloud and vice versa. So no need to flash tasmota.

Do I need the programming cable to install this beta firmware or is it updateable over Ethernet ?

No need for programming cable.

How to install:
Execute from your browser from Shelly1

for shelly2

Hello, do you have some hints to the beta mqtt? What are the topics to command? I have found out only the topic with the status…

From their FB support page:

To use MQTT server a server name followed by port should be given.…

Enabling MQTT disables Allterco Shelly Cloud and vice versa.

Device subscribes to following topic for each channel


Shelly Switch2 also listens for commands on (roller mode should be enabled):


Hostname is the same from, channel is desired channel to command.

Valid commands are on and off and for roller they are open,close and stop

After each command device responds to topics:



with given command.

Power device sends measured power [W] and energy [W * 10] on topics:



For Shelly Switch2, which have two channels and one meter topics are:



Power data will be sent on

every measure where measured value differes with 5%
status with last measured value (within 5%) on 30 seconds
when channel is on and there is reconnect event

Available MQTT settings are:

“mqtt”: {
“enable”: true,
“server”: “shellynb-1-eu.shelly.cloud:1883”,
“user”: “test”,
“reconnect_timeout_max”: 60,
“reconnect_timeout_min”: 2,
“clean_session”: true,
“keep_alive”: 40,
“will_topic”: “”,
“will_message”: “”,
“max_qos”: 0,
“retain”: false
Any change of settings triggers restart of connection to server if enable is true.


Thank you, it works!

Switch Shelly203MQTT “Tisch” [ “Lighting” ] {mqtt=">[mosquitto:shellies/shellyswitch-9F5EEB/relay/0/command:command:on:1],>[shellies/shellyswitch-9F5EEB/relay/0/command:command:off:0],<[mosquitto:shellies/shellyswitch-9F5EEB/relay/0:state:default]"}

Switch Shelly201MQTT “Treppenhaus” [ “Lighting” ] {mqtt=">[mosquitto:shellies/shelly1-9F5ADD/relay/0/command:command:on:1],>[mosquitto:shellies/shelly1-9F5ADD/relay/0/command:command:off:0],<[mosquitto:shellies/shelly1-9F5ADD/relay/0:state:default]"}

Does not work. With MQTT FX works fine. Any Ideas?

1 Like

Please use the codes fences

Switch Shelly203MQTT “Tisch” [ “Lighting” ] {mqtt=">[mosquitto:shellies/shellyswitch-9F5EEB/relay/0/command:command:ON:1],>[shellies/shellyswitch-9F5EEB/relay/0/command:command:OFF:0],<[mosquitto:shellies/shellyswitch-9F5EEB/relay/0:state:default]"}

Switch Shelly201MQTT “Treppenhaus” [ “Lighting” ] {mqtt=">[mosquitto:shellies/shelly1-9F5ADD/relay/0/command:command:ON:1],>[mosquitto:shellies/shelly1-9F5ADD/relay/0/command:command:OFF:0],<[mosquitto:shellies/shelly1-9F5ADD/relay/0:state:default]"}

You need to use the ON and OFF in capital letters
OR use a MAP transform
Create a sheely.map file in your tranform folder with the following content:


Then your items become:

Switch Shelly203MQTT “Tisch” [ “Lighting” ] { mqtt=">[mosquitto:shellies/shellyswitch-9F5EEB/relay/0/command:command:*:MAP(shelly.map)],<[mosquitto:shellies/shellyswitch-9F5EEB/relay/0:state:MAP(shelly.map)]" }

Switch Shelly201MQTT “Treppenhaus” [ “Lighting” ] { mqtt=">[mosquitto:shellies/shelly1-9F5ADD/relay/0/command:command:*:MAP(shelly.map)],<[mosquitto:shellies/shelly1-9F5ADD/relay/0:state:MAP(shelly.map)]" }

I also recommend to add a space after the { and before the } as the binding parser can be picky.


anyone has link to shally that is not amazon?
i dont have option to order one…


I had forgotten the broker at the off. As soon as you do everything right, it works. Again, something learned. Thank you.

Hi. i get it to work with a map file translating lowercase to uppercase on=ON and reverse. i get feedback from device. ex if anything else then openHAB changes the status of relay the indicator will change. but if i disconnect the shelly and toggel the item the indicator will toggle. any suggestions?
Switch Shelly1_V2 { mqtt=" >[housebroker:shellies/shelly1-XXXXXX/relay/0/command:command:*:MAP(shelly.map)],
<[housebroker:shellies/shelly1-XXXXXX/relay/0:state:MAP(shelly.map)]" }