Issue with Xiaomi aqara double switch wireless and automation

Hi, i am running the latest version off hassio-Hassio 0.60.0
and my aqara wall double switch doesn’t seem to work properly with hassio.
I have setuped automation and when i use it on the state panel they trigger perfectly.
But when i click on my switch wether left or right hass try to run both of the automation at the same time.
Even if i activate only the left automation i can use the right button and the automation will be performed.
Anyone have an idea on this issue?
I am using mi home 5.0.19
Thanks in advance for your help

Can you share your automations?

Of course, thanks for your help

- id: bed_nico_on
  alias: Switch nico on
  trigger:
    platform: event
    event_type: click
    event_data:
      event_id: binary_sensor.wall_switch_left_158XXXXXXXXX
      click_type: single
  condition:
    - condition: state
      entity_id: group.bedroom_lights
      state: 'off'
  action:
    - service: homeassistant.turn_on
      entity_id: group.bedroom_lights
- id: bed_nico_off
  alias: Switch nico off
  trigger:
    platform: event
    event_type: click
    event_data:
      event_id: binary_sensor.wall_switch_left_158XXXXXXXXX
      click_type: single
  condition:
    - condition: state
      entity_id: group.bedroom_lights
      state: 'on'
  action:
    - service: homeassistant.turn_off
      entity_id: group.bedroom_lights
- id: lustre_nico
  alias: Toggle lustre nico
  trigger:
    platform: event
    event_type: click
    event_data:
      event_id: binary_sensor.wall_switch_right_158XXXXXXXXX
      click_type: single
  action:
    - service: switch.toggle
      entity_id: switch.wall_switch_158XXXXXXXXX

So if i activate only the automation for the right or left switch both buttons does the same action, and if i activate all automations both buttons does the two automations at the same time.
Yesterday i configured it in mi home app and deactivate all in hassio and it works in the app (i can do two separate behavior for each button) so i guess there is a problem associating the good click with the automation.

I suspect the action

  action:
    - service: switch.toggle
      entity_id: switch.wall_switch_158XXXXXXXXX

To send a click event to hass. Is the wall switch used in lustre_nico the same as the one used in the 2 other automation trigger?

No sorry, it’s not the same, it is not a wireless switch, and i can disable this automation and both button will do the other automations

Maybe check in HASS log to see which trigger or which event is receive when you press one or the other button.

Here is the log and i can’t see what is the problem but we can clearly see that both button triggers the same automation

017-12-21 22:47:02 DEBUG (Thread-2) [PyXiaomiGateway] MCAST (report) << {'cmd': 'report', 'model': '86sw2', 'sid': '158d0001XXXXXX', 'short_id': 53861, 'data': '{"channel_0":"click"}'}
2017-12-21 22:47:02 DEBUG (SyncWorker_7) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch (Left)_158d0001XXXXXX: off>: {'channel_0': 'click'}
2017-12-21 22:47:02 DEBUG (SyncWorker_7) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch (Right)_158d0001XXXXXX: off>: {'channel_0': 'click'}
2017-12-21 22:47:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event click[L]: entity_id=binary_sensor.wall_switch_left_158d0001XXXXXX, click_type=single>
2017-12-21 22:47:02 DEBUG (SyncWorker_7) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch (Both)_158d0001XXXXXX: off>: {'channel_0': 'click'}
2017-12-21 22:47:02 INFO (MainThread) [homeassistant.components.automation] Executing Switch nico off
2017-12-21 22:47:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Switch nico off, message=has been triggered, domain=automation, entity_id=automation.switch_nico_off>
2017-12-21 22:47:02 INFO (MainThread) [homeassistant.helpers.script] Script Switch nico off: Running script
2017-12-21 22:47:02 INFO (MainThread) [homeassistant.helpers.script] Script Switch nico off: Executing step call service
2017-12-21 22:47:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homeassistant, service=turn_off, service_data=entity_id=['group.bedroom_lights'], service_call_id=1965835600-97>
2017-12-21 22:47:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_off, service_data=entity_id=['light.ampoule_chambre', 'light.bande_led_lit', 'light.lampe_chevet'], service_call_id=1965835600-98>

2017-12-21 22:47:14 DEBUG (Thread-2) [PyXiaomiGateway] MCAST (report) << {'cmd': 'report', 'model': '86sw2', 'sid': '158d0001XXXXXX', 'short_id': 53861, 'data': '{"channel_1":"click"}'}
2017-12-21 22:47:14 DEBUG (SyncWorker_5) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch (Left)_158d0001XXXXXX: off>: {'channel_1': 'click'}
2017-12-21 22:47:14 DEBUG (SyncWorker_5) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch (Right)_158d0001XXXXXX: off>: {'channel_1': 'click'}
2017-12-21 22:47:14 DEBUG (SyncWorker_5) [homeassistant.components.xiaomi_aqara] PUSH >> <Entity Wall Switch (Both)_158d0001XXXXXX: off>: {'channel_1': 'click'}
2017-12-21 22:47:14 INFO (MainThread) [homeassistant.core] Bus:Handling <Event click[L]: entity_id=binary_sensor.wall_switch_right_158d0001XXXXXX, click_type=single>
2017-12-21 22:47:14 INFO (MainThread) [homeassistant.components.automation] Executing Switch nico on
2017-12-21 22:47:14 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Switch nico on, message=has been triggered, domain=automation, entity_id=automation.switch_nico_on>
2017-12-21 22:47:14 INFO (MainThread) [homeassistant.helpers.script] Script Switch nico on: Running script
2017-12-21 22:47:14 INFO (MainThread) [homeassistant.helpers.script] Script Switch nico on: Executing step call service
2017-12-21 22:47:14 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=homeassistant, service=turn_on, service_data=entity_id=['group.bedroom_lights'], service_call_id=1965835600-99>
2017-12-21 22:47:14 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=['light.ampoule_chambre', 'light.bande_led_lit', 'light.lampe_chevet'], service_call_id=1965835600-100>

Any ideas?

I see that each button execute a different script:

Bus:Handling <Event click[L]: entity_id=binary_sensor.wall_switch_left_158d0001XXXXXX
-> Executing Switch nico off

Bus:Handling <Event click[L]: entity_id=binary_sensor.wall_switch_right_158d0001XXXXXX
-> Executing Switch nico on

Why the wrong script are executed is a mystery for me too…

Yes, in the logs different scripts are executed because of the condition (on/off) but they are both executed by each button and not only the left button as described in my automation…
Thanks again for your help, i hope someone will be able to unravel this mystery.

FYI the problem is resolved, the issue was with

event_data:
      event_id: binary_sensor.wall_switch_left_158XXXXXXXXX

that needed to be change to

event_data:
      entity_id: binary_sensor.wall_switch_left_158XXXXXXXXX