I've a smart home setup made of couple of zigbee compatible devices, and hub made up of CC2531 USB stick flashed for zigbee connected to a raspberry pi with homeassistant and zigbee2mqtt services.

I want to connect the IKEA TRADFRI 5 button switch and IKEA TRADFRI led driver.

So I've paired this two devices with my home assistant setup.

So now the zigbe2mqtt config file looks like following:

/opt/zigbee2mqtt/data/configuration.yaml
homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost'
serial:
  port: /dev/ttyACM0
devices:
  '0x14b457fffe6c524a':
    friendly_name: ikea_pad_1
    retain: false
  '0x000d6ffffe8e361d':
    friendly_name: ikea_led_driver_1
    retain: false

Now since this devices get discovered by homeassistant we can add an automations for them.

~/.homeassistant/automations.yaml
- id: 'ikea_led_driver1_toggle'
  trigger:
  - platform: mqtt
    topic: zigbee2mqtt/ikea_pad_1
  condition:
    condition: template
    value_template: '{{trigger.payload_json.action == "toggle" }}'
  action:
  - alias: ''
    data:
      entity_id: light.ikea_led_driver_1_light
    service: light.toggle

- id: 'ikea_led_driver1_dim_up'
  trigger:
    platform: mqtt
    topic: zigbee2mqtt/ikea_pad_1
  condition:
    condition: template
    value_template: >
      {% if ( "brightness_up_click" == trigger.payload_json.action) %}
        True
      {% else %}
        False
      {% endif %}
  action:
    data_template:
      entity_id: light.ikea_led_driver_1_light
      brightness: "{{ state_attr('light.ikea_led_driver_1_light', 'brightness') + 50 | int }}"
      transition: 1
    service: light.turn_on

- id: 'ikea_led_driver1_dim_down'
  trigger:
    platform: mqtt
    topic: zigbee2mqtt/ikea_pad_1
  condition:
    condition: template
    value_template: >
      {% if ( "brightness_down_click" == trigger.payload_json.action) %}
        True
      {% else %}
        False
      {% endif %}
  action:
    data_template:
      entity_id: light.ikea_led_driver_1_light
      brightness: "{{ [state_attr('light.ikea_led_driver_1_light', 'brightness') - 50, 1] | max }}"
      transition: 1
    service: light.turn_on

Maybe the entity_id wont work with friendly names, so just use device code from zigbee2mqtt with the _light suffix.