Automation with 2 triggers

Hello sir! Sorry to bother you, but could you take a look at this?

  action:
    - service_template: >
        {% if trigger.event.data.click_type == 'single' %}
          script.botao_xiaomi_banheiro_suite_click_1
        {% elif trigger.event.data.click_type == 'double' %}
          script.botao_xiaomi_banheiro_suite_click_2
        {% elif trigger.event.data.click_type == 'long_click_press' %}
          {% if is_state('switch.chuveirosuite' , 'off') %}
            script.botao_xiaomi_banheiro_suite_click_3
          {% else %}
            homeassistant.turn_off
          {% endif %}
        {% endif %}
      data_template:
        entity_id: >
          {% if is_state('switch.chuveirosuite' , 'on') %}
            - switch.chuveirosuite
            - script.botao_xiaomi_banheiro_suite_click_3
          {% endif %}

I get this error:

Unable to find service - switch/turn_off

Any idea why this is happening?

I am using this automation for one of my Xiaomi wireless buttons.

The script is stop but the switch does not goes off…

Thanks a lot!

Off the top of my head, there’s something else wrong with the system there, because… if you have a switch domain, the system should definitely have a switch/turn_off service.

That’s about as much as I can offer right now, but I’ll come back to this thread if nobody else can think of anything in the meantime.

1 Like

The “condition: and” isn’t needed. If you list several conditions, they’re all “and”.
Likewise, if the trigger section has several, it’s like an “OR” option.
And while you can’t have an ‘AND’ trigger list, you can have an “OR” condition list, with the above syntax.
The “condition: and” statement now sees its use when nesting conditions, both OR and AND…

Example of the “OR” condition amongst default “AND” list :

   condition:
    - condition: template
      value_template: "{{ (states.sensor.temperature_maison.state | float) >= ((states.input_number.consigne_bas.state | float) + 0.5) }}"
    - condition: or
      conditions:
      - condition: time
        after: '23:00:00'
        before: '06:30:00'
      - condition: state
        entity_id: binary_sensor.somebody_home
        state: 'off'

This is the condition to turn off the central heating at home when the temperature is above the “eco/night” level: temperature AND (night OR nobody home)

I don’t have a sample of OR with nested AND conditions.