Payload length, formatting label in indicator block


Is there a maximum length for a JSON payload?
also how do I encode format information into a string so that it displays text on several lines when used as a label in an indicator block


The maximum payload size is 256KB.

To put blank lines in the indicator block, separate your values with a blank line in the label.

The first value is: {{ value-0 }}

The second value is {{ value-1 }}


The above works if you’re reporting values as different attributes. If you’re reporting a string on a single attribute and would like line breaks within that string, then that’s not currently supported. We’ll have to brainstorm a bit on our end for the best way to support that. We could probably interpret line breaks automatically.


Brandon - thanks for the answer. I had wanted to include line breaks within the stream. However, even when splitting things into separate messages I am running into what seems to be a 200 character payload limit (hence my question of payload limit)
My payload that I am sending looks like this

{"data":{"LN2-Tank":2.000000,"LN2-P1":0.049603,"LN2-P2":21.265568,"LN2-Temp":25.000000,"LN2-Alarm":1.000000,"LN2-Message1":"**Tank 1 empty**","LN2-Message2":"V1 closed  V2 closed  Vent open","LN2-Message3":" 0 hrs 0 min since open"}}

while Losant rejects the payload think it ill formed. With only the first ~200 characters listed

{"data":{"LN2-Tank":2.000000,"LN2-P1":0.135229,"LN2-P2":20.973444,"LN2-Temp":25.000000,"LN2-Alarm":1.000000,"LN2-Message1":"**Tank 1 empty**","LN2-Message2":"V1 closed V2 closed Vent open","LN2-Message3":" 0 h

the relevant code fragment is:

char buffer[400];
client.publish(MQTT_TOPIC_STATE, buffer);
if (verbose) Serial.print(" cstr ");Serial.println(buffer);

where the print out for buffer is the longer, fully formed string


There is a hard-coded MQTT packet size limit on an underlying library that the Arduino client uses. Check out this post and see if it addresses the limit issues: