Send sensor value in json payload

Hello Community,
I am new here in the forum and new in homeassistant. My smarthome ran the last few years with IOBroker but that was no longer the right fit for me.
Now I have some hurdles in the switch with the help of the frum (reading) can solve. But now I have a problem that I do not get solved.

I want to send via MQTT a sensor value in json format to a PIXEL clock, but I don’t know how to use the value of the sensor in the json payload.
I want to use the value
sensor.lumi_weather_temperature
in this payload

service: mqtt.publish
data:
  qos: "0"
  retain: false
  topic: AwtrixPC/notify
  payload: "{ "icon\": \"230\", \"text\": \"VALUE\", \"duration\": 10 }"

INSERT.
With the things I have found here in the forum, it has not worked so far. The last thing I tried was this

>
    {% set tojson = {"temperature": states.sensor.lumi_lumi_weather_temperature} %} 
    "{\"icon\": \"230\",  \"text\": \"{{ tojson }}\", \"duration\": 10 }"

Do I have to put the value in a variable first and then use it in the payload or can I use the value directly there? Would be nice if someone can help me here :slight_smile:

How does it work in Homeassistant?

Did you try this ?

  payload: "{ "icon\": \"230\", \"text\": \"{{states(' sensor.lumi_weather_temperature') }} \", \"duration\": 10 }"