Shelly1, local MQTT with HA, 3-way light switch

I just received my Shelly1’s in the mail this week and started to experiment with them today. I came accross some issue with MQTT.

  • The Shelly1 posts periodic updates of the state of the switch and the relay. The value of the relay is always correct but the value of the switch is always reported as 0, even if it should be 1. The value of the switch is still reported correctly when it changes.
  • I was able to disable the periodic update by going to http://192.168.x.x/settings?mqtt_update_period=0 and this solved the issue with the incorrect periodic status reports.
  • However this introduced a new issue where the status of the relay is not reported back when it changes. This still works fine for the switch.

I’m using the latest firmware ( 20190103-091629/v1.4.4) and have tried this on multiple Shelly1’s.

For now I can work with this because I use Philips Hue bulbs anyway and really only need the switch input but this bug makes Home Assistant automations using the switch as input and the relay as output unusable.

I will try to report this bug to the developer so hopefully it can be fixed in a future firmware update.

1 Like

Report it on their fb page, its the quickest I think

Yep I did and it was already reported before and confirmed to be fixed in the next release. In the meantime there is a hotfix but I didn’t bother figuring out how to update to that version over the air. Here it is:

Perhaps one of you guys can help me out here. I am running on Ubuntu. I have a Shelly1 installed, running the stock firmware v1.4.4. I set it up to talk to the MQTT broker addon. I can see that it connects from the broker logs.

1548215187: New connection from <shelly IP> on port 1883.
1548215187: New client connected from <shelly IP> as shelly1-<serial> (c1, k60, u'username').

My MQTT yaml settings are:

broker: !secret mqtt_address
port: 1883
username: !secret mqtt_username
password: !secret mqtt_password
discovery: true
discovery_prefix: homeassistant

I can connect via the Chrome extension, MQTT Explorer, and verified via the logs.

1548216187: New connection from <extention ip address> on port 1883.
1548216187: New client connected from <extention ip address> as <MQTT client id> (c1, k10, u'username').

However, when I try to publish a payload (On or Off) it fails to do anything. I don’t see any change on the Shelly local server nor do I see anything in the MQTT broker log. The lights don’t budge either. I can turn them on/off via the Shelly IP address so I know that works.

I am publishing the On/Off commands to


Is the issue that I have the MQTT addon installed and running as well as the MQTT config settings in a yaml file? Or am I missing something completely else? I tried to use the guide from the OP and watched the video from The Hook Up. But no dice.


I’m on ubuntu but running HA in VENV, I can run from HA services like this:

The service dev tool allows you to call any available service in Home Assistant.

Service Data (JSON, optional)
{“topic”: “shellies/shelly1-xxxxxx/relay/0/command”,“payload”:“on”}


Can you toggle the switch from Shelly’s own web interface when connected to it’s wifi?

I was able to turn the light on/off via the service call. I had to remove the MQTT integration under the config menu and re-added it. Everything works now. Thanks.

I want to point out that the 3-way switch diagram can be dangerous, we need make sure that (SW), (L) and (I) lines are all fed from the same phase, I noticed that it’s common to find hot wires from different phases in same room and in adjustment light switches and outlets, at least it’s common in my house, if you feed (L) and (I) from another switch as mentioned in the diagram just make sure it’s from the same phase fed to (SW). Otherwise your Shelly will blowup.

1 Like

Been there, Done that, Got the T-shirt (a blown Shelly :frowning: )
I would like to be able to control my stair-light but the phase is only available downstairs (and no room for a Shelly) and the sw input (via correspandace) is only available upstairs.
Anyone got an idea on what to do?

is this an issue in US residential homes? I thought we were mostly single phase here


I like to comfirm that with Swedish and probably european standard shelly works just fine with 3-way stair switch. I have done it and here is some wirering and some helpful hints.

My installation was a maiden installation, I only had 2 switches from the start but changed it to 3 at the same time as I introduced the shelly. This is the wiring.

To be noted is that Switch 1 and 3 are standard switches according to swedish standard, while switch 2 is different purpose built for 3 switch stair applications (still standard, but different). Also to be noted, I didn’t put my shelly behind any switch, the reason for this is the place to put it would be in the in the box behind the 3rd switch, but I don’t have null or line there. Therefore I put the shelly in the ceiling box behind the first light, at least I had null there, but I had to pull a line from the first switch to the first light, because there was only the “SW” there. But all this depends on how you wires are pulled in your house.

Now to Shelly, Shelly works out of the box to do this. The only thing you have to make sure is that you set the switch type to EDGE. This means that it toggles between off and on whenever any of the switches change state.

