Sensor size limit - How to read long MQTT payloads?

I want to use text strings that are longer than 256 characters. I thought I could publish them to MQTT (I can) and then be able to do something with them in HA (I can’t).

The only way I can think of to get them into HA is using an MQTT Sensor but I have now found that that also has a size limit of 256 characters :frowning_face:

Is there any way to ‘read’ a long payload? It doesn’t need to be stored, I can use it dynamically while it is in memory.

You can trigger an automation with the MQTT message or if your payload is json, you may be able to reduce the size of the saved string by using json attributes to save only part of the payload.

Thanks, I saw that but I don’t see how I get access to the payload to do something with it.

For example, if I publish like this:

  - service: mqtt.publish
    data_template:  
      topic: "messages/message_text"
      payload: "This payload is more than 256 characters long.... blah blah...."

and then trigger an automation with:

  trigger:
    platform: mqtt
    topic: messages/message_text

How can my action use the payload?
e.g.

  action:
    service: tts.google_say
      message: <that really long payload>

The payload is available in {{ trigger.payload }}, along with {{ trigger.topic}}. Perhaps an example is best

  - alias: Four33 Button
    initial_state: 'on'
    trigger:
      platform: mqtt
      topic: home/433toMQTT
    action:
      event: Four33Button
      event_data_template:
        payload: '{{ trigger.payload }}'

That is brilliant, thank you. I’ll give that try!