A thing definition is pretty straightforward once you’ve done it a few times.
Here’s part of my Sonoff Tasmota setup for the 2.4 MQTT binding:
// MQTT
Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", port=1883, secure=false, username="", password="", clientID="openHab2" ] {
// Switches
Thing topic sonoff_s26_0 "Sonoff S26-0" @ "Loungeroom" {
Channels:
Type switch : power "Power" [stateTopic="sonoff/s26_0/stat/POWER", commandTopic="sonoff/s26_0/cmnd/POWER"]
Type number : rssi "WiFi Signal Strength" [stateTopic="sonoff/s26_0/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
Type string : reachable "Reachable" [stateTopic="sonoff/s26_0/tele/LWT"]
}
Thing topic sonoff_s26_1 "Sonoff S26-1" @ "Bedroom" {
Channels:
Type switch : power "Power" [stateTopic="sonoff/s26_1/stat/POWER", commandTopic="sonoff/s26_1/cmnd/POWER"]
Type number : rssi "WiFi Signal Strength" [stateTopic="sonoff/s26_1/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
Type string : reachable "Reachable" [stateTopic="sonoff/s26_1/tele/LWT"]
}
Thing topic sonoff_s26_2 "Sonoff S26-2" @ "Unused" {
Channels:
Type switch : power "Power" [stateTopic="sonoff/s26_2/stat/POWER", commandTopic="sonoff/s26_2/cmnd/POWER"]
Type number : rssi "WiFi Signal Strength" [stateTopic="sonoff/s26_2/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
Type string : reachable "Reachable" [stateTopic="sonoff/s26_2/tele/LWT"]
}
// more S26's then some POWs:
Thing topic sonoff_pow2_0 "Sonoff POW2-0" @ "Bedroom" {
Channels:
Type switch : power "Power" [stateTopic="sonoff/pow2_0/stat/POWER", commandTopic="sonoff/pow2_0/cmnd/POWER"]
Type number : rssi "WiFi Signal Strength" [stateTopic="sonoff/pow2_0/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
Type string : reachable "Reachable" [stateTopic="sonoff/pow2_0/tele/LWT"]
Type number : voltage "Line Voltage" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
Type number : powerload "Power Load" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
Type number : app_power "Apparent Power" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ApparentPower"]
Type number : current "Line Current" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
Type number : vcc "VCC" [stateTopic="sonoff/pow2_0/tele/STATE", transformationPattern="JSONPATH:$.Vcc"]
Type number : today "Energy Used Today" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
Type number : yesterday "Energy Used Yesterday" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
Type number : total "Total Energy Used" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total"]
Type string : uptime "Uptime" [stateTopic="sonoff/pow2_0/tele/STATE", transformationPattern="JSONPATH:$.Uptime"]
Type number : react_pwr "Reactive Power" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ReactivePower"]
Type number : period "Energy Period" [stateTopic="sonoff/pow2_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Period"]
}
Thing topic sonoff_pow_0 "Sonoff POW-0" @ "Bedroom" {
Channels:
Type switch : power "Power" [stateTopic="sonoff/pow_0/stat/POWER", commandTopic="sonoff/pow_0/cmnd/POWER"]
Type number : rssi "WiFi Signal Strength" [stateTopic="sonoff/pow_0/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI"]
Type string : reachable "Reachable" [stateTopic="sonoff/pow_0/tele/LWT"]
Type number : voltage "Line Voltage" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
Type number : powerload "Power Load" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
Type number : app_power "Apparent Power" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ApparentPower"]
Type number : current "Line Current" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
Type number : vcc "VCC" [stateTopic="sonoff/pow_0/tele/STATE", transformationPattern="JSONPATH:$.Vcc"]
Type number : today "Energy Used Today" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
Type number : yesterday "Energy Used Yesterday" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
Type number : total "Total Energy Used" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total"]
Type string : uptime "Uptime" [stateTopic="sonoff/pow_0/tele/STATE", transformationPattern="JSONPATH:$.Uptime"]
Type number : react_pwr "Reactive Power" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ReactivePower"]
Type number : period "Energy Period" [stateTopic="sonoff/pow_0/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Period"]
}
}
// More POW's but you should get the idea.
Item defs:
// Switches
Switch sonoff_s26_0 "Fuji Colour Laser [%s]" <laser_printer_32> (Lounge,Switches) ["Switchable"] {channel="mqtt:topic:mosquitto:sonoff_s26_0:power"}
Number sonoff_s26_0_RSSI "Fuji Colour Laser WiFi Signal [JS(sonoffRSSI.js):%s]" <signal> (Lounge,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_0:rssi"}
String sonoff_s26_0_Reachable "Fuji Colour Laser Online Status [%s]" <network> (Lounge,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_0:reachable"}
Switch sonoff_s26_1 "Bedside Plug [%s]" <socket2> (Bedroom,Switches) ["Switchable"] {channel="mqtt:topic:mosquitto:sonoff_s26_1:power"}
Number sonoff_s26_1_RSSI "Bedside Plug WiFi Signal [JS(sonoffRSSI.js):%s]" <signal> (Bedroom,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_1:rssi"}
String sonoff_s26_1_Reachable "Bedside Plug Online Status [%s]" <network> (Bedroom,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_1:reachable"}
Switch sonoff_s26_2 "Google Home Mini Switch [%s]" <poweroutlet_au> (Bedroom,Switches) ["Switchable"] {channel="mqtt:topic:mosquitto:sonoff_s26_2:power"}
Number sonoff_s26_2_RSSI "Google Home Mini WiFi Signal [JS(sonoffRSSI.js):%s]" <signal> (Bedroom,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_2:rssi"}
String sonoff_s26_2_Reachable "Google Home Mini Online Status [%s]" <network> (Bedroom,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_2:reachable"}
Switch sonoff_s26_3 "Echo Dot 3rd Gen Switch [%s]" <poweroutlet_au> (Home,Switches) ["Switchable"] {channel="mqtt:topic:mosquitto:sonoff_s26_3:power"}
Number sonoff_s26_3_RSSI "Echo Dot 3rd Gen - WiFi Signal [JS(sonoffRSSI.js):%s]" <signal> (Home,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_3:rssi"}
String sonoff_s26_3_Reachable "Echo Dot 3rd Gen - Online Status [%s]" <network> (Home,wSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_s26_3:reachable"}
// ....... more stuff
Switch sonoff_pow2_0 "3D Printer [%s]" <3dprinter_32> (Bedroom,Switches) ["Switchable"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:power"}
Number sonoff_pow2_0_RSSI "3D Printer WiFi Signal [JS(sonoffRSSI.js):%s]" <signal> (Bedroom,wSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:rssi"}
String sonoff_pow2_0_Reachable "3D Printer Online Status [%s]" <network> (Bedroom,wSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:reachable"}
Number sonoff_pow2_0_Voltage "3D Printer Line Voltage [%.1f V]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:voltage"}
Number sonoff_pow2_0_Load "3D Printer Powerload [%.1f W]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:powerload"}
Number sonoff_pow2_0_AppPower "3D Printer Apperent Power [%.1f W]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:app_power"}
Number sonoff_pow2_0_Current "3D Printer Line Current [%.3f A]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:current"}
Number sonoff_pow2_0_VCC "3D Printer VCC [%.3f VDC]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:vcc"}
Number sonoff_pow2_0_Today "3D Printer Energy Today [%.3f kWh]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:today"}
Number sonoff_pow2_0_Yesterday "3D Printer Energy Yesterday [%.3f kWh]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:yesterday"}
Number sonoff_pow2_0_Total "3D Printer Total Energy Used [%.3f kWh]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:total"}
String sonoff_pow2_0_Uptime "3D Printer Uptime [JS(sonoffUp.js):%s]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:uptime"}
Number sonoff_pow2_0_Period "3D Printer Energy Period [%d Day(s)]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:period"}
Number sonoff_pow2_0_ReactPower "3D Printer Reactive Power [%.1f W]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow2_0:react_pwr"}
Switch sonoff_pow_0 "UPS [%s]" <ups_2_32> (Bedroom,Switches) ["Switchable"] {channel="m
qtt:topic:mosquitto:sonoff_pow_0:power"}
Number sonoff_pow_0_RSSI "UPS WiFi Signal [JS(sonoffRSSI.js):%s]" <signal> (Bedroom,wSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow_0:rssi"}
String sonoff_pow_0_Reachable "UPS Online Status [%s]" <network> (Bedroom,wSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow_0:reachable"}
Number sonoff_pow_0_Voltage "UPS Line Voltage [%.1f V]" <energy> (Bedroom,pSwitches) ["Data"] {channel="m
qtt:topic:mosquitto:sonoff_pow_0:voltage"}
Number sonoff_pow_0_Load "UPS Powerload [%.1f W]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:powerload"}
Number sonoff_pow_0_AppPower "UPS Apperent https://github.com/arendst/Sonoff-Tasmota/wiki/Sonoff-Pow-and-Pow-R2Power [%.1f W]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:app_power"}
Number sonoff_pow_0_Current "UPS Line Current [%.3f A]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:current"}
Number sonoff_pow_0_VCC "UPS VCC [%.3f VDC]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:vcc"}
Number sonoff_pow_0_Today "UPS Energy Today [%.3f kWh]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:today"}
Number sonoff_pow_0_Yesterday "UPS Energy Yesterday [%.3f kWh]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:yesterday"}
Number sonoff_pow_0_Total "UPS Total Energy Used [%.3f kWh]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:total"}
String sonoff_pow_0_Uptime "UPS Uptime [JS(sonoffUp.js):%s]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:uptime"}
Number sonoff_pow_0_Period "UPS Energy Period [%d Day(s)]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:period"}
Number sonoff_pow_0_ReactPower "UPS Reactive Power [%.1f W]" <energy> (Bedroom,pSwitches) ["Data"] {channel="mqtt:topic:mosquitto:sonoff_pow_0:react_pwr"}
You didn’t mention if you used Tasmota or the stock firmware, if you go with the Tasmota you won’t regret it, you can confire the POW’s MQTT to the nth degree that way. Check this out:
If you want sitemap stuff just let me know, mine’s pretty involved.