Hi,
for future reference here is the code:
Thing mqtt:topic:zigbee2mqtt:xiaomi:button:Xiaomi_Test "Zigbee - Button Test" (mqtt:broker:myMQTTBroker) {
Channels:
Type trigger : click "click" [ stateTopic = "zigbee2mqtt/Xiaomi_Button_Test/action" ]
}
@rlkoshak I have another question, because I do not find a solution, I use this code to get event name:
rule "Test Zigbee"
when
Channel 'mqtt:topic:zigbee2mqtt:xiaomi:button:Xiaomi_Test:click' triggered
then
var actionName = receivedEvent.getEvent()
logInfo("Zigbee.Xiaomi.Button.Test","Start -> Action Name: "+actionName)
end
I got error in the logs
Script execution of rule with UID 'xiaomiSwitch-1' failed: The name 'event' cannot be resolved to an item or type; line 17, column 19, length 5 in xiaomiSwitch
Is there a way to get event into the rule, without create one rule for each event?
Thanks