I am trying to figure out how to get the “action” from Zigbee2MQTT passed into an item in OpenHAB. I am able to read the battery level via MQTT, but I cannot figure out a way to get the “action” working. As I understand it, I will not be able to use a “switch”. I tried to use “string” without any luck.
This solved my problem. I am not able to create it in the GUI though.
Thing mqtt:topic:snzb01a "My Awesome Button" (mqtt:broker:e90f42a7f8) @ "Some Fancy Room" {
Channels:
Type string : action "Action" [ stateTopic="zigbee2mqtt/0x00124b0022697442", transformationPattern="REGEX:(.*action.*)∩JSONPATH:$.action"]
Type number : linkquality "Link Quality" [ stateTopic="zigbee2mqtt/0x00124b0022697442", transformationPattern="JSONPATH:$.linkquality"]
Type number : battery "Battery" [ stateTopic="zigbee2mqtt/0x00124b0022697442", transformationPattern="JSONPATH:$.battery"]
Type number : voltage "Voltage" [ stateTopic="zigbee2mqtt/0x00124b0022697442", transformationPattern="JSONPATH:$.voltage"]
}type or paste code here
Hi,
can also be done in the GUI.
In the channel configuration click on “Advanced” and enter your transformation into
" Incoming Value Transformation"
Joerg
Well, I have about 50 Devices included by MQTT via GUI. So it works and you seem to configure something wrong.
Anyway, if you can live with the text based configuration, just keep it that way.
You were right. I am very new to MQTT and the transformation stuff. I am slowly starting to understand it. I am doing my things configuration in the GUI now. Thanks.