Help on coding "local" variables?

I have been experimenting with adding local variables to a working piece of luup code to make it more accesible for other users.

After studying the Wiki on luup, particularly these pages:
http://wiki.micasaverde.com/index.php/Luup_Variables &
http://wiki.micasaverde.com/index.php/Lua_tips

I came as far as this with the variables (without using global variables) using the “hold on to your locals” tips

The working code is:

function ScreenOpen()
   luup.call_action("urn:upnp-org:serviceId:WindowCovering1","Up",{ },27)
end
function ScreenStop()
   luup.call_action("urn:upnp-org:serviceId:WindowCovering1","Stop",{ },27)
end

luup.call_timer("ScreenOpen", 1 ,"1","","")
luup.call_timer("ScreenStop", 1 ,"24","","")

But now im stuck and the code wont run (scene kicks off, message sent, no reaction from the z-wave device)
Not working (test) code;

do
 local DeviceNumber1 = 27
 local Delay1 = "1"
 local Delay2 = "24"

 function ScreenOpen()
  luup.call_action("urn:upnp-org:serviceId:WindowCovering1","Up",{ },Devicenumber1)
 end
 
 function ScreenStop()
  luup.call_action("urn:upnp-org:serviceId:WindowCovering1","Stop",{ },Devicenumber1)
 end

 luup.call_timer("ScreenOpen", 1 ,Delay1,"","")
 luup.call_timer("ScreenStop", 1 ,Delay2,"","")
end

What am i doing wrong? Any help would be appreciated

I think the only thing wrong here it’s that you declared the DeviceNumber1 with capital N, but you used it with small n (Devicenumber1).

Also, you can always run
[tt] tail -f /var/log/cmh/LuaUPnP.log[/tt]

Whilst you run it, and it’ll give more clues as to the problem it’s experiencing… Albeit sometimes cryptic.

@guessed,

Thanks i will test that and post back if it works!
(sigh spaces, caps, csv… programming… argh ;-))

[quote=“guessed, post:3, topic:168655”]Also, you can always run
[tt] tail -f /var/log/cmh/LuaUPnP.log[/tt]

Whilst you run it, and it’ll give more clues as to the problem it’s experiencing… Albeit sometimes cryptic.[/quote]