How to make the effect name different from the Json command it send's

I want to make the effect’s name different from the Json command’s it send. For example if the name is Blink it should send a “1” on the command_topic and not Blink.Is this possible and is there a easy what to do that in the configuration.yaml?

I am using hass.io and the Mosquitto broker that sends Json commands.

This is my configuration:

light:

  • platform: mqtt
    schema: json
    name: RGB
    state_topic: “HA/Esp/State”
    command_topic: “HA/Esp/Set”
    brightness: true
    rgb: true
    effect: true
    effect_list: [Blink, Static]
    #effect_list: [0, 1, 2, 3, 4 ,5, 6, 7, 8]
    #effect_list: [Blink, colorfade_slow, colorfade_fast, flash]
    optimistic: false
    qos: 0
    retain: true

Hi Alwin. Welcome to the forum. Please take a moment to read this, taking particular note of point 11, then edit your posted config. How to help us help you - or How to ask a good question

It’s possible and easy … if you’re comfortable with templating.

For starters, you have to change from using schema: json to schema: template. Then you have create a long-winded template for command_on_template. There’s an example in the documentation to help you get started.

There’s also another way. Use the existing configuration you have but change the command_topic to something else like HA/Esp/temp. Then create an automation that subscribes to this topic. In the automation’s action, have it reformat the payload (i.e. substitute the values you want for the effect_list), then publish the modified payload to HA/Esp/Set.