Introduction to Shelly MQTT

Shelly devices support the  MQTT protocol without the need for flashing.

However if you enable this option you loose the ability to control the device from the Shelly cloud.

The MQTT API is here

However compared to Tasmota the Shelly MQTT commands are very basic.

You are more or less limited to operating the switch.

Configuring MQTT on Shelly

To configure MQTT on Shelly you need to connect to the device using http and for that you will need the IP address..

The easiest way to find the IP address is to go to the DHCP server and you should locate it there.


You will notice that I have configure mine with a static IP address and I would advise you to do the same with all of your IOT devices and don’t forget to update your network documentation

The MQTT settings are located under the Internet and Security>Advanced-Developer Settings.

The first thing you will need to do is enable MQTT.


Then you will need to configure:

  • Username and password if needed
  • MQTT server address and port
  • Enable if desired a custom prefix see topics below
  • Reconnect time outs
  • Clean sessions -Normally left as default =enabled
  • QOS  – Normally leftas default =0
  • Retain – default =disabled consider setting to enabled see MQTT notes.

The screen shot below shows my configuration:


Shelly Topics

Shelly devices publish on the topic root shellies and this cannot be changed as far as I can tell.

The topic format is


common values for xxx=relay,input,online



Below is a screen shot of published message/topics of a shelly device


Shelly devices are set to a 30 seconds publish interval even though the switch status hasn’t changed

The device also publishes messages when restarted on the topics


A screen shot of theses messages and topics is shown below:


note: the format is shellies/device_name/announce etc

MQTT Notes

Username and password is basic security supported by the MQTT protocol. Whether or not you need to use this is determined by the MQTT broker.

Time outs are used for connection retry in the event of a connection failure and there is usually no need to change these.

The keep alive timer is basically a network ping that checks that the MQTT connection is intact. The 60s default value is standard.

The QOS setting is used for message reliability. the values are 0,1,2 with 2 being the most reliable. With a simple device like a switch then 0 is OK. See understanding MQTT QOS for more details.

The clean session setting is used along with QOS 1 and 2  for message delivery. The default value tells the broker not to remember anything about the previous connection and is OK for a simple switch.

The Retain flag is used to tell the broker to remember the last value until it gets a new one. Switches that don’t publish data very often would usually set the flag to true.

The current default on Shellies is a 30 sec publish interval (note state changes are published immediately). I would set this to true and change the default publish interval to 300 secs.

Shelly MQTT vs Tasmota MQTT

Shelly MQTT is easier to use as it offers less features than Tasmota.

Tasmota offers many different configuration options like Wi-Fi network switching an multiple brokers and is the better choice for advanced users who require a high degree of customisation.

Common Questions and Answers

Q-Can I use timers on shelly devices?

A-Yes but they are configured via http and not MQTT and are much more limited that Tasmota devices.

Q- Can I change MQTT settings using MQTT.

A- No this needs to be done using http.

Q- Can I change device settings e.g Wi-Fi using MQTT.

A- No this needs to be done using http.

Q- Can I change the default publish interval.

A- Yes this is done using http and changing the mqtt_update period.

Related tutorials and resources:

Please Let me Know if you found it Useful
[Total: 0 Average: 0]

Leave a Reply

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