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

Moderator: leecollings

Post Reply
tlkg
Posts: 19
Joined: Sunday 14 January 2018 22:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: United States
Contact:

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

Post 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.
DarkG
Posts: 89
Joined: Friday 15 September 2017 18:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10076
Location: Germany
Contact:

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

Post by DarkG »

Maybe a problem with rights
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
tlkg
Posts: 19
Joined: Sunday 14 January 2018 22:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: United States
Contact:

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

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest