Lua Script

Discussion in 'C-Bus Automation Controllers' started by chromus, Sep 30, 2020.

  1. chromus

    chromus

    Joined:
    Jan 27, 2014
    Messages:
    422
    Likes Received:
    50
    Location:
    Perth
    Hi All,

    I normally program in HTML/C/python and LUA is something i've only dabbled in.

    In a nutshell, client with a SHAC has a kid with a nasty habit of playing with things and while the client wants access to change
    EDLT screen/button brightness but if someone dicks with it, for the value to be auto restored to 50%

    I got this using the built in code builder but its not quite right, the script saves and runs without error but doesn't actually execute the end goal.

    Code:
    -- Get level of the EDLT screen brightness group from CBUS
    edltbrightvalue = GetLightingLevel(3)
    -- evaluate EDLT screen brightness group
    if (edltbrightvalue <= 127) then
    -- Set value back to 50%
      SetLightingLevel(3, 128, 0)
    end
    
    What have I missed?
     
    chromus, Sep 30, 2020
    #1
  2. chromus

    chromus

    Joined:
    Jan 27, 2014
    Messages:
    422
    Likes Received:
    50
    Location:
    Perth
    Never mind - it worked after rebooting the unit
     
    chromus, Sep 30, 2020
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.