Troubleshooting a Bash Script in OpenHAB

Hello everyone, I’m facing an issue with a bash script in OpenHAB and I’m hoping someone can help me figure it out. I’m relatively new to scripting, so any guidance would be greatly appreciated!

I have a Living Room TV running Android TV, and I wanted to set up notifications from OpenHAB. After some research, I found a way to send notifications using a bash script. Here’s what I’ve done so far:

I created a simple rule in OpenHAB that triggers when a certain event occurs. The rule is supposed to execute a bash script that sends a notification to my TV. Here’s the rule I set up:

rule “Living Room Notification”
when
Item NotificationTrigger changed to ON
then
executeCommandLine(“/opt/openhab/conf/scripts/Notification.sh” + “@@” + “The Grand Tour” + “@@” + “Plex” + “@@” + “10s” + “@@” + “top-right” + “@@” + “>/dev/null”)
end

And here’s the bash script Notification.sh:

nfa notify -a 192.168.10.60 -t “Plex” -m “$1” -d 10s -o top-right

The goal is for the script to display a notification on my TV screen when triggered. However, when I run the rule, nothing happens on the TV. I checked the logs and noticed that the command is being executed with extra commas that shouldn’t be there. Here’s the log output:

2020-01-17 20:53:30.403 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine ‘[/opt/openhab/conf/scripts/Notification.sh, The Grand Tour, >/dev/null]’

It seems like the script is adding extra commas, which is causing the command to fail. I tried modifying the rule to remove the commas, but I’m still not getting the expected result.

I’m not sure if the issue is with how I’m passing the arguments to the script or if there’s something wrong with the script itself. I’ve tried running the script manually from the terminal, and it works perfectly, so the problem must be somewhere in how OpenHAB is executing it.

If anyone has experience with bash scripts in OpenHAB or knows why the commas are being added, I’d really appreciate your help. Please let me know if you need more details or if there’s anything else I can try to resolve this issue. Thanks in advance!