I am trying to assemble a table with device en variable parameters. The difficult ones are “actions”. As I find them easily using “info viewer”, “info viewer page”, “Vera Invoke” displaying: " http://veraId/port_3480/data_request?id=lu_invoke&DeviceNum=44", I intended to read that data with following code:
vid = 44
local vURL ="http://veraip/port_3480/data_request?id=lu_invoke&DeviceNum=".. vid
local vCode, vData = luup.inet.wget(vURL,5)
luup.log("Return code: " .. vCode .. " Datatype: " .. type(vData))
If I use that code in “Test luup code” or in a scene it shows as inteded:
luup_log:0: Return code: 0 Datatype: string
Using the same function in startup.lua, I get:
luup_log:0: Return code: -1 Datatype: nil.
How can I get it to work also in startup? What could be happening?
The working version on a scene displays the first line of the document as:
How can I get the entire document in a string?
Thanks in advance!!