Can't See Whty Automation Won't Work

Afternoon All,

I’ve got the following automation:

- alias: "Computer Control"
  id: '10000000000123'
  trigger:
    platform: state
    entity_id: input_boolean.pc_power_on
  action:
    service_template: >
        {% if is_state('input_boolean.pc_power_on', 'off') %}
          switch.turn_off
        {% else %}
          switch.turn_on
        {% endif %}
    entity_id: switch.computer
  action:
    service_template: >
        {% if is_state('input_boolean.pc_power_on', 'off') %}
          switch.turn_off
        {% else %}
          switch.turn_on
        {% endif %}
    entity_id: switch.plug_005a

50% Works

If I turn it off the plug turns on an off as desired. The switch.computer does not get called though…

If I call switch.computer manually it works fine. The bit that confuses me is the two actions are identical bar the switch name.

Remove the second action: and format it as a list of actions using “-”, like this:

- alias: "Computer Control"
  id: '10000000000123'
  trigger:
    platform: state
    entity_id: input_boolean.pc_power_on
  action:
    - service_template: >
        {% if is_state('input_boolean.pc_power_on', 'off') %}
          switch.turn_off
        {% else %}
          switch.turn_on
        {% endif %}
      entity_id: switch.computer
    - service_template: >
        {% if is_state('input_boolean.pc_power_on', 'off') %}
          switch.turn_off
        {% else %}
          switch.turn_on
        {% endif %}
      entity_id: switch.plug_005a
1 Like

Thank you.