MLDirecTVIP and MLScripts

Repository of MainLobby Server plug-ins and updates not available in the current installation.
MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

MLDirecTVIP and MLScripts

Postby MurrayW » Mon Jan 31, 2011 5:28 pm

Other than testing, I haven't converted over from serial control to IP control, but plan to do that soon. Before I put the work in to do that, I want to try to determine what is causing my current problem (see below).

I do have scenes on a tablet PC for the DirecTV buttons, but 99% of the control of DirecTV is with the DirecTV remote and a USB-UIRT. My 5 DVR's are connected to an AVAtrix matrix switcher. At some point, I plan to integrate my Oppo blue ray player and roku into the mix and want to use the same remote (probably DirecTV remote since that is the one everyone is used to) to control their basic features.

I figured a script was probably the easiest way to handle things instead of putting all the conditionals in the MLUSBUirt macro. I plan to set a variable named source_type or something like that which would take on the value of DirecTV, Oppo or Roku based on which source has been selected then have the script read the source_type variable and send the appropriate command for the active source.

Here's my current script for serial control of DirecTV (no source_type branching yet).

Code: Select all

' MLServer Command Reference
'  MLServer.cmdReceive command - allows you to send MLServeCmd's back to the server
'  MLServer.cmdReceivePush command - allows you to push a MLServeCmd onto the MLServer command queue
'  MLServer.SetVariable variable, value - allows you to set MLServer variables
'  MLServer.GetVariable variable - allows you to get the value of the specified MLServer variable
'  MLServer.DelVariable variable, value - allows you to delete MLServer variables
'  MLServer.LogMLEvent sName, sEvent - allows you to add an entry in the MLServer Event Log
'  MLServer.doPlugin PluginName, PluginCommand, PluginParameters, ClientName

Sub DirecTV(params)

    Dim MySource
    Dim NewSource
    Dim MyDVR
    Dim NewDVR
    Dim DVRType
    Dim MyDirecTVParam1
    Dim MyDirecTVParam2
    Dim tmpStr

   
   MySource = MLServer.GetVariable("avatrix_source_main")

   Select Case MySource
     Case "1"
        'HR20-700 #3
        MyDVR = 3
        DVRType = "DTV"
        NewDVR = 4
        NewSource = 2
    Case "2"
        'HR21-100 #1
        MyDVR = 4
        DVRType = "DTV"
        NewDVR = 5
        NewSource = 3
    Case "3"
        'HR24-500 #1
        MyDVR = 5
        DVRType = "DTV"
        NewDVR = 1
        NewSource = 6
    Case "4"
        'Need to Add Logic for Oppo BDP
        NewSource = 6
        NewDVR = 1
    Case "5"
        'HR20-700 #2
        MyDVR = 2
        DVRType = "DTV"
        NewDVR = 3
        NewSource =1
    Case "6"
        'HR20-700 #1
        MyDVR = 1
        DVRType = "DTV"
        NewDVR = 2
        NewSource = 5
  End Select

MyDirecTVParam1 = params(1)
MyDirecTVParam2 = params(2)

If MyDirecTVParam2 = "Active" Then
    'Set variable avatrix_source_main to new source and dvrnbr to new dvr
     MLServer.SetVariable "avatrix_source_main", NewSource
     MLServer.SetVariable "dvrnbr", MyDVR
    'Toggle to a new input on the AVAtrix
    tmpStr = "MLServeCmd.MLMatrixSwitcher|1~Switch~Main~" & NewSource & "~0"
Else
    'Need to add DirecTiVo IR control commands
    'If DVRType = "DTV" then
    'If Ubound(params) =3 then
    tmpStr = "MLServeCmd.MLDirectv|00" & MyDVR & "~" & MyDirecTVParam1 & "~" & MyDirecTVParam2
    'Else
        ' tmpStr = "MLServeCmd.MLDirectv|00" & MyDVR & "~" & MyDirecTVParam
    'End if
 End If
   
MLServer.cmdReceive tmpStr

The problem that I have is periodically (probably about once every few minutes) I get no response for 15 to 20 seconds then DVR will continue responding until the next unresponsive period begins again. I have checked my event log and it appears that the USBUIRT commands are being sent as soon as I press the keys on the remote. It is not a DirecTV of MLDirecTV serial problem because in my script I use the "active" button to toggle between inputs on my AVAtrix and during these periods of unresponsiveness the AVAtrix doesn't respond to the "active" key presses on my remote either. Does the script receive lower processing priority to other ML activities that may be going on at the same time causing it to not respond? Is there something in my script that would cause it to work x number of times correctly, then stop responding?

Any help or suggestions would be appreciated.

thanks,
Murray

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: MLDirecTVIP and MLScripts

Postby CinemarDave » Mon Jan 31, 2011 6:07 pm

All MLServer commands are treated at the same priority. So that is not the source. You would have to closely examine all the event logs that are in play to trace the command processing to see where the delay is introduced.

MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

Re: MLDirecTVIP and MLScripts

Postby MurrayW » Tue Feb 01, 2011 10:53 am

Dave, I think I have it narrowed down to the USBUirt. The following is what I did last night...please see if you would come to the same conclusion.

1. Watched the event log for MLScripts. Everytime that the DVR responded to a remote press, I got an entry saying the script ran. When the DVR was unresponsive, I got nothing in the script log.
2. Next started watching the MLServer event log. Same thing as with the MLScript log. Saw entries when the DVR responded, but none when it did not.
3. The final step was to watch the USBUirt event log. Saw commands logged when the DVR was responsive, but nothing when the DVR became unresponsive. Since this is the first step in the process and nothing was happening during this unresponsive period, it seems to me that this is where the problem is originating. Unfortunately, I had some impatient family members who wanted to watch TV rather than watching my troubleshooting, so I did not get to try the final step in what should incriminate the USBUirt beyond a doubt. I'll do that tonight. When the remote becomes unresponsive, I need to use my DVR control scene on my touchscreen to see if commands go through when sent from the tablet. It calls the script directly and bypasses the USBUirt.

I went to MLInstaller to see if I had the latest MLUSBUIRT and the installer says the local version is 0.0.0.0 and the released version is 1.6.20.0. I downloaded and installed this plugin and during the installation it asked me if I wanted to overwrite uuirtdrv.dll since I had a newer version. I saved a copy of my file and said yes to overwrite. The version that got installed had a creation date of 2/21/2006 and my version was 1/9/2007. Which version should I be using? After downloading and installing the released version, MLInstaller still shows my current version as 0.0.0.0, but when I go into MLServer the version shows as 1.6.20.0. Do you know why this is?

My next steps tonight after verifying that the script runs from the touchscreen during the periods of unresponsiveness, is to uninstall the USBUirt both from windows and MLServer and start over. I'll have the saved copy of my USBUIRT.mdb so I don't lose all my macros.

Murray

MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

Re: MLDirecTVIP and MLScripts

Postby MurrayW » Wed Feb 02, 2011 12:19 pm

Here is what I did last night.
1. Set my USBUirt to flash when it received an IR signal so I could see if it was receiving during these periods of inactivity. The USBUirt flashed every time I sent an IR signal its way, both when the DVR was responding and when it wasn't.
2. Contrary to what I saw the previous night, the MLUSBUirt event log showed that the IR was received and the macro executed during the periods of inactivity!
3. During the periods of inactivity, I tried pressing buttons on my touchscreen that call the script directly without going through the MLUSBUirt macro. The DVR did not respond to the touchscreen attempts the same as it doesn't respond to the remote key presses.
4. A few times after coming out of the inactivity period, the DVR would respond to 5 to 10 IR commands (or touchscreen commands) that had been ignored during the period of no activity. I had seen this behavior in the past, but not during the previous night's testing.
5. I looked at the MLScript event log and it appears that there were some events logged during the inactivity periods and a few times there were errors logged. Dave, can you tell me what the error in the attached log means?

Code: Select all

CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM:
DoCmd Error #-2147467259 - Cannot call this method while the script is executing.
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
CMD: DirecTV_Command~DirecTV~0~Key~Down FROM: Fuj3500-1
Most of these events were logged when there was no response. The Fuj3500-1 is when sending the script directly from the touchscreen and the others with the blank FROM are from my remote calling the script through MLUSBUirt. The last 14 successful commands in the log are commands that were executed once the DVR began responding again and from button presses many seconds previous while the DVR was unresponsive.

So from tonight's testing, it appears that the USBUirt is not the problem and it may have something to do with the script execution. I am did install the 2/21/2006 version of uuirtdrv.dll that comes with MLInstaller rather than the newer version I had on my system with a date of 1/9/2007.

thanks,
Murray

MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

Re: MLDirecTVIP and MLScripts

Postby MurrayW » Thu Feb 03, 2011 6:31 pm

Dave, what does error 2147467259 in my previous post mean?
thanks,
Murray

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: MLDirecTVIP and MLScripts

Postby CinemarDave » Thu Feb 03, 2011 6:40 pm

You tried to call a script that was already running. VBScript cannot do that. Can you insert some delays between calls or set some wait flags?

MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

Re: MLDirecTVIP and MLScripts

Postby MurrayW » Thu Feb 03, 2011 7:05 pm

CinemarDave wrote:You tried to call a script that was already running. VBScript cannot do that. Can you insert some delays between calls or set some wait flags?
I guess I was too fast on the remote button press. I would have thought that the delay in MLUSBUIRT would be long enough to keep the script from trying to run again before the first one ended.

Anyway, I am moving on to IP control and will no longer be using this script, but at some point I will want to revisit using a script so I can use the same remote for controlling various devices and have the script branch off to a different location based on what the source type is. But by the time I do that, I am going to be migrating MLServer to a new machine and hopefully the new install and a new script will end this problem.

I just wanted to verify that there is no reason why I should not be able to use a script that just sets a few MLServer variables and sends a MLCmd being called by a macro from the USBUirt after it receives an IR signal and expect immediate response from the DVR.

thanks,
Murray


Return to “MLServer Plug-Ins”

Who is online

Users browsing this forum: No registered users and 1 guest