How do you trigger complex automations from UI?

This is why I was asking you about this stuff. I went off your code, and based on your code this should work. So if the sensor itself is only momentary, then you’ll have to approach it slightly differently. However my second example will work every time because the sensor just selects the configuration and the state is provided by you or the trigger.

You’d just have to filter out sensor states that are blank.

automation:
- alias: Double-switch automation
  mode: parallel
  trigger:
  - platform: state
    entity_id:
    - sensor.living_room_wall_switch_action
  condition:
  - condition: template
    value_template: "{{ trigger.to_state.state not in ['unavailable', 'unknown', ''] }}"
  action:
  - service: script.my_over_complicated_setup
    data:
      sensor: "{{ trigger.entity_id }}"
      expected: "{{ trigger.to_state.state }}"
script:
  my_over_complicated_setup:
    mode: parallel
    fields:
      sensor:
        description: sensor being used
        example: sensor.living_room_wall_switch_action
      expected:
        description: expected state
        example: left
    variables:
      config:
        sensor.living_room_wall_switch_action: 
          left_light: light.living_room_tv_light
          right_light: light.living_room_table_light
          left: scene.living_room_only_tv_light
          right: scene.living_room_only_dining_light
          both: scene.living_room_only_full_light
          no_switches: scene.living_room_no_lights
       
      continue: >
        {{ config.get(sensor) is not None }}
      target_scene: >
        {{ config.get(sensor, {}).get(expected) }}
    sequence:
    - condition: template
      value_template: "{{ continue }}"
    - service: scene.turn_on
      target:
        entity_id: "{{ target_scene }}"
tap_action:
  action: call-service
  service: script.my_over_complicated_setup
  service_data:
    sensor: sensor.living_room_wall_switch_action
    expected: left

Also I think you’re confused as to what this is doing. config is a dictionary with entity_id’s mapped to a configuration. That is not getting the state. It’s getting the configuration from the config variable based on the entity_id name, not state. So that portion will still work.

I was referencing to the code below. If state is empty, target_scene won’t pick anything

EDIT: No, you’d change this:

      target_scene: >
        {{ config.get(sensor, {}).get(expected) }}

and in the automation…

  - service: script.my_over_complicated_setup
    data:
      sensor: "{{ trigger.entity_id }}"
      expected: "{{ trigger.to_state.state }}"