Hello and thank you for your quick reply.
So yes, I have a Zigbee Xiaomi WXKG01LM button that I joined to mosquitto via zigbee2Mqtt and it works, I get a message in the
zigbee / xiaomi topic
{"action": "value", "battery": 98, "linkquality": 98, "voltage": 2997}
Action value takes the prescription of pressing the value: single, double, triple, quadruple, many, hold and release,
this data is displayed in the text control using extract from JSON $ .action,
it causes the string to be changed to action: value.
now I want to redirect the appropriate action after receiving a certain value value so that when
I receive a single post the appropriate message in the zigbee / switch / set topic
for example:
I press the xiaomi button, I receive action = single and through On Receive I publish the controls in
/ zigbee / switch / set {"state_l1": "ON"}
= double publish / zigbee / switch / set {"state_l2": "ON"}
= triple
I publish / zigbee / switch / set {"state_l1": "ON", "state_l2": "ON"}
= quadruple
i publish
/ zigbee / switch / set {"state_l1": "OFF"}
and so on ... for mana, release
it works fine when the message single, double and td comes in when I have
ON RECEIVE written in
app.publish ('zigbee / switch / set', '{"state_l1": "ON"}', false, 0);
but any attempts with if to check the value that came to the text control with action fail
if I knew what variable is responsible
for displaying the value from $ .action in the text field it might be possible to use
IF (xxxx == single)
app. publisch
or Switch Case e.g .:
Switch"variable"
case single
app.publish ......
break
case double
app.publish .....
break
.....
and so on
I don't know java script very well
I hope I have described it clearly.
Thank you for your help