Hello,
I’m not sure if this is ok, but seems like setting values via lua code inside a scene running on an interval forces the engine to invoke a new user_data request. Is this normal?
Example:
I have a scene that runs every second to check the content of a file in a home directory. it looks something like this:
local file = "cat /home/userdir/cecstatus"
local handle = io.popen(file)
local result = handle:read("*a")
result = string.gsub(result, "%s+", "")
luup.log(result)
handle:close()
if result=="on" then
luup.log("Turning ON VSwitch")
luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status", 1, 91)
luup.variable_set("urn:upnp-org:serviceId:VSwitch1", "Status", 1, 91)
else
luup.log("Turning OFF VSwitch")
luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status", 0, 91)
luup.variable_set("urn:upnp-org:serviceId:VSwitch1", "Status", 0, 91)
end
luup.variable_set is called every second and ALTUI requests a new user_data every second as well. the moment I turn off the scene, everything goes back to normal. If I modifying the conditional statement to something like this:
local VSwitch_Status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1", "Status", 91)
local file = "cat /home/userdir/cecstatus"
local handle = io.popen(file)
local result = handle1:read("*a")
result = string.gsub(result, "%s+", "")
luup.log(result)
handle:close()
if (result=="on" and VSwitch_Status=="0") then
luup.log("Turning ON VSwitch")
luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status", 1, 91)
luup.variable_set("urn:upnp-org:serviceId:VSwitch1", "Status", 1, 91)
else
luup.log("Turning OFF VSwitch")
luup.variable_set("urn:upnp-org:serviceId:SwitchPower1", "Status", 0, 91)
luup.variable_set("urn:upnp-org:serviceId:VSwitch1", "Status", 0, 91)
end
ALTUI would only request a new user_data when the conditional statement is valid. which makes believe that luup.variable_set could be the cause new user_data request.
Any ideas?