OpenHab, Shelly1, Mosquitto/REST - does not work

Platform information:

  • Hardware: Raspberry PI3
  • OS: Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux
  • Java™ SE Runtime Environment (build 1.8.0_191-b12)
  • openHAB version: 2.4.0

at the moment I’m trying to integrate the Shelly 1 into my OpenHab via MQTT.
According to the guides here I done following:

  • Install of MQTT Binding (2.4.0)
  • Add thing MQTTBroker
  • Add channel (mqtt:broker:0e1982c5:shelly1-15E1F2)
  • Install mosquito
  • At shelly1 enable option ‘action execution via MQTT’

At mosquitto.log I can see that OpenHab and the Shelly are connected both.


Switch ShellyTest	"Shelly Test" <light>	(gSF_Corridor, Lights)  { mqtt=">[MQTTBroker:shellies/shelly1-15E1F2/relay/0/command:command:*:MAP(],<[MQTTBroker:shellies/shelly1-15E1F2/relay/0:state:MAP(]" }

Switch ShellyTest2  "Shelly Test2" { http=">[ON:GET:] >[OFF:GET:]" }


Do you have any idea what I’m doing wrong? Cause when I press the switch button ‘ShellyTest’, nothing happens. Only the ‘ShellyTest2’ (rest, no MQTT) works fine, but I cannot read the status of the Shelly there.

Thanks a lot

The MQTT2 version binding works via Things, Channels and Items linked to Channels.
In your example you are using the old MQTT1 definitions.
So either change your definitions or install the legacy MQTT1 binding.

Ah ok. Can you tell me how to do it with MQTT2?

Thanks sihui, I already read this article, but the configuration is still unclear.

For my shelly1 the MQTT topic should be



When I try to link to channel to a item, the list is empty.

That is your broker thing
You now need to add a new MQTT generic thing

PaperUI -> Configuration -> Things -> + -> MQTT -> Add manually -> Generic Thing

1 Like

I’m also struggleing with the new mqtt binding (2.4.0).

I’m using the shelly 2 for controlling the roller shutters. but i don’t get the correct values send via mqtt. the roller shutter item only sends 0 or 100, but shelly expects open or close.
can this be done via a map file? where to put this in paperUI or in item-file?

After reading this howto it is clearer now.

But after creating a Generic Thing and adding a new channel, the status is “OFFLINE - COMMUNICATION_ERROR java.lang.Exception: No MQTT client”

Perhaps there is a misconfiguration of the state and command topic:


Shelly1: MQTT
Shelly1 uses the following topics:

shellies/shelly1-<deviceid>/relay/0 to report status: on or off
shellies/shelly1-<deviceid>/relay/0/command accepts on and off and applies accordingly
Shelly1: /settings

That should be correct, isn’t it?

Bug in OH 2.4. this is already fixed in OH 2.5 snapshots. Alternative: declare the broker in a separate file and don’t touch it while openhab is running.

after reading several other threads i’ve found a solution.

just created one channel of type “text”

String Rollo1ArbeitStatus      "Rollo Arbeit [%s]" (gRollo) {channel="mqtt:topic:Rollo1Arbeit:state"}

And in sitemap defined a switch with a mapping.

Switch item=Rollo1ArbeitStatus icon="blinds" mappings=[open="AUF",close="ZU"]

in BasicUI it looks like this, and it works! :wink:
i could add a mapping to show currect state in text next to buttons.


Rollershutters are percentage values in openHAB, that’s true. Glad you found a solution (a switch is more suitable for shellys in this case).

@ David_Graeff, puh, too much bugs for me :wink:

Do you have any idea, how to get the status of the Shelly via rest? Here I can send a command, but how can I get the status into the switch in addition?

Switch ShellyTest2  "Shelly Test2" { http=">[ON:GET:] >[OFF:GET:]" }

There is only one bug (“java.lang.Exception: No MQTT client”) which is amazing for the code size of mqtt related bundles.

Does anybody know, how to get the status of the Shelly via rest? Here I can send a command, but how can I get the status into the switch in addition?

Switch ShellyTest2  "Shelly Test2" { http=">[ON:GET:] >[OFF:GET:]" }

As far as I know all Shelly devices return their status information if you send a “/status” GET request, e.g. This will return a JSON buffer and you can extract the value you need from this response.

Currently, I don’t have a working openHAB example but I will work on it the next days.