Author Topic: LUA code not working anymore  (Read 733 times)

Offline P-a

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +2/-0
LUA code not working anymore
« on: March 14, 2017, 06:53:55 am »
Hi guys and girls,

Is it just me or does anyone else experience issues adding LUA to new Scenes in VERA UI7?

Just simple things does not work? My new scenes keep firing regardless of LUA code like the one below?

local function Trix()
     local dID = 238       
     local allow = true       
     local status = luup.variable_get("urn:upnp-org:serviceId:VSwitch1","Status",dID)
     return ((status == "1") == allow)

return Trix()

Input to offer?

Much appreciated!

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 418
  • Karma: +5/-21
Re: LUA code not working anymore
« Reply #1 on: March 14, 2017, 08:53:44 am »
Here's an example of a LUA snippet I use to cause a scene to run during "Day" time:

Code: [Select]
local DayNight_Status = luup.variable_get("urn:rts-services-com:serviceId:DayTime","Status",DayNight_ID)
return (DayNight_Status == "1")

As you can see, it's a bit simpler than yours in that all it does is get the status and then executes a return of the actual status compared to a value of "1" (which represents "Day"). I never had much luck with the double equality things like you're trying to use and this has been solid for me. Also, I don't execute any sort of "return" inside my functions like this without a very specific reason to do so.

As an aside, I have global variables defined at startup to identify a few key devices in my system like the Day/Night Plugin and that's why this code is as short as it is.

Offline tony-park

  • Jr. Member
  • **
  • Posts: 83
  • Karma: +1/-0
Re: LUA code not working anymore
« Reply #2 on: March 09, 2018, 04:19:09 am »

did you ever get this resolved? I'm on vera plus and seeing that lua code in the triggers and the luup code, neither are being processed :-(