MQTT split question


First of all i’m a beginner of MQTT and HS, which means I am still searching a lot on the forum and have based on an existing automation a working script. But get stuck on a snall part of it.

I’m trying to split a MQTT payload with the next code:

- alias: split mqtt
    platform: mqtt
    topic: /interface/pvinverter/Action
    - variables:
        data: "{{ trigger.payload[5:-1].split(',') }}"
        item: ['action', 'vp1', 'fac', 'ip1']
    - repeat:
        count: '{{ item | length }}'
        - service: mqtt.publish
            topic: '/interface/pvinverter/Action/{{item[repeat.index-1]}}'
            payload: '{{data[repeat.index-1]}}'

what works, however the preset label (if I may call it that) is not needed because it’s already in the payload so i want to use that label.
Now I will get splited info like: vp1 = “vp1”,“3831”
So if I receive this value from the MQTT the sensor give me a “vp1”,“3831” input.

I figure out that the item: [‘action’, ‘vp1’, ‘fac’, ‘ip1’] can be removed but want to use the orginal label text as item.

I have for example the next source:


How can i do that?


Small update, topic can be closed.
Find a nice solution with node-red :wink: