Is there a better way to write this automation for toggling and dimming lights?

Hi all.
I’m using this zigbee switch/dimmer IKEA E1743 control via MQTT | Zigbee2MQTT on a Z2M lightbulb.

I tried using templates and variables, but I couldn’t figure out how to get the variables and pass them on as a condition for the options to choose from.

I used a rather simple “trigger by” step to determine which action to perform, but I’m sure there’s a better, more generic way to write this.

alias: testing ikea switch for bedroom light
description: ""
trigger:
  - platform: device
    domain: mqtt
    device_id: 3c12f740ef0586e82920a439b1083175
    type: action
    subtype: "off"
    discovery_id: 0x705464fffe59c095 action_off
    id: "off"
  - platform: device
    domain: mqtt
    device_id: 3c12f740ef0586e82920a439b1083175
    type: action
    subtype: "on"
    discovery_id: 0x705464fffe59c095 action_on
    id: "on"
  - platform: device
    domain: mqtt
    device_id: 3c12f740ef0586e82920a439b1083175
    type: action
    subtype: brightness_move_up
    discovery_id: 0x705464fffe59c095 action_brightness_move_up
    id: brightness_up
  - platform: device
    domain: mqtt
    device_id: 3c12f740ef0586e82920a439b1083175
    type: action
    subtype: brightness_move_down
    discovery_id: 0x705464fffe59c095 action_brightness_move_down
    id: brightness_down
  - platform: device
    domain: mqtt
    device_id: 3c12f740ef0586e82920a439b1083175
    type: action
    subtype: brightness_stop
    discovery_id: 0x705464fffe59c095 action_brightness_stop
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "off"
        sequence:
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.0xa4c13820c8f952c4
      - conditions:
          - condition: trigger
            id:
              - "on"
        sequence:
          - service: light.turn_on
            data:
              kelvin: 2300
              brightness: 255
            target:
              entity_id: light.0xa4c13820c8f952c4
      - conditions:
          - condition: trigger
            id:
              - brightness_down
        sequence:
          - service: light.turn_on
            data:
              kelvin: 2300
              brightness_step: -27
            target:
              entity_id: light.0xa4c13820c8f952c4
      - conditions:
          - condition: trigger
            id:
              - brightness_up
        sequence:
          - service: light.turn_on
            data:
              kelvin: 2300
              brightness_step: 27
            target:
              entity_id: light.0xa4c13820c8f952c4
mode: single