Example - cheat sheet
if you already have a broker setup / Mine is mqtt:broker:myMQTTBroker
Thing mqtt:topic:myMQTTBroker:Absorbar "Absorbar" (mqtt:broker:myMQTTBroker) @ "Kitchen"{
Channels:
Type switch : Power "Power" [ commandTopic="broadlink/absorbar/power", stateTopic="broadlink/absorbar/power", on="ON", off="OFF" ]
Type switch : Light "Light" [ commandTopic="broadlink/absorbar/light", stateTopic="broadlink/absorbar/light", on="ON", off="OFF" ]
Type string : Move "FAN Move" [ commandTopic="broadlink/absorbar/move" ]
Type switch : switch "Lights" [ commandTopic="zigbee2mqtt/living_room_lights/set", stateTopic="zigbee2mqtt/living_room_lights", transformationPattern="JSONPATH:$.state", formatBeforePublish="{\"state\":\"%s\"}", on="ON", off="OFF" ]
Type dimmer : dimmer "Dimmer" [ commandTopic="zigbee2mqtt/living_room_lights/set", stateTopic="zigbee2mqtt/living_room_lights", transformationPattern="JSONPATH:$.brightness", formatBeforePublish="{\"brightness\":%s}", min=0, max=255, step=1 ]
Type switch : secondswitch "Test 2Lights" [ commandTopic="zigbee2mqtt/living_room_lights/set", stateTopic="zigbee2mqtt/living_room_lights", transformationPattern="JSONPATH:$.state", formatBeforePublish="{\"state\":\"%s\"}", 1="ON", 0="OFF" ]
}
Absorbar "Absorbar"
Thing name and label
(mqtt:broker:myMQTTBroker)
Is the name of the mqtt broker you have setup`
@ "Kitchen"
Where it is, location
You can see 2 technologies used in mqtt channels here broadlink and what you are after.
Type switch : switch "Lights" [ commandTopic="zigbee2mqtt/living_room_lights/set", stateTopic="zigbee2mqtt/living_room_lights", transformationPattern="JSONPATH:$.state", formatBeforePublish="{\"state\":\"%s\"}", on="ON", off="OFF" ]
Need to install JSONPATH transformation
Type switch
is the same : switch
is the channel name and needs to be unique within the same thing "Lights"
is the label
// Item File
Switch Absorbar_light "Lights" {channel="mqtt:topic:myMQTTBroker:Absorbar:switch"}
So the channel mqtt:topic:myMQTTBroker:Absorbar:switch
Absorbar is thing switch
is the channel name