Is there any way in Vera3/UI5 to cancel a scene? Scenes can have several actions at various delays from the beginning of the scene. However, I sometimes want to perform an action which should abort the scene. For example, if a light is ramping up slowly, I may want to hit a switch to make it go all the way up immediately, or all the way down. I tried looking at all of the LUA extensions and could find nothing that could do this easily within the Vera actions/delays framework.
The best that I could do was coe like the following in a “Ramp up” sceme:
local device_id = 4
local interval = 4 – seconds
local increment = 1 – from 1 to 99
fade_on = true – turned off by fade_off scene
local t = luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelStatus”, device_id)
local curValue = tonumber(t or “0”);
if (curValue < 100) then
curValue = curValue + increment
if (curValue > 100) then
curValue = 100
end
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = tostring(curValue)}, device_id)
luup.call_delay( ‘fade_up’, interval ,tostring(curValue))
end
function fade_up(param)
local passed_val = tonumber(param)
local t2 = luup.variable_get(“urn:upnp-org:serviceId:Dimming1”, “LoadLevelStatus”, device_id) or “0”
local cur_val = tonumber(t2);
if (not fade_on) or (cur_val > passed_val) or (passed_val > 99) or (cur_val == 0) then
return false
end
local new_val = cur_val+increment
if (new_val > 100) then
new_val = 100
end
luup.call_action(“urn:upnp-org:serviceId:Dimming1”, “SetLoadLevelTarget”, {newLoadlevelTarget = tostring(new_val)}, device_id)
luup.call_delay( ‘fade_up’, interval ,tostring(new_val))
end
And in a “Stop” trigger:
fade_on = false – Used by the “Turn On Slowly” scene
Has anyone found an easier (and more reliable) way to do this?