I’m moving to MQTT 2.x binding. I have a couple of devices connected to zigbee2mqtt CC2531. For most parts it seems to work.
My Thing definition MQTT.things
Bridge mqtt:broker:mosquitto "Mosquitto" [ host="localhost", port=1883, secure=false, username="USERNAME", password="PASSWORD", clientID="openHAB2" ]
{
// zigbee2mqtt
Thing topic Xiaomi_Power_Socket_01 "Xiaomi Power Socket 01" @ "Study" {
Type switch : power "Power" [ stateTopic="zigbee2mqtt/Xiaomi_Power_Plug_01/get/state", commandTopic="zigbee2mqtt/Xiaomi_Power_Plug_01/get/state" ]
}
Thing topic Ikea_Remote_01 "Ikea Remote 01" @ "Study" {
Type string : Pressed "Pressed" [ stateTopic="zigbee2mqtt/Ikea_Remote_01", transformationPattern="JSONPATH:$.action" ]
}
MQTT.items
String Ikea_Remote_01_Pressed "Pressed" { channel="mqtt:topic:mosquitto:Ikea_Remote_01:Pressed" }
Switch Xiaomi_Power_Socket_01_Power "Power" { channel="mqtt:topic:mosquitto:Xiaomi_Power_Socket_01:power" }
My rules file, that I’m facing problems with… MQTT.rules
rule "Ikea Remote 1"
when
Channel "mqtt:topic:mosquitto:Ikea_Remote_01:Pressed" triggered
then
val mqttActions = getActions("mqtt", "mqtt:broker:mosquitto")
mqttActions.publishMQTT("zigbee2mqtt/Xiaomi_Power_Socket_01/set/state", "ON")
end
“rules” is the only thing stopping from me moving to MQTT 2.x. Any help will be appreciated.