I’m using Shelly out of the box MQTT (I have 15 installed), but I have had problem with some when I get them. To be sure that they work, connect them to you WIFI according to instructions, then do a firmware upgrade. You don’t have to connect the device to do this, just make sure they are connected to the wifi and update firmware.
I will not go in to how to set up MQTT in HA or in shelly, a lot of people have done that already, but if you have any question please ask.

Best Regards

1 Like

I have 1 Shelly 1. The original firmware with cloud disabled and mqtt enabled works great 99.5% of the time, but very infrequently I have a problem that the shelly looses connection with my wifi. The only thing that will sort this is power cycling the shelly 1. This is awkward as it means toggling the circuit breaker in the consumer unit for the lighting circuit. Although this isn’t the end of the world, it an annoying usecase I want to removed.

I am considering either tasmota or esphome and levage a rule to reboot the shelly device with 5 consecutive toggles of the light switch. It appears to have been achieved as per this thread: DIY Automate Existing Light Switch: ESPHome on a Sonoff Basic in the gang box!

Does anyone also know how to perform this in tasmota? Any advantages/ disadvantages? (I am already using a combination of tasmota and esphome on some of my other devices, but I have never written any rules!).

Anyone else have this problem? Any other solutions?


Oh, that’s nice!

I hadn’t considered this option:

(Taken from the linked google group):

on Wifi#Disconnected do ruletimer1 900 endon
on Wifi#Connected do ruletimer1 0 endon
on Rule#Timer=1 do restart 1 endon

Very interesting, thanks.


I assume there is an equivalent of “edge mode” in Tasmota?

I think this is the default in Tasmota. Most of my shelly’s use ‘edge switches’ (I have one that I had to switch to momentary switch, because of the wiring did not allow edge switch)


Suggest that you try with doing a firmware update first, I have 15 units without any problem. You don’t have to connect to the cloud, just being connected to wifi. Just put the ip address of the Shelly (typically 192.168.1.xx) in the browser, when the shelly pops up do the firmware upgrade under settings.

Also double check your wifi, I used to have zyxel wifi access points and a lot of strange things happened, Changed to Ubiquiti Unifi AP AC LR, (with long range antennas) and everything got perfect (3 weeks now)


Have just checked and there is a firmware update. I have applied this and will monitor… My wifi seems OK for everything else (3* Tenda MW6 units). I will see how I get on with the new firmware.

I can get more than 3 weeks without a connection problem, but when it drops off the network, that’s it, it’s are gone, can’t ping them, don’t reconnect after a wifi reboot etc… etc… The only thing that get them to reconnect is a power cycle…

Just checked connectivity and the shelly is showing RSSI: -48dBm (is this good?!)




I check my signal strengh in my worst placed shellys.

Bilen WiFi RSSI: -73 dBm Worst, sitting in my garage one floor down from the access point
Entre WiFi RSSI: -66 dBm Quite bad one floordown from the access point.

-73 dBm is much worse than -48dBm, and mine are working fine.

However this is only the part of the answer if the wifi should work fine.
(I’m no Wifi expert, but picked up something about radio during my 30 years in Mobile business.)
Firstly this (-48dBm) is the signal strenght that the Shelly receives, there has to be balance between sending and receiving, most likely, the shelly has less out put power and worse antennas than your access point. This could mean that your access point might reach your shelly, but the shelly might not have the power to reach to access point.

More likely, you have interference, Wifi rfequences are a shared resource, even if I live in a house with quite some distance they some times interfere with my Wifi. More than that, My son some times place forthnight, watch youtube at the same time as he skype with his friends. This fills up the radio waves. This is partly why I changed access points to dual band, moving all the heavy videos to 5Ghz, leaving shellys and others on 2.4Ghz. This would also explain why you only have problems some times, (maybe the neighbours gaming and video night with her friends). If you want to see how wifi is used in your neighbour hood you can down load a “wifi analyzer” on you mobile and how "clean the frequencies you are using are.

Still regardless, I don’t think the shelly should hang because of this, maybe appear a bit slow or in worst case not accessable for some time.

Still believe more in the firmware, or even your hardware.

Best Regards

My gut feel is that it isn’t the WiFi. I have left it to see if it reconnects and 2 days later, still nothing. As soon as I bounce the power, it reconnects immediately. My sonoffs, with tasmota, sometimes drop their connections, but they always reconnect pretty quickly.

I’ll leave this one on soak for a few weeks and if it drops will dig it out of the ceiling rose and flash with tasmota with the tips shown above.



I believe it will work after firmware upgrade, as said I have 15 installed, never had a problem even with my dodgy old wifi.