Switch Shelly Plus Plug via mqtt

How to turn a Shelly Plus Plug on and off via MQTT? It runs OH 3.4 and is configured via text files.
I receive the current status via:

    Thing topic PlusPlug1 "PlusPlug1" {
      Type switch : S_PlPl1_Switch "Shelly + Plug 1 Switch"   [ stateTopic="shellyplusplugs1/status/switch:0", transformationPattern="JSONPATH:$.output", on="true", off="false"]

Hat jemand eine funktionierende Konfiguration und kann sie mit mir teilen?

The commandTopic is missing in your configuration.

yes, because I don’t know what it should look like. Command isn’t sent over the same channel, is it?

You first have to make sure to have latest firmware on your plug, as there was a bug within mqtt. After that, just follow the config examples from Shelly.

The Shelly is on firmware v1.0.3 and says it is the latest.

Ok then, please check the Shelly MQTT documentation what command needs to be send to what topic and configure the channel accordingly.

According to the documentation that would be:


I get the current switching status displayed, but I can’t switch myself via OH.

Type switch : S_PlPl1_Switch "Shelly + Plug 1 Switch"   [ stateTopic="shellyplusplugs1/status/switch:0", commandTopic="shellyplusplugs1/command/switch:0", transformationPattern="JSONPATH:$.output", on="true", off="false"]

The problem seems to be passing on status true and false. But for switching on and off is expected. How do you get everything working into a channel definition?

stateTopic="shellyplusplugs1/status/switch:0", transformationPattern="JSONPATH:$.output", on="true", off="false",

commandTopic="shellyplusplugs1/command/switch:0", transformationPatternOut="" , on="on", off="off"