I have a scene that causes an error when I reboot the Vera. Sometimes it also causes an error when the luup is reloaded.
This scene is scheduled to run every minute and it fetches data from a website and post the value in the multi string device.
This is the error:
LuaInterface::CallFunction_Scene Scene 57 failed attempt to call a nil value <0x7799a520>
This is the Scene code:
[code]-- Input Device
local dID1 = 246 – Multistring Device
– Input Variables
local powerconsumptionLimit = 30 – Percent
local RuntimeLimit = 15 – Minutes
local twSecs = 600 – Number of seconds in time window
local socket = require(“socket”)
local ltn12 = require(‘ltn12’)
local https = require(“ssl.https”)
https.TIMEOUT = 5
– Get UPS Status page
function Powershute()
local response_body = {}
local rBody, code, response_headers, rStatus = https.request{
url = “https://192.168.148.3:6547/quickstatus”,
method = “GET”,
verify = “none”,
mode = “client”,
options = “all”,
protocol = “sslv3”,
headers = {
[“Accept-Encoding”] = “sdch”,
},
sink = ltn12.sink.table(response_body)
}
if (code ~= 200) then
luup.log(“APC: Powerchute page return error”)
return false
else
return table.concat(response_body)
end
end
– Extract values
local page = Powershute()
local DeviceStatus = page: match ‘
local RealPowerPct = page: match '
local RuntimeRemaining = page: match ‘
– Set variables in Multistring Device
local timestamp = os.date(‘%X’)
local datestamp = os.date(‘%d %B %Y’)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “Variable1”, DeviceStatus, dID1)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “Variable2”, RealPowerPct, dID1)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “Variable3”, RuntimeRemaining, dID1)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “Variable4”, timestamp, dID1)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”, “Variable5”, datestamp, dID1)[/code]
I’ve been searching en testing for weeks but I can’t find the error. I’ve even tried adding delays.
I’ve posted an thread before [url=http://forum.micasaverde.com/index.php/topic,35591.msg262988.html#msg262988]http://forum.micasaverde.com/index.php/topic,35591.msg262988.html#msg262988[/url] but I was way off so don’t look at this.
Any help will be greatly appreciated