Shelly Plus Plug S (Gen2) with OH 3.4

Hi there,
recently I configured both version Gen1 and Gen2 Shelly Plug Plus S in OpenHAB 3.4. Below you can find a Thing code for channels in both cases. Simply this channel only turn on/off a Shelly socket but the principle will be same with Shelly relays and other parameters.

Shelly Gen1

    UID: mqtt:topic:pihome:shelly
    label: Shelly zásuvka
    thingTypeUID: mqtt:topic
    configuration:
      payloadNotAvailable: off
      payloadAvailable: on
    bridgeUID: mqtt:broker:pihome
    location: MQTT
    channels:
      - id: Relay0
        channelTypeUID: mqtt:switch
        label: Relay0
        description: null
        configuration:
          commandTopic: shellies/shellyplug-s-XXXXXXXXX/relay/0/command
          stateTopic: shellies/shellyplug-s-XXXXXXXXXXX/relay/0
          off: off
          on: on

or Gen 2 structured MQTT message:

UID: mqtt:topic:pihome:shellyplusplugs-xxxxxxxxxx
label: Shelly PLug SW001
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: off
  payloadAvailable: on
bridgeUID: mqtt:broker:pihome
location: MQTT
channels:
  - id: relay0
    channelTypeUID: mqtt:switch
    label: Power Switch
    description: null
    configuration:
      commandTopic: shellyplusplugs-xxxxxxxxxxxx/rpc
      formatBeforePublish: '{"id":0, "src":"MQTT","method":"Switch.Set", "params":{"id":0,"on":%s}}'
      stateTopic: shellyplusplugs-xxxxxxxxxxxxxx/status/switch:0
      transformationPattern: JSONPATH:$.output
      off: "false"
      on: "true"

Detailed tutorial can be found in our original article here.

Hope it helps.

Majkee, OpenTUX

1 Like