We have moved at community.getvera.com

Author Topic: New with LUA  (Read 2250 times)

Offline huwu

  • Full Member
  • ***
  • Posts: 233
  • Karma: +0/-1
New with LUA
« on: October 08, 2009, 09:51:16 am »
Help wanted!

Since my Vera proudly runs the LUUP release I begun to play around with LUA. I tried to rebuild a scene with LUA code but I didn't found  a piece of code for what I intended.

Here is what I want the scene to do:
On sunset a scene should start with
     luup.call_action("urn:upnp-org:serviceId:WindowCovering1","Down",{ },32)
Than wait 20 seconds
     luup.call_action("urn:upnp-org:serviceId:WindowCovering1","Down",{ },33)

Question: How can I define the delay?

A second question I have is how can I build a scene to toggle a device on and off x times? I tried something like:
       do
       local var, limit, step = 1, 4, 1
       if not (var and limit and step) then error() end
       while (step > 0 and var <= limit) or (step <= 0 and var >= limit) do
         luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },13)
        wait
        luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },13)
         block
         var = var + step
       end
     end

That didn't work.

Any ideas?
« Last Edit: October 08, 2009, 10:32:42 am by huwu »
My Z-Wave:Vera3, VeraEdge, 4*Dimmer, 14*RollerShutter, 4*PlugIn,9*Binary, 8*SmokeSensor, 2*Remote, 1*Siren, 1*RangeExtender, 1*Sensor, 1*BatterySwitch. Devices from:Duewi, Merten, HomePro, Trickle, Everspring, Fibaro, Aeon, Vision and MiCasa Verde

Offline huwu

  • Full Member
  • ***
  • Posts: 233
  • Karma: +0/-1
Re: New with LUA
« Reply #1 on: October 08, 2009, 10:33:00 am »
sorry, wrong forum
My Z-Wave:Vera3, VeraEdge, 4*Dimmer, 14*RollerShutter, 4*PlugIn,9*Binary, 8*SmokeSensor, 2*Remote, 1*Siren, 1*RangeExtender, 1*Sensor, 1*BatterySwitch. Devices from:Duewi, Merten, HomePro, Trickle, Everspring, Fibaro, Aeon, Vision and MiCasa Verde