How to configure template for PWM light?

Hi there everyone,
Not so long ago I turned from domoticz to HA - and I’m really impressed by the amount of possibilities.
However:
I’ve got ceiling light - simple white led strip. It is connected through mosfet to the esp8266. (It worked on domoticz). Esp has ESPeasy software, can be driven through mqtt, but the command has to be sent in format: cmd,2(pin number),XXX(brightness value),YY(speed of change from previous value, usually I use 500ms).
My question is: how to configure template in configuration.yaml to send message in format accepted by the ESPeasy?
For now I have something like this:

light:
  - name: "Ceiling led"
    command_topic: "salon/led/switch"
    brightness_scale:1023
    brightness_command_topic: "salon/led/switch"
    brightness_template: '{PWM,2'|int',500}'

I know that the last line is wrong and it should be written other way - but since I’m pretty new to HA, I don’t know the syntax (please, be kind with me :slight_smile: ) and the light section on the web is rather unclear.

Allright, I will respond myself for the future mankind :slightly_smiling_face:
This needs special configuration o espeasy Rules.
The controller subscribes to two topics, one for switch and other for the brightness.

Here you can read about it: