Ok, I understand now. Binary_sensors are wireless switches. I have another wired switch and appears as switch.interruptor_entrada. Unfortunately I haven’t created any automation for it yet.
Anyway, try to use the same order in the “trigger” part as I used. I don’t remember where I read that the “platform: event” line should be the first one.
I’ve tried to create an automation with this wired switch, but it only supports one event (“click”) and is associated to some light I cannot change (my wife would kill me). If this does not work for you I could try to test it when I’m alone at home…
Edit: Did you test with “click” instead of “xiaomi_aqara.click”? When I created the automation I copied it from someone else’s and they were using “click”. Perhaps they had wired switches instead of wireless ones
I know it should work the same, but try to put the “platform” line first in the “trigger”. I read somewhere there was a problem with that.
Tomorrow I will install two new wired switches, one double and another one single. I didn’t plan to use them in HA automations, because they are wired to lights, but anyway I’ll try to create one automation just to see if it works.
I’m sorry, but I couldn’t install the wired switches. Two of them together are much bigger than two standard switches
About your automation, I can’t see anything strange, so I would start looking for things like wrong indentations or something like that. By the way, in my automations I don’t have the “- data” line, only entity_id and service.
I suppose everything works in Mi Home app, isn’t it?
Ps. You can try loggin to see what’s happening. Just add this to your configuration.yaml:
This should show you events coming from the Xiaomi Gateway
Yesterday I had some time and tried to make one of my wired switches work with HA. I couldn’t detect a click in any way.
I tried converting the switch to wireless switch. Activating it from HA still makes it work as a wired switch, even when pushing it physically does something else. And I could not find anything in logs, even when activating debugging for xiaomi_aqara or “switch” component. “xiaomi_aqara.click” or “click” didn’t work in the automations.
Going back to wired switch configuration didn’t solve anything, it was impossible to detect any click nor make it work in automations.
I even tried to detect a state change (from off to on or on to off), but it didn’t work either. It seems there is something wrong in this component or that wired switches (even in wireless configuration) don’t send any state or event to HA. They do send it to Xiaomi Gateway, because I can create automations in Mi Home, but HA doesn’t seem to receive anything.
Ps. It seems that the only way to make Aqara wired switches work with HA would be without the Xiaomi-Aqara gateway, using a different Zigbee controller, which I don’t have