#MQTT payload breaks on line break?

1 messages · Page 1 of 1 (latest)

runic crane
#

given

      - action: mqtt.publish
        data:
          qos: 0
          retain: false
          topic: awtrix_1e8d80/custom/afvalwijzer
          payload: >
            {
             "text": "{{afval|title}} wordt {{dag}} opgehaald, zet de {{afval}} container aan de straat",
             "icon": "{{icon}}",
             "repeat": 1,
             "pushIcon": 0,
             "textCase": 2,
             "textOffset": 5,
             "background": "{{background_kleur}}",
             "color": "{{text_kleur}}"
            }

works, but when I break the text (to fit in the editor window) to

"text": "{{afval|title}} wordt {{dag}} opgehaald, zet 
           de {{afval}} container aan de straat",

the line remains either empty in the display, or only shows bottom pixels.) I am not sure if this is because of the formatting in the payload, or maybe some limitation of the device I publish this payload to.

#

right, so in this discord view you can not see the top complete payload is a single line....hope it is clear what I am doing there though

drifting crescent
#

I guess the folding marker won't fold newlines inside a quoted string.

runic crane
#

yes, ut it seems to not always be the case, this works:

          {"text":
             "{% set temp = states('sensor.ws_5500_outdoor_temperature',with_unit=true) %}
              {% set deel = states('sensor.dag_deel')|lower %}
              {% set tijd = states('sensor.time') %}
              {% set n = 'n' if deel == 'avond' %}
              Goede{{n}}{{deel}}
              Het is {{tijd}} op {{states('sensor.vandaag')}} en buiten is het {{temp}}",
            "icon": "{{'24636' if is_state('sun.sun','below_horizon') else '1246'}}",
            "rainbow": true,
            "repeat": 1,
            "pushIcon": 0,
            "textCase": 2,
            "textOffset": 1}