Simplifying Xiaomi Aqara Button Automation

Hey everyone! I’m trying to streamline my home automation setup by creating a single automation for all functions of my Xiaomi Aqara Wireless Button Generation 1. This would make managing automations much easier, especially since I have 10 buttons, each requiring 3 different automations.

I attempted to set this up using a script triggered by the click type event, but it didn’t work as expected. Here’s the configuration I used:

yaml
alias: Xiaomi Button Automation
trigger:

  • platform: event
    event_type: click
    event_data:
    entity_id: binary_sensor.switch_158d000120ea75
    click_type: [single, double, long_click_press]
    action:
  • service_template: >
    {% if trigger.event.click_type == ‘single’ %}
    script.botao_xiaomi_quarto_click_1
    {% elif trigger.event.click_type == ‘double’ %}
    script.botao_xiaomi_quarto_click_2
    {% elif trigger.event.click_type == ‘long_click_press’ %}
    script.botao_xiaomi_quarto_click_3
    {% endif %}

Despite this setup, the automation isn’t functioning as intended. I’m wondering if there’s a different approach or if I’m missing something in the configuration. Any insights or suggestions would be greatly appreciated! :pray: