Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Controlling a light through DM in LUA

  1. #11
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    To cut down on all the editing required, it's probably a good idea to put all the buttons in a frame with the name of the path to the device, then use relative naming on the buttons. e.g. suppose the device was Fordrat8\ElkM1EZ8\Light 14 - you would use that as the name of the frame. Then a button in that frame would be called <^>. In fact, anywhere the name of the button is used you would substitute <^>, including in state rules and Lua code.

    If used in a Lua string then use [[ ]] notation to delimit the string.
    --Rob

  2. #12
    Join Date
    Apr 2004
    Location
    Dearborn, MI
    Posts
    1,968

    Default

    Yep forgot that trick. Here is an updated example using the relative naming. Now just rename the frame and your all set to go. Thanks Rob

    Again all you need to do to reskin this is to change the graphics to yours and rename the frame to one of your device paths. In fact once you have the graphics reskinnned you can copy and past the frames as many times as you like and just rename the frames to get all your light controls quickly.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	example-screenshot-3.jpg 
Views:	267 
Size:	8.6 KB 
ID:	5226  
    Attached Files Attached Files
    Last edited by jwilson56; June 25th, 2010 at 09:35 PM.
    John

    Now Playing skin creator

    Girder 5.0 / Elk-M1EZ8 / Ocelot / SECU-16IR /SECU-16I / SECU-16 / BobCat Humidity
    JRMC 11.1 / M-Audio Delta 410 / Xitel HIFI Pro / Xitel HIFI Link
    NetRemote 2.0 / 6 Zone whole house audio delivering 1580 watts RMS total
    ELO 15" Touchscreen, Nokia 770 and Advent 3500PC Mobile PC 7" TS
    Droid 2 Global

    Click here to visit my Nowplaying Showcase Blog

  3. #13

    Default

    I am a little confused here. I understand how to get this to work, but why can't we put the 'actions' where they belong, in the button's Actions tab (without having to write extra code ourselves)? It just makes more sense IMO.
    Last edited by etron; November 10th, 2008 at 07:48 AM.
    Reverse engineered from Martian technology.

  4. #14
    Join Date
    May 2004
    Posts
    2,589

    Default

    Even though I can now control my lights through Lua, I have yet to be able to figure out how to use this in a way that will give me the percentage of the light:

    Code:
    local device = DeviceManager:GetDeviceUsingLocationName ('Den\\Sconces')
    device:GetControlValue ('Level')
    Can someone please clarify how I could take the returned value and use it in another line of script? I've tried printing the table (device), but it generates a huge list of variables that includes what I assume to be everything from the device manager.

    Thanks in advance.
    Beware of the robot.

  5. #15
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default

    Try this

    Code:
    local device = DeviceManager:GetDeviceUsingLocationName ('Den\\Sconces')
    local level = device:GetControlValue ('Level')
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  6. #16
    Join Date
    May 2004
    Posts
    2,589

    Default

    Bingo! Thanks, Rick.
    Beware of the robot.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •