Controlling a dimmer

I would like to control a dimmer via MQTT. On my sitemap I would like to have two elements:

  1. A switch to turn the lights on or off
  2. A slider to finetune the intensity of the light

The switch sends/receives the commands ON and OFF. This is working fine. However, the slider must send/receive the expression “dim” followed by an integer between 0-99.

My question is regarding the syntax of the MQTT definition of the slider. Right now, I use the following definition, that only sends an integer without the expression “dim”.

Dimmer eg_wz_dimmer “Licht Wohnzimmer [%d %%]” {mqtt="<[mosquitto:eg/wz/dimmer:state:ON:on],<[mosquitto:eg/wz/dimmer:state:OFF:off],>[mosquitto:eg/wz/dimmer/set:command:ON:on],>[mosquitto:eg/wz/dimmer/set:command:OFF:off]"}

Sitemap:

sitemap test label=“Test-Umgebung” {

Frame label=“Licht” {
Switch item=eg_wz_dimmer
Slider item=eg_wz_dimmer
}
}

One way would be to setup the item to send a string to the MQTT topic
See one example here:

@Dim I found that topic before, however, I am not able to make the transfer to my problem. I don’t understand how to combine the expression “dim” and the value that I define while using the slider.

For instance, if I set the slider to 50, the command to be send to my MQTT broker must equal “dim 50”.

A concrete syntax would be highly appreciated.