Good morning,
already I apologize in advance for my English.
I can’t pass a message that contains spaces,only the first word.
If I add a | urlencode I have the full message with the %20 as a space. I think I have gone around the topics and all the forms of
Wait, now I get what you mean, the variable {{ notification }} contains spaces and it gets cut, right?
Is there a way you could cut the command in two, so that the text is already in a file when you call the script and the script gets the message from the text file?
Can you show us the bash scripts? I suspect you collect the “notification” argument with $2, if the argument is not passed as a whole string it will only take the first word.
For example, if this is my notification.sh script:
#!/bin/bash
echo $1 $2
When I call it like this:
./notification.sh sms my text goes here
it will echo:
sms my
In order to have the whole text I have to quote it:
./notification.sh sms "my text goes here"
Which will result in:
sms my text goes here
You might have to “escape” the quotes in your shell command, like this:
service: shell_command.notification_sms
data:
notification: my text goes here or "my text goes here"
notification_sms: bash scripts/notification.sh sms \"{{ notification }}\"
Yeah, I am not sure exactly how to pull it off, but I am almost certain the issue is for the bash script, not the HA part.
Actually, the fact that your message shows the quotes ("my) kinda says that the quotes are passed on to the script but not interpreted as such.
There might be a better way to escape the double quotes. I’ll see if I can do some research.
notification_sms: "bash scripts/notification.sh sms \"{{notification}}\""
service: shell_command.notification_sms
data:
notification: my text goes here