How to pass new line in a service variable?

when I declare custom service in esphome like this:

- service: send_command
  variables:
    cmd: string
  then:
    - lambda: "id(nspanel).send_custom_command(cmd.c_str());"

I’m able to pass new line in description {{'\r\n'}}

service: esphome.nspanel_send_command
data:
  cmd: >-
    entityUpdateDetail~id~~65535~~3840~~61440~{{'\r\n'}}Description~52457~0~3~~52457

Now I’d like to define a new service, so that a new line can be included in the passed variable:

- service: notify_fullscreen
  variables:
    description: string
  then:
    - lambda: |-
          id(nspanel).send_custom_command("pageType~popupNotify");
          std::string cmd = "entityUpdateDetail~id~~65535~~3840~~61440~" + description + "~52457~0~3~~52457";
          id(nspanel).send_custom_command(cmd.c_str());

My idea is to call it like this:

service: esphome.nspanel_notify_fullscreen
data:
  description: "{{'\r\n'}}Description"

No matter how I adjust notify_fullscreen it either ignores a new line or shows the escaped characters.

Can anyone help me out finding a proper syntax for it? Workarounds, e.g. replace with another string, are also appreciated. It’s driving me nuts, can’t figure it out.

Someone helped me with this which I think is the same or similar?

How does it look in the ESPHome logs when imported?

I had a text sensor in HA which had \r in it and they would parse as \\r when imported into ESPHome and need special handling on the ESPHome side.

This thread on Discord could possibly be of further use.

“Handle escape characters in UART Write”