Platform information:
Mac High Sierra on a mac Mini with Openhab 2.1
Hi I’m trying to send a command to my Mac in a rules. Everything is working fine but now I’m trying to send a parameter in my commande so I need to add a space before my value and put my value between quoted mark
this is my command :
executeCommandLine("/usr/local/bin/node /Users/admin/OpenHab/conf/HScript/JS/Salon.js" ghSalontts.state)
so I want to put my string item ghSalontts as a parameter for my script
Thanks
hr3
(Harry)
January 30, 2018, 9:26am
2
executeCommandLine("/usr/local/bin/node /Users/admin/OpenHab/conf/HScript/JS/Salon.js "+ghSalontts.state)
Thank you for your anser but it’s not what i need …
let say my value for ghSalontts is Hello World
but when i send my command i need the value to be : SPACE “Hello World”
hr3
(Harry)
January 30, 2018, 1:57pm
4
There is a space after “js”.
Have you checked it?
You can alse use
executeCommandLine("/usr/local/bin/node /Users/admin/OpenHab/conf/HScript/JS/Salon.js"+" "+ghSalontts.state)
rlkoshak
(Rich Koshak)
January 30, 2018, 3:59pm
5
OP also want’s the Hello World to be in quotes.
executeCommandLine("/usr/local/bin/node /Users/admin/OpenHab/conf/HScript/JS/Salon.js \""+ghSalontts.state+"\"")
Thank you !! It seam to work but I still have an issue that I can’t figure out
Just to be sure if my value is ok is it possible to add the space and quoted mark directly to the value so I could check via the rest API if everything is ok
You know something like :
postUpdate( ghSalontts,SPACE+QUOTEDMARK+ghSalontts.state+QUOTEDMARK)
rossko57
(Rossko57)
January 31, 2018, 2:55am
7
Is there some reason you wouldn’t want to use the same method?
postUpdate( ghSalontts, " \""+ghSalontts.state+"\"")
because it does not work … this is the result in my rest API
{
“link”: “XXXXXXX:7070/rest/items/ghSalontts”,
“state”: " “Hello World”",
“type”: “String”,
“name”: “ghSalontts”,
“label”: " TTS Salon",
“tags”: [],
“groupNames”: []
}
milty456
(Rich Smith)
February 21, 2023, 11:53pm
9
Did you ever get this to work; i cannot.
executeCommandLine(“sudo bash /log/var/openhab2/FrontDoor.sh” "“+ FrontDoorLogString.state+”"")