Shelly Plus H&T configuration in MQTT

Dear community,

I try to get work my new Shelly Plus H&T with Openhab. Because the old Shelly binding failed to communicate with the device (the whole time in sleep mode) and the new Shelly binding is failed to install i decided to give a try to the MQTT.

I newer worked with MQTT before. I installed the Binding. Made a mqqt.things file, where i wrote:

Bridge mqtt:broker:myAuthentificatedBroker [ host="localhost",secure=false, username="xxxxx", password="XXXXXXXXXXXXXXXXXX" ]

Thing mqtt:topic:ShellyPlusHT "Shelly Plus H&T" (mqtt:broker:myAuthentificatedBroker) {
    Channels:
    
}

But i don’t know what i need to write to the channels and maybe in the items file to get the Temperature, Humidity, Battery state from the device.

Thank you for the help.
type or paste code here

for me it works like this:

Bridge mqtt:broker:mosquitto [ host="192.168.100.111",port="1883", secure=false ]
{
  Thing topic PlusHT1 "PlusHT1" {
    Channels:
      Type number : S_PlHT1_Batt "Shelly Plus HT1 Battery"    [ stateTopic="shellyplusht-7c87ce6bd1b0/status/devicepower:0", transformationPattern="JSONPATH:$.battery.percent"]
      Type number : S_PlHT1_Humi "Shelly Plus HT1 Humidity"   [ stateTopic="shellyplusht-7c87ce6bd1b0/status/humidity:0", transformationPattern="JSONPATH:$.rh"]
      Type number : S_PlHT1_Temp "Shelly Plus HT1 Temperatur" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/temperature:0", transformationPattern="JSONPATH:$.tC"]
      Type number : S_PlHT1_rssi "Shelly Plus HT1 RSSI"       [ stateTopic="shellyplusht-7c87ce6bd1b0/status/wifi", transformationPattern="JSONPATH:$.rssi"]
  }

Thank you. I added this to my mqtt.things. How can i get from this channels items to display in the sitemap file.

Thanks

About the entries in the items file:

Group:Number:SUM S_PlHT1 "Shelly Plus H&T 1 (MQTT)"   <settings>    ["Sensor"]
 Number S_PlHT1_Humi   "+HT1 MQTT Humidity [%.0f %%]" <humidity>    (S_PlHT1)  ["Humidity","Measurement"]    { channel="mqtt:topic:mosquitto:PlusHT1:S_PlHT1_Humi" }
 Number S_PlHT1_Temp   "+HT1 MQTT Temperatur [%.1f]"  <temperature> (S_PlHT1)  ["Temperature","Measurement"] { channel="mqtt:topic:mosquitto:PlusHT1:S_PlHT1_Temp" }
 Number S_PlHT1_rssi   "+HT1 MQTT rssi [%.0f]"        <cwifi>       (S_PlHT1)  ["Frequency"]                 { channel="mqtt:topic:mosquitto:PlusHT1:S_PlHT1_rssi" }

Somehow i don’t get any value.

mqtt.things

Bridge mqtt:broker:mosquitto [ host="localhost",secure=false, username="XXXXX", password="XXXXXXXXXXXXXXXXX" ]{

    Thing topic ShellyPlusHT "Shelly Plus H&T" {
        Channels:
            Type number : ShellyPlusHT_Battery      "Shelly Plus HT1 Battery"    [ stateTopic="shellyplusht-7c87ce6bd1b0/status/devicepower:0", transformationPattern="JSONPATH:$.battery.percent"]
            Type number : ShellyPlusHT_Humidity     "Shelly Plus HT1 Humidity"   [ stateTopic="shellyplusht-7c87ce6bd1b0/status/humidity:0", transformationPattern="JSONPATH:$.rh"]
            Type number : ShellyPlusHT_Temperature  "Shelly Plus HT1 Temperatur" [ stateTopic="shellyplusht-7c87ce6bd1b0/status/temperature:0", transformationPattern="JSONPATH:$.tC"]
            Type number : ShellyPlusHT_RSSI         "Shelly Plus HT1 RSSI"       [ stateTopic="shellyplusht-7c87ce6bd1b0/status/wifi", transformationPattern="JSONPATH:$.rssi"]
    }
}

mqtt.items

Group:Number:SUM ShellyPlusHT           "Shelly Plus H&T Bedroom (MQTT)"    <settings>    ["Sensor"]
 Number ShellyPlusHT_Humidity           "Bedroom MQTT Humidity [%.0f %%]"   <humidity>    (ShellyPlusHT)  ["Humidity","Measurement"]    { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_Humidity" }
 Number ShellyPlusHT_Temperature        "Bedroom MQTT Temperatur [%.1f]"    <temperature> (ShellyPlusHT)  ["Temperature","Measurement"] { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_Temperature" }
 Number ShellyPlusHT_RSSI               "Bedroom MQTT rssi [%.0f]"          <cwifi>       (ShellyPlusHT)  ["Frequency"]                 { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_RSSI" }
 Number ShellyPlusHT_Battery            "Bedroom MQTT Battery [%.0f %%]"    <batterylevel>    (ShellyPlusHT)  ["Battery","Measurement"]    { channel="mqtt:topic:mosquitto:ShellyPlusHT:ShellyPlusHT_Battery" }

default.sitemap

Group item=Bedroom {
                Default item=Bedroom_Light_Switch
                Default item=BedroomOuter_Shutter
                Switch item=BedroomOuter_Shutter mappings=[13="13%",30="30%",50="50%"]
                Default item=BedroomInner_Shutter
                Switch item=BedroomInner_Shutter mappings=[13="13%",30="30%",50="50%"]
                Default item=Bedroom_Light_Switch_Electric_Meter
                Default item=BedroomOuter_Shutter_Electric_Meter
                Default item=BedroomInner_Shutter_Electric_Meter
                Default item=ShellyPlusHT_Battery
                Default item=ShellyPlusHT_Humidity
                Default item=ShellyPlusHT_Temperature
}

The ID of your Shelly has to go in here

I did, but still no value transfered. I see in the MQTT explorer, but not in OH

Text item=ShellyPlusHT_Temperature

Same problem here (althrough through PaperUI). Using OpenHab 3.4. In MQTT Explorer it is listed correctly, in OpenHAB I get a NULL.

I created a config for a Thing to get the values from a Shelly Plus H&T and want to share it here in case somebody else has use to it.

UID: mqtt:topic:MqttBrokerMillipede:AmbientSensor1_Thing
label: AmbientSensor1 Thing
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:MqttBrokerMillipede
location: HereAndThere
channels:
  - id: Temperature
    channelTypeUID: mqtt:number
    label: Temperature
    description: ""
    configuration:
      stateTopic: HomeControl/Ambient1/status/temperature:0
      transformationPattern: JSONPATH:$.tC
      unit: °C
  - id: Humidity
    channelTypeUID: mqtt:number
    label: Humidity
    description: “”
    configuration:
      stateTopic: HomeControl/Ambient1/status/humidity:0
      transformationPattern: JSONPATH:$.rh
  - id: Battery_Level
    channelTypeUID: mqtt:number
    label: Battery Level
    description: “”
    configuration:
      stateTopic: HomeControl/Ambient1/status/devicepower:0
      transformationPattern: JSONPATH:$.battery.percent

You need to exchange the fixed part for your H&T HomeControl/Ambient1 and use your mqtt broker instead mine MqttBrokerMillipede

Once you have created the config be patient until the mqtt messages come out.
For debugging you can listen to the messages of your mqtt broker, you should see messages like this:

HomeControl/Ambient1/status/humidity:0 {"id": 0,"rh":67.4}
HomeControl/Ambient1/status/temperature:0

You can use for example mosquitto_sub for command line or MQTT-Explorer.
The messages are send out only on change depending on the thresholds you did setup in the device. I did set mine to 1 degree change for temperature and 2 percent for humidity.

During initial setup I was struggling when the device was powered with rechargeable Batteries, once I used USB Power instead I was able to join the device in my wifi and do the configuration.
Now it is running on normal batteries reliable.