I configured a lot of things during the UI, but I was not to happy with the handling, so recently, I started to set up new things as file (Z2M and other MQTT stuff like shellies, esp8266 etc.).
Here an example from a thing file containing things and channels from Z2M:
Bridge mqtt:broker:mosquitto [ host="localhost", secure=false] {
Thing topic aqaravibrationsensor1 "Aqara Vibration Sensor 1" @ "Büro" {
Channels:
Type number : angle_y [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_1", transformationPattern="JSONPATH:$.angle_y"]
Type number : battery [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_1", transformationPattern="JSONPATH:$.battery"]
}
Thing topic aqaravibrationsensor2 "Aqara Vibration Sensor 2" @ "Büro" {
Channels:
Type number : angle_y [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_2", transformationPattern="JSONPATH:$.angle_y"]
Type number : battery [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_2", transformationPattern="JSONPATH:$.battery"]
}
Thing topic aqaravibrationsensor3 "Aqara Vibration Sensor 3" @ "Badezimmer" {
Channels:
Type number : angle_y [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_3", transformationPattern="JSONPATH:$.angle_y"]
Type number : battery [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_3", transformationPattern="JSONPATH:$.battery"]
}
Thing topic aqaravibrationsensor4 "Aqara Vibration Sensor 4" @ "Treppe" {
Channels:
Type number : angle_y [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_4", transformationPattern="JSONPATH:$.angle_y"]
Type number : battery [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_4", transformationPattern="JSONPATH:$.battery"]
}
Thing topic aqaravibrationsensor5 "Aqara Vibration Sensor 5" @ "Schlafzimmer" {
Channels:
Type number : angle_y [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_5", transformationPattern="JSONPATH:$.angle_y"]
Type number : battery [stateTopic="zigbee2mqtt/Aqara_Vibration_Sensor_5", transformationPattern="JSONPATH:$.battery"]
}
Thing topic oeeoneE27lamp "Smart Bulb Leselamope" @ "Wohnzimmer" {
Channels:
Type switch : power [ stateTopic="zigbee2mqtt/oeeone_e27_1", commandTopic="zigbee2mqtt/oeeone_e27_1/set", on="ON", off="OFF" ]
Type dimmer : brightness [ stateTopic="zigbee2mqtt/oeeone_e27_1", commandTopic="zigbee2mqtt/oeeone_e27_1/set", transformationPattern="JS:getZigbeeBrightness.js", transformationPatternOut="JS:setZigbeeBrightness.js" ]
Type number : color_temp [ stateTopic="zigbee2mqtt/oeeone_e27_1", commandTopic="zigbee2mqtt/oeeone_e27_1/set", transformationPattern="JS:getZigbeeWhiteTemp.js", transformationPatternOut="JS:setZigbeeWhiteTemp.js" ]
}
Thing topic tuyasmartbulb01 "Tuya Smart Bulb" @ "Wohnzimmer" {
Channels:
Type switch : power "Power" [ stateTopic="zigbee2mqtt/0xa4c138a22a91ab3f/state", commandTopic="zigbee2mqtt/0xa4c138a22a91ab3f/set/state", on="ON", off="OFF" ]
Type dimmer : brightness "Brightness" [ stateTopic="zigbee2mqtt/0xa4c138a22a91ab3f/brightness", commandTopic="zigbee2mqtt/0xa4c138a22a91ab3f/set/brightness", min=0, max=255 ]
Type color : color "Color" [ stateTopic="zigbee2mqtt/0xa4c138a22a91ab3f/color", commandTopic="zigbee2mqtt/0xa4c138a22a91ab3f/set/color" ]
Type number : colorTemp "Color Temperature" [ stateTopic="zigbee2mqtt/0xa4c138a22a91ab3f/color_temp", commandTopic="zigbee2mqtt/0xa4c138a22a91ab3f/set/color_temp", min=153, max=500 ]
}
Thing topic tuerkontaktOG "Türkontakt OG" @ "Obergeschoss" {
Channels:
Type contact : contact [ stateTopic="zigbee2mqtt/0x00158d0009e7c88d", transformationPattern="JS:contactState.js" ]
Type number : battery [ stateTopic="zigbee2mqtt/0x00158d0009e7c88d", transformationPattern="JSONPATH:$.battery" ]
}
Thing topic tuerkontaktEG "Türkontakt EG" @ "Erdgeschoss" {
Channels:
Type contact : contact [ stateTopic="zigbee2mqtt/0x00158d0009e7ac01", transformationPattern="JS:contactState.js" ]
Type number : battery [ stateTopic="zigbee2mqtt/0x00158d0009e7ac01", transformationPattern="JSONPATH:$.battery" ]
}
Thing topic tuerkontaktEingangstuer "Türkontakt Eingangstür" @ "Eingang" {
Channels:
Type contact : contact [ stateTopic="zigbee2mqtt/0x00158d000201e28a", transformationPattern="JS:contactState.js" ]
Type number : battery [ stateTopic="zigbee2mqtt/0x00158d000201e28a", transformationPattern="JSONPATH:$.battery" ]
}
Thing topic zigbeeRemoteDachfenster "Zigbee Fernbedienung Dachfenster Treppe" @ "Treppe" {
Channels:
Type string : action [ stateTopic="zigbee2mqtt/0xbc33acfffed699f9", transformationPattern="JSONPATH:$.action" ]
Type number : battery [ stateTopic="zigbee2mqtt/0xbc33acfffed699f9", transformationPattern="JSONPATH:$.battery" ]
}
}
Please consider that you might have to use transformation patterns to connect OH items with the numbers delivered by MQTT (e. g. see brightness and color_temp channels in light bulb).