albersag
(Alberto Sagredo)
October 6, 2015, 10:15am
1
I have a bash script that sets Openhab status on some items when launched outside openhab that is working fine
2015-10-06 10:10:52 - Active_Calling state updated to “201”
2015-10-06 10:10:52 - Active_Called state updated to “999”
When running as a rule
ule “Call”
when
Item Asterisk_Ring changed
then
if(Asterisk_Ring.state == ON)
{
executeCommandLine("bash /etc/openhab/configurations/rules/call.sh")
}
if(Asterisk_Ring.state == OFF)
{
executeCommandLine(" bash /etc/openhab/configurations/rules/calloff.sh")
}
end
2015-10-06 10:11:28 - Asterisk_Ring received command ON
2015-10-06 10:11:28 - Active_Calling state updated to
2015-10-06 10:11:28 - Active_Called state updated to
It is set to blank
curl command is as follows
curl --header ‘Content-Type: text/plain’ --request PUT --data “$numbercalling” “http://10.0.2.19:8080/rest/items/Active_Calling/state/ ”
Why inside openhab does not set correctly and running outside it worked fine?
I get called /calling number from Asterisk and setting to an Item
BR
albersag
(Alberto Sagredo)
October 6, 2015, 10:16am
2
Openhab.log is normal and shows:
2015-10-06 10:11:28.588 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine ‘bash /etc/openhab/configurations/rules/call.sh’
2015-10-06 10:11:36.247 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine ’ bash /etc/openhab/configurations/rules/calloff.sh’
If your openhab and script is on the same machine could you maybe replace the IP with localhost?
e.g.
http://localhost:8080/rest/items/Active_Calling/state
albersag
(Alberto Sagredo)
October 6, 2015, 10:43am
4
I tried that but same issue
curl --header ‘Content-Type: text/plain’ --request PUT --data “$numbercalling” http://localhost:8080/rest/items/Active_Calling/state/
curl --header ‘Content-Type: text/plain’ --request PUT --data “$numbercalled” http://localhost:8080/rest/items/Active_Called/state/
2015-10-06 10:41:47 - Asterisk_Ring received command OFF
2015-10-06 10:41:48 - Active_Calling received command -
2015-10-06 10:41:48 - Active_Called received command -
Running outside
2015-10-06 10:43:24 - Active_Calling state updated to “201”
2015-10-06 10:43:24 - Active_Called state updated to “999”
Running outside openhab rules , script sets correctly data
Maybe i could do in other way?
dan12345
(Dan)
October 6, 2015, 2:01pm
5
Have you tried running openhab as root to check it’s not a permissions issue?
dan12345
(Dan)
October 7, 2015, 9:53am
7
have you tried piping the output of the bash script to a log file so you can see what’s happening when it’s triggered?