Page 1 of 1

can't get Curl -T in Lua to work. Works at command line

Posted: Monday 17 December 2018 20:33
by tlkg
I am trying to send a xml file to a camera (Hikvision) to turn on it's output line. I have everything working if I submit via the Pi command line but when putting it in a Lua script it's not working. I see the script executing and it returns exit and status of 0 when using os.execute, but nothing is happening on the camera side. (Lua script is saved as a Device script)

Here's the Script:
commandArray = {}
if (devicechanged['Tank - Heater'] == 'On') then
print( os.execute('curl -T /home/pi/domoticz/scripts/lua/AlarmON.xml "http://user:[email protected]:10042/IO/outputs/1"'))
else
-- os.execute('curl -T /home/pi/domoticz/scripts/lua/AlarmOFF.xml "http://user:[email protected]:10042/IO/outputs/1"')
print(devicechanged['Tank - Heater'])
end
return commandArray

Executing the same Curl command on the raspPi command line works great.

Thanks for any help.

Re: can't get Curl -T in Lua to work. Works at command line

Posted: Tuesday 18 December 2018 13:05
by DarkG
Maybe a problem with rights

Re: can't get Curl -T in Lua to work. Works at command line

Posted: Tuesday 18 December 2018 17:38
by tlkg
Ok, I had one of those "Duh" moments.

Everything is working fine in the Lua script. I had forgot to add a critical keyword in the URL line to actually "Trigger" the output port. The command I was sending was just to return the state of the line. so DUH...

Thanks