I’m trying to format an MQTT.Publish to run as part of an automation action…
I’m trying to convert this:-
{ "command": "notifu.exe", "args": "/m "Doorbell Rung" /p System", "user": "", "visible": true, "fallback": true }
which doesn’t work
into
{ "command": "notifu.exe", "args": "/m \"Doorbell Rung\" /p System", "user": "", "visible": true, "fallback": true }
which does.
Both are acceptable to the HA config file parser, but because I need an extra layer of escaping on “Doorbell Rung” I’m having difficulties. Any tips?!
This is my payload from the automation action:-
"{ \"command\": \"notifu.exe\", \"args\": \"/m \"Doorbell Rung\" /p System\", \"user\": \"\", \"visible\": true, \"fallback\": true }"
Thanks!!
If I try to use ascii code 08,
"{ \"command\": \"notifu.exe\", \"args\": \"/m \b\"Doorbell Rung\b\" /p System\", \"user\": \"\", \"visible\": true, \"fallback\": true }"
I get the following bizareness.
{ "command": "notifu.exe", "args": "/m "Doorbell Rung" /p System", "user": "", "visible": true, "fallback": true }
Got there in the end, this was the answer for anyone coming after me with the same problem!
payload: "{ \"command\": \"notifu.exe\", \"args\": \"/m \\\"Doorbell Rung\\\" /p System\", \"user\": \"\", \"visible\": true, \"fallback\": true }"