Create multiple identical items with variables

  • Platform information:
    • Hardware: QNAP NAS with Intel Celeron
    • OS: QTS 4.4.1
    • Java Runtime Environment: 8
    • openHAB version: 2.5.3

Hey there,

I have 8 identical Plugs (Gosund SP) flashed with Tasmota Firmware and managed to get them running with Openhab finally.

Thing:

Thing mqtt:topic:tasmotaswitch "Tasmota Switch" (mqtt:broker:localhostbroker) {
	Channels:
	//LWT:
	Type string : reachable "Reachable" [stateTopic="SmartHome/Plugs/plug01/tele/LWT"]

	//POWER:
	Type switch : power "Power" [stateTopic="SmartHome/Plugs/plug01/stat/POWER", commandTopic="SmartHome/Plugs/plug01/cmnd/POWER"]
}

Item:

String tasmota_reachable "Reachable: [%s]" {channel="mqtt:topic:tasmotaswitch:reachable"}
Switch tasmota_power "Power" {channel="mqtt:topic:tasmotaswitch:power"}

For me it looks inelegant to get 8 copys of alle the item entrys and things. Is it possible to change the MQTT Topic with a variable (plug01, plug02, …)?

Thanks for your opinions and hints in advance!

No.

2 Likes