Xiaomi Switch only showing long_press

My xiaomi switch is only showing the long press. not single click or double click.

Anyone know what i could be doing wrong?

Which xiaomi switch are you referring to? Wall switch, push button, aqara, …?
Did you connect it through the xiaomi gateway?

I’m also looking to fix this. I’m reffering to
https://www.gearbest.com/smart-light-bulb/pp_257679.html?wid=1433363

and

https://www.gearbest.com/living-appliances/pp_344667.html?wid=1101231

But on my side the whole xiaomi aquara system wont work properly.
I can only turn on the light of the gateway one time.
A second time, and it says key invalid.
Also the state History looks strange

When using the Xiaomi switches/gateway, you have to use the event and click platform, not state in your automations/scripts/etc as the state never actually changes.

I have the wireless switch and all events (single, double and long press) work fine, and each has a different automation associated to it.

- alias: "Bedroom Light Switch"
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d0001209892
      click_type: single
  action:
    service: switch.toggle
    data_template:
      entity_id: group.bedroom

- alias: "AirCon Toggle"
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d0001209892
      click_type: long_click_press
  action:
    service: switch.toggle
    entity_id: switch.living

- alias: "Toilet Break"
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d0001209892
      click_type: double
  action:
    - service: light.turn_on
      data:
        entity_id: light.bar
        brightness_pct: '35'
        transition: '3'
    - delay: 00:02:00
    - service: light.turn_off
      data:
        entity_id: light.bar
        transition: '3'

Nice - Helps me to set it up first, but my problem is that it dont work consistant.
the state of the lux sensor on the gateway represents it well.
First it works and soon its stopping.
just setted up the automation for click to toogle my nightstand light (always for testing :joy: )

i can click it for 2 minutes and its responding well,
…wait a little, and its doing nothing.

Or the light for the hub - Changing the colors works well, but god beware when i want to toogle it 2 times. instant Got error element in data {“error”:“Invalid key”}

a restart and i can use it for 5 minutes…

You need to change the event type to xiaomi_aqara.click, as you can see below from Hassio documentarion:

  • alias: Let a dog bark on long press
    trigger:
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
    entity_id: binary_sensor.switch_158d000xxxxxc2
    click_type: long_click_press
    action:
    service: xiaomi_aqara.play_ringtone
    data:
    gw_mac: xxxxxxxxxxxx
    ringtone_id: 8
    ringtone_vol: 8
1 Like

i have google these few days alreay
Thank you so much!!!