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.