MQTT with sensor data to PixelIT

Hi,

I have a PixelIt and I can send mqtt to display a text. I created a button card, call the service MQTT: Publish.
Now I’m trying to send sensor data with mqtt to the PixelIt so it show my swimming pool temperature.

I send the payload (to show a text):

{
  "text": {
    "textString": "Test It :D",
    "bigFont": false,
    "scrollText": "auto",
    "scrollTextDelay": 20,
    "centerText": false,
    "position": {
      "x": 8,
      "y": 1
    },
    "color": {
      "r": 255,
      "g": 255,
      "b": 255
    },
    "hexColor": "#FFFFFF"
  }
}

That works fine.

Now I want to change the text to show the swimming pool temperature and tried:
“Test It :D”
to
“Temperature: {{ states(“sensor.sensor_swimmingpool_water”) }}”

but that doesn’t work.
Any suggestions how to make this work?

Please show your code.
Did you use payload_template, as documented?

That was pretty dumb…
I was adding the sensor data in the payload instead of payload_template.
Thanks for noticing, it’s working now.

For anybody who’s intereasted in displaying sensor data to PixelIt (activate by pressing the button):

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: mqtt.publish
  target: {}
  data:
    qos: 0
    retain: false
    topic: PixelIt/setScreen
    payload_template: |-
      {
        "text":
          { 
            "textString": "Swimming pool is {{states('sensor.sensor_swimmingpool_water')}} *C", 
            "bigFont": true, 
            "scrollText": "auto",
            "scrollTextDelay": 40,
            "centerText": false,
            "position": 
              {  
                "x": 8,
                "y": 1
              },
            "color":
              {
                "r": 255,
                "g": 255,
                "b": 255
              },
            "hexColor": "#FFFFFF"
          }
      }
name: Swimming Pool Temperature
icon: mdi:coolant-temperature