Results 1 to 3 of 3

Thread: Using Lua to trigger actions?

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Posts
    21

    Default Using Lua to trigger actions?

    Hi,

    I'm currently attempting to configure Girder with Sage to control external set-top boxes via infrared (USBUIRT) when it desires the video source to change channels. (I know I can do this directly from Sage, but desire Girder involved for other event handling)

    I've successfully configured exemultituner, and have girder seeing the change-channel events from sage as a Girder Event. happy day...

    However, since the channels selected come through as complete numbers (i.e., I could receive a "5" for channel 5, or a "607" for a different channel) I believe that I need to build a lua script to, upon the exemultituner event, pass the channel number to a lua script, which would parse it and send the IR actions.

    I.e., it should be able to call the IR actions for "6", "0", "7" and "ENTER" when Sage says "change_channel" "607"

    All this sounds conceptually within Girder's ability, but after a couple of days of hard reading and experimentation, I'll be darned if I can figure out how to trigger a Girder Action (such as a learned IR "Transmit IR Command" action) from a lua script. (I can certainly see that I can cause an Event to occur - but the lua script is *responding* to an event, and needs to *cause* an action)

    Is this possible? Or is this done a different way? Sorry if this is trivial, I've searched a *lot* and read the lua reference a lot before posting...

    Thanks!

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

    Default

    You can use gir.TriggerEvent() to do this - see the manual for the full details.

    One thing to note is that you will almost certainly need a small delay (100ms will probably be sufficient) between the digits for this to work successfully when you have repeated digits. My preferred way of doing this is to use macros for each digit with the IR action and a Wait action.
    --Rob

  3. #3
    Join Date
    Jan 2000
    Location
    Jupiter, FL
    Posts
    11,349

    Default

    To expand a bit on Robs answer.

    1. If you must use Lua for processing then you can either have Lua generate an NEW event which is hooked to the macro that handles sending out the various IR codes

    -or-

    2. Use usbuirt.TransmitIR( <string> ) directly from lua!

    The <string> will hold a CCF formatted IR code. You can get this from the Learned IR command in an action (after which the action is no longer needed).
    Ron
    No support through PM

Posting Permissions

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