[SOLVED] Shelly 1, alternative to Sonoff

No need for programming cable.

How to install:
Execute from your browser from Shelly1
http://Shelly1IP/ota?url=http://api.shelly.cloud/firmware/custom/SHSW-1-beta-MQTT.zip

for shelly2
http://Shelly1IP/ota?url=http://api.shelly.cloud/firm…/custom/SHSW-21-beta-MQTT.zip

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…
Thanks

From their FB support page:

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

http://192.168.33.1/settings/…

Enabling MQTT disables Allterco Shelly Cloud and vice versa.

Device subscribes to following topic for each channel

shellies/{hostname}/relay/{channel}/command

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

shellies/{hostname}/roller/0/command

Hostname is the same from http://192.168.33.1/settings, 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:

shellies/{hostname}/relay/{channel}

shellies/{hostname}/roller/0

with given command.

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

shellies/{hostname}/relay/{channel}/power

shellies/{hostname}/relay/{channel}/energy

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

shellies/{hostname}/relay/power

shellies/{hostname}/relay/energy

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.

3 Likes

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:

NULL=NULL
ON=1
OFF=0
0=OFF
1=ON

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.

3 Likes

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

https://shelly.cloud

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?
item:
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)]" }

shelly.map:
ON=on
OFF=off
off=OFF
on=ON

2 Likes

autoupdate=“false”

Works Great! Thnx!
Switch Shelly1_V2 { autoupdate=“false”, mqtt=" >[housebroker:shellies/shelly1-XXXXXX/relay/0/command:command:*:MAP(shelly.map)], <[housebroker:shellies/shelly1-XXXXXX/relay/0:state:MAP(shelly.map)]" }

2 Likes

The docs aren’t very clear about this, but where you get prompt feedback from a real device it’s a;ways worth considering disabling autoupdate on an Item.

Do you have some video or something how to add shelly into openhab2? I am very new at openhab.

Hi,

does anyone have experiences which is the better Firmware? Tasmota or Shelly original?

Are there pros/cons?

I buy two Shelly 1, i want to co troll it with mqtt and see only one pro for tasmota: Same interface (like my sonoffs)

Since you use mqtt, I guess that after enabling mqtt and setting its parameters you won’t be using the web interface anymore. Only missing link on current shelly FW is that it is slightly less easy to update. You need to know the IP address as OTA currently only works via the HTTP API. Although keeping track of a list of fixed Shelly IPs is not that hard, Sonoff can be triggered via mqtt so you do not need to keep track of such list.
I already asked shelly to add an ip response to their mqtt announce response, let’s hope they will.

Thanks for the quick response, tracking IP address is no problem for me. I have already a list where all my sonoffs a notice with IP etc. and also entered everything clean in the router.

So there’s no reason to switch to Tasmota, right? :slight_smile:

No reason for switching Tasmota firmware.
I just finished installing a Shelly1 and Shelly2 for my lights, very happy with the result.

1 Like

They only advantage I see for Tasmota is they have a central adminstration server available to update, monitor, configure devices instead of needing to go to each device individually.

i get it to work with a map file translating lowercase to uppercase on=ON and reverse

Thx!
This got it to work for me.