Thanks a lot for your idea, it helped me to figure out how to make it work.
here is the code that I have done so far:
self.listen_event(self.button1_1click, entity_id="button.button1_identify")`
and the callback:
def button1_1click(self, event_name, data, kwargs):
self.log("event_name:"+str(event_name))
self.log("data:"+str(data))
and finally the answered I got for single click: ‘command’: ‘toggle’
event_name:zha_event
data:{'device_ieee': '00:12:4b:00:23:9f:3f:52', 'unique_id': '00:12:4b:00:23:9f:3f:52:1:0x0006', 'device_id': '59a6923c1340c95972a4f30c926d3f28', 'endpoint_id': 1, 'cluster_id': 6, 'command': 'toggle', 'args': [], 'params': {}, 'metadata': {'origin': 'LOCAL', 'time_fired': '2022-12-29T15:47:36.963588+00:00', 'context': {'id': '01GNF92HC3AT73JWWTGPV81X72', 'parent_id': None, 'user_id': None}}}
for a double click: ‘command’: ‘on’
event_name:zha_event
data:{'device_ieee': '00:12:4b:00:23:9f:3f:52', 'unique_id': '00:12:4b:00:23:9f:3f:52:1:0x0006', 'device_id': '59a6923c1340c95972a4f30c926d3f28', 'endpoint_id': 1, 'cluster_id': 6, 'command': 'on', 'args': [], 'params': {}, 'metadata': {'origin': 'LOCAL', 'time_fired': '2022-12-29T15:47:45.195107+00:00', 'context': {'id': '01GNF92SDBB48FVJDA9M5T4E3C', 'parent_id': None, 'user_id': None}}}
for a long press: ‘command’: ‘off’
event_name:zha_event
data:{'device_ieee': '00:12:4b:00:23:9f:3f:52', 'unique_id': '00:12:4b:00:23:9f:3f:52:1:0x0006', 'device_id': '59a6923c1340c95972a4f30c926d3f28', 'endpoint_id': 1, 'cluster_id': 6, 'command': 'off', 'args': [], 'params': {}, 'metadata': {'origin': 'LOCAL', 'time_fired': '2022-12-29T15:48:09.594903+00:00', 'context': {'id': '01GNF93H7TEFKG9BYJF3VS00DD', 'parent_id': None, 'user_id': None}}}
I don’t know if it helped but I also added a change in HA seen somewhere:
Going to “Developer tools/Events” and in the section “Listen to events” I added “zha_event”