[SOLVED] Shelly 1, alternative to Sonoff

tasmota
shelly1
Tags: #<Tag:0x00007f01474ce510> #<Tag:0x00007f01474ce380>

(Ra) #1

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.


(Rich Koshak) #2

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.


(Kristof Rado) #3

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


(Ra) #4

Rest api.


(Kristof Rado) #5

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


(Ra) #6

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.


(Rohnny Swennen) #7

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


(Ra) #8

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.


(Ra) #9

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


(Kevin Hawkins) #10

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


(Ra) #11

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


(Ji Po) #12

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


(Ra) #13

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.


(Ji Po) #14

Thank you, it works!


(J. Lucas) #15

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?


(Vincent Regaud) #16

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.


(Gad Ofir) #17

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


(J. Lucas) #18

https://shelly.cloud


(J. Lucas) #19

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


(wallebalboa) #20

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