Shelly1 over MQTT in openHAB

This page describe how to integrate a shelly1 device with the original firmware in openHAB 2.4 using MQTT.

First you should power up the device with 24-60V DC or 220V AC. on PIN N and L. Where N is + and L – in case of 24-60V DC. Now a new shelly1 will create his own WLAN access point. The WLAN has the unique name of the shelly device: „shelly1-XXXXXX“. Connect to this WLAN with your smartphone (before your neighbour is doing it) and go the the web page with the address

Now you go to Internet & Security and configure your local WLAN access. Type in your WLAN Name of your WLAN router and the password. Save it and shelly1 will restart. Now its connecting to our WLAN and is not visible from outside anymore.

Go to your router and check the ip address which is assigned to your shelly1

Now you connect again with your web browser. Here

Go to Internet and Security again and configure in the „Advanced – Developer settings the MQTT broker parameters.

Set the ip address of your MQTT broker. In my case the broker is only visible in the local network. So no password is needed. In case you want you can chage the topic name in Will Topic. I keep it here default. Save it and the shelly will regiter in the broker.

Registered topics

You have now these topics registered. I assume that you have configured MQTT in your openHAB like it is decribed here.

So now you can add the channel to switch you channel:

Bridge mqtt:broker:mosquitto "Mosquitto" [ host="", secure=false, clientID="openHAB2", qos="1"]
  // Shelly 1
  Thing topic shelly1Esszimmer "Shelly1Esszimmer" @ "Esszimmer" {
      Type switch : power "Power"  [ stateTopic="shellies/shelly1-1D9F21/relay/0", on="on", off="off", commandTopic="shellies/shelly1-1D9F21/relay/0/command", on="on", off="off" ]

Add also a an item in in your items configuration:

Switch MQTT_S_Shelly1Esszimmer "Shelly Esszimmer" {channel="mqtt:topic:mosquitto:shelly1Esszimmer:power"}

And finally place a switch in your sitemap:

Switch item=MQTT_S_Shelly1Esszimmer 

Now you can switch your device with openHAB 2.4 or newer!