@guessed
Thanks !! I modified the code based on this and it now works.
I was also able to test it by looking at the log files @
http://192.168.x.x/cgi-bin/cmh/log.sh?Device=LuaUPnP
I now want to proceed and build a device around the HTTP interface.
[quote=“guessed, post:10, topic:168995”]@txautomator,
In your example, using the simplistic form of LuaSocket’s HTTP, it should be [tt]http.request(…)[/tt].
The function returns 2 values, the result/content and the status.
If you were testing this using command line Lua, it would look like:
[code]local http=require(“socket.http”)
print(string.format(“Starting…timeout=%d, agent=%s”, http.TIMEOUT, http.USERAGENT))
http.TIMEOUT=5
result, status = http.request(“http://192.168.0.113/runprocess.htm”, “run=run”)
print(string.format(“HTTP Call returned status=%s, body=%s”, (status or 0), (result or “”)))
[/code]
The default timeout is very long, and can do bad things to Vera during shutdown operations, so I shortened it. Not sure what you’re planning to do with it in a scene though as you cannot just return the result
In a Scene, Vera expects you to return [tt]true[/tt] or [tt]false[/tt], indicating whether to continue running the scene. Returning a string (HTTP Result) doesn’t make sense.
[quote=“txautomator, post:7, topic:168995”]Folks,
I am new to Luup and having trouble launching.
As part of a scene, I’d like to control a process that can only be triggered by an HTTP POST request. I am not sure if I am doing this right… but here is the code I placed under the Luup section of the test scene that I created:
This works fine when I am running this in FireBug / Firefox. But nothing appears to happen when I run the scene. Frankly, I don’t even know if I can run this in a scene.
Any thoughts on how to properly code and test this? I have looked at some of the other threads here, so I don’t think this is a syntax issue.[/quote][/quote]