Here’s an example of my Things file but most will recommend to set up your Thing via PaperUI and use files for items.
Thing:
Bridge mqtt:broker:pibroker "pibroker" [ host="10.0.1.34", port=1883, secure=false, username="openhab", password="xxxxxxx" ]
{
// Sonoffs
Thing topic sonoff11 "Living Room Light" @ "Living Room" {
Channels:
Type switch : power "Power" [ stateTopic="stat/sonoff11/POWER", commandTopic="cmnd/sonoff11/POWER" ]
Type number : temperature "Temperature" [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Temperature" ]
Type number : humidity "Humidity" [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Humidity" ]
}
Thing topic sonoff2 "Couch Light" @ "Couch Light" {
Channels:
Type switch : power "Power" [ stateTopic="stat/sonoff2/POWER", commandTopic="cmnd/sonoff2/POWER" ]
}
}
Items:
Switch LivingRoom_Light "Living Room Light" <light> ["Lighting"] { channel="mqtt:topic:pibroker:sonoff11:power" }
Number LivingRoom_Light_Temp "Temperature [%.1f °F]" <temp> { channel="mqtt:topic:pibroker:sonoff11:temperature" }
Number LivingRoom_Light_Humidity "Humidity [%.1f %%]" <humidity> { channel="mqtt:topic:pibroker:sonoff11:humidity" }
Switch CouchLight "Couch Light" <light> ["Lighting"] { channel="mqtt:topic:pibroker:sonoff2:power" }
Hope this helps.