Author Topic: need a Lua code for some curtains  (Read 317 times)

Offline yatagx

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
need a Lua code for some curtains
« on: June 01, 2017, 11:51:50 am »
hi,

can some one please provide me with a LUA code, for a blackout curtain?

what i would like to acomplish is to start closing the curtain, and after 8 seconds the stop the curtain.


thanks in advance


Online jswim788

  • Hero Member
  • *****
  • Posts: 508
  • Karma: +25/-2
Re: need a Lua code for some curtains
« Reply #1 on: June 01, 2017, 12:12:49 pm »
You might use the count down timer plugin instead: http://forum.micasaverde.com/index.php?topic=9425.0  Then you don't need to write any lua - you can have one scene start the timer, and trigger a second scene to stop the curtains when the timer expires.

But if you want to do this in lua, see this page: http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_call_delay  You can use the 'call_action' to start closing, 'call_delay' to create the delay, and another 'call_action' to stop the curtain.

Or take a look at PLEG: http://forum.micasaverde.com/index.php?topic=12759.0 which can also do this.

Offline yatagx

  • Sr. Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
Re: need a Lua code for some curtains
« Reply #2 on: June 01, 2017, 02:11:33 pm »
Hi, the timer plugin will not work since i am not able to make a scene that only use the stop option in vera scene creation menu, so the only way is to do it with a Lua code, but i am not good with LUA, so i would like to know if some one can help me with this

regards


Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Re: need a Lua code for some curtains
« Reply #3 on: June 01, 2017, 03:56:29 pm »
You can do this with scenes or PLEG.
You do NOT need to use LUA.
You need to use the advanced editor for both, since the stop action is not Vera blue n the UI.