Announcement

Collapse
No announcement yet.

UltraLog Update Broke Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UltraLog Update Broke Script

    UJ, the latest update from the updater now results in the following errors occuring in my logs:
    <table border="0" cellpadding="0" cellspacing="2" width="100%"><tbody><tr><td colspan="1" class="LOGDateTime1" align="left" nowrap="nowrap">2012/06/19 05:55:40 PM </td><td colspan="3" class="LOGType1" align="left"> Error </td><td colspan="8" class="LOGEntry1" align="left">Scripting runtime error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --- System.ArgumentException: Column 'Log_Data' does not belong to table . at System.Data.DataRow.GetDataColumn(String columnName) at System.Data.DataRow.get_Item(String columnName) at System.Data.DataTableReader.get_Item(String name) at scriptcode3.scriptcode3.getError(Object Parms) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Scheduler.VsaScriptHost.Invoke(String ModuleName, String MethodName, Object[] Arguments)</td></tr> <tr> <td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">2012/06/19 05:55:40 PM </td><td colspan="3" class="LOGType0" align="left"> UltraLog Error </td><td colspan="8" class="LOGEntry0" align="left">An unexpected error occured in the ExecuteSQL() function/subroutine: [System.IndexOutOfRangeException: Cannot find table 0. at System.Data.DataTableCollection.get_Item(Int32 index) at HSPI_ULTRALOG.HSPI.ExecuteSQL(String strSQL, Int32& iRecordCount, Int32 iPageSize, Int32& iPageCount, Int32& iPageCur)]</td></tr></tbody></table>
    <table border="0" cellpadding="0" cellspacing="2" width="100%"><tbody><tr><td colspan="8" class="LOGEntry1" align="left">
    </td></tr><tr><td colspan="1" class="LOGDateTime0" align="left" nowrap="nowrap">
    </td><td colspan="3" class="LOGType0" align="left">
    </td><td colspan="8" class="LOGEntry0" align="left">
    </td></tr></tbody></table>
    Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

    #2
    Gavin,

    What script did it break?

    Reading your post convinced me to install the update as its been a while since I have updated Ultralog. I also installed it on HS box #2 from scratch.

    None the less I saw no errors with the updater/update on HS box #1 nor any with the new install on HS box #2.

    Prior to update though I did backup the HS directory just in case it did cause an issue.
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

    HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

    Comment


      #3
      I use a script to get the latest error HS posted from the database and set a device to that error for mail/reportng purposes.

      Code:
       Public Sub getError(ByVal Parms As Object)
      
              If v_isDebug Then
                  'log raw information passed to script for debug purposes
                  hs.WriteLog(v_logging_name, "Public Sub Main(): " & Parms)
              End If
      
      
              'create a plug-in reference
              Dim hspi As Object = hs.plugin("ultralog")
              Dim pageSize As Integer = 25
              Dim pageCur As Integer = 1
      
      
              'the following are called by reference and are updated based on results
              Dim pageCount As Integer = 1
              Dim recordCount As Integer = 0
              Dim strSQL = "SELECT TOP 1 * FROM tblLog WHERE Log_Type LIKE '%Error%' ORDER BY ID DESC"
              Dim varDataTable As DataTable = hspi.ExecuteSQL(strSQL, recordCount, pageSize, pageCount, pageCur)
      
      
              Dim varDataTableReader As DataTableReader = varDataTable.CreateDataReader
      
              If varDataTableReader.HasRows Then
                  While varDataTableReader.Read
                      If v_isDebug Then
                          hs.WriteLog(v_logging_name, varDataTableReader("Log_Data").ToString & " [" & varDataTableReader("Log_Type").ToString & "] " & varDataTableReader("Log_Date").ToString)
                      End If
                      'update the status string of the Error device
                      hs.SetDeviceString(varStatusError, varDataTableReader("Log_Data").ToString, True)
                  End While
              End If
      
      
          End Sub
      Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

      Comment


        #4
        Gavin,

        Ran the script and get these errors:

        Code:
        6/21/2012 10:46:42 AM  - Event - Running script and waiting: gavin-test.vb
        6/21/2012 10:46:42 AM  - Error - Script compile error: Name 'v_isDebug' is not declared.on line 16
        6/21/2012 10:46:42 AM  - SCR - Option Strict Offimports Schedulerimports SystemPublic Module scriptcode31#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin	<System.ContextStaticAttribute()> Public WithEvents hs As Scheduler.hsapplication	<System.ContextStaticAttribute()> Public WithEvents hsp As scheduler.hsp	<System.ContextStaticAttribute()> Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionPublic Sub getError(ByVal Parms As Object)        If v_isDebug Then            log raw information passed to script for debug purposes            hs.WriteLog(v_logging_name, "Public Sub Main(): " & Parms)        End If        'create a plug-in reference        Dim hspi As Object = hs.plugin("ultralog")        Dim pageSize As Integer = 25        Dim pageCur As Integer = 1        'the following are called by reference and are updated based on results        Dim pageCount As Integer = 1        Dim recordCount As Integer = 0        Dim strSQL = "SELECT TOP 1 * FROM tblLog WHERE Log_Type LIKE '%Error%' ORDER BY ID DESC"        Dim varDataTable As DataTable = hspi.ExecuteSQL(strSQL, recordCount, pageSize, pageCount, pageCur)        Dim varDataTableReader As DataTableReader = varDataTable.CreateDataReader        If varDataTableReader.HasRows Then            While varDataTableReader.Read                If v_isDebug Then                    hs.WriteLog(v_logging_name, varDataTableReader("Log_Data").ToString & " [" & varDataTableReader("Log_Type").ToString & "] " & varDataTableReader("Log_Date").ToString)                End If                'update the status string of the Error device                hs.SetDeviceString(varStatusError, varDataTableReader("Log_Data").ToString, True)            End While        End If    End Sub   End Module
        and

        Code:
        6/21/2012 10:45:20 AM  - Event - Running script and waiting: gavin-test.vb
        6/21/2012 10:45:20 AM  - Error - Script compile error: Type 'DataTable' is not defined.on line 32
        6/21/2012 10:45:20 AM  - SCR - Option Strict Offimports Schedulerimports SystemPublic Module scriptcode30#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin	<System.ContextStaticAttribute()> Public WithEvents hs As Scheduler.hsapplication	<System.ContextStaticAttribute()> Public WithEvents hsp As scheduler.hsp	<System.ContextStaticAttribute()> Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End RegionPublic Sub getError(ByVal Parms As Object)        'If v_isDebug Then            'log raw information passed to script for debug purposes            'hs.WriteLog(v_logging_name, "Public Sub Main(): " & Parms)        'End If        'create a plug-in reference        Dim hspi As Object = hs.plugin("ultralog")        Dim pageSize As Integer = 25        Dim pageCur As Integer = 1        'the following are called by reference and are updated based on results        Dim pageCount As Integer = 1        Dim recordCount As Integer = 0        Dim strSQL = "SELECT TOP 1 * FROM tblLog WHERE Log_Type LIKE '%Error%' ORDER BY ID DESC"        Dim varDataTable As DataTable = hspi.ExecuteSQL(strSQL, recordCount, pageSize, pageCount, pageCur)        Dim varDataTableReader As DataTableReader = varDataTable.CreateDataReader        If varDataTableReader.HasRows Then            While varDataTableReader.Read                If v_isDebug Then                    hs.WriteLog(v_logging_name, varDataTableReader("Log_Data").ToString & " [" & varDataTableReader("Log_Type").ToString & "] " & varDataTableReader("Log_Date").ToString)                End If                'update the status string of the Error device                hs.SetDeviceString(varStatusError, varDataTableReader("Log_Data").ToString, True)            End While        End If    End Sub   End Module
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

        HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
        HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

        Comment


          #5
          Sorry Pete, here's the whole script that should run, but still throws SQL errors for me.

          Code:
          Imports System.Data
          
          
              '==============================================================================================
              ' script interacts with the ultraLog plug-in database
              ' Rev 2010-12-23
              '==============================================================================================
          
              'Example for use within a vb script:
              'hs.RunEx("ultraLog.vb","getError","",True)
          
          
              '==============================================================================================
              '   Constant declarations.
              '==============================================================================================
              Const v_logging_name = "UltraLog Scripts"                'Logging / Script Name
              Const v_isDebug As Boolean = True                       'Set the DEBUG status
              Const varStatusError As String = "X5"                   'Device to hold most recent Error 
              Const varStatusWarning As String = "X6"                 'Device to hold most recent Warning  
              '==============================================================================================
          
          
              Public Sub Main(ByVal Parms As Object)
              End Sub
          
          
          
          
              'get the most recent error from the log
              Public Sub getError(ByVal Parms As Object)
          
                  If v_isDebug Then
                      'log raw information passed to script for debug purposes
                      hs.WriteLog(v_logging_name, "Public Sub Main(): " & Parms)
                  End If
          
          
                  'create a plug-in reference
                  Dim hspi As Object = hs.plugin("ultralog")
                  Dim pageSize As Integer = 25
                  Dim pageCur As Integer = 1
          
          
                  'the following are called by reference and are updated based on results
                  Dim pageCount As Integer = 1
                  Dim recordCount As Integer = 0
                  Dim strSQL = "SELECT TOP 1 * FROM tblLog WHERE Log_Type LIKE '%Error%' ORDER BY ID DESC"
                  Dim varDataTable As DataTable = hspi.ExecuteSQL(strSQL, recordCount, pageSize, pageCount, pageCur)
          
          
                  Dim varDataTableReader As DataTableReader = varDataTable.CreateDataReader
          
                  If varDataTableReader.HasRows Then
                      While varDataTableReader.Read
                          If v_isDebug Then
                              hs.WriteLog(v_logging_name, varDataTableReader("Log_Data").ToString & " [" & varDataTableReader("Log_Type").ToString & "] " & varDataTableReader("Log_Date").ToString)
                          End If
                          'update the status string of the Error device
                          hs.SetDeviceString(varStatusError, varDataTableReader("Log_Data").ToString, True)
                      End While
                  End If
          
          
              End Sub
          Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

          Comment


            #6
            Tested it on the two boxes with most current Ultralog. Different versions of HS on each; IE; V20 and V49. Errors on one.
            There is much more data on Homeseer Pro V.20 and only a few weeks of data on Homeseer Standard V.49.

            Homeseer Pro V.20

            6/25/2012 7:02:58 AM Event Event Trigger "Gavin Test"
            6/25/2012 7:02:58 AM Event Running script and waiting: gavin.vb
            Homeseer Standard V.49

            6/25/2012 7:12:01 AM Event Event Trigger "Gavin Test"
            6/25/2012 7:12:01 AM Event Running script and waiting: gavin.vb
            6/25/2012 7:12:01 AM Error Script compile error: Type 'DataTable' is not defined.on line 61
            6/25/2012 7:12:01 AM SCR Option Strict OffImports System.Dataimports Schedulerimports SystemPublic Module scriptcode4#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End Region '=========================================================== =================================== ' script interacts with the ultraLog plug-in database ' Rev 2010-12-23 '=========================================================== =================================== 'Example for use within a vb script: 'hs.RunEx("ultraLog.vb","getError","",True) '=========================================================== =================================== ' Constant declarations. '=========================================================== =================================== Const v_logging_name = "UltraLog Scripts" 'Logging / Script Name Const v_isDebug As Boolean = True 'Set the DEBUG status Const varStatusError As String = "X5" 'Device to hold most recent Error Const varStatusWarning As String = "X6" 'Device to hold most recent Warning '=========================================================== =================================== Public Sub Main(ByVal Parms As Object) End Sub 'get the most recent error from the log Public Sub getError(ByVal Parms As Object) If v_isDebug Then 'log raw information passed to script for debug purposes hs.WriteLog(v_logging_name, "Public Sub Main(): " & Parms) End If 'create a plug-in reference Dim hspi As Object = hs.plugin("ultralog") Dim pageSize As Integer = 25 Dim pageCur As Integer = 1 'the following are called by reference and are updated based on results Dim pageCount As Integer = 1 Dim recordCount As Integer = 0 Dim strSQL = "SELECT TOP 1 * FROM tblLog WHERE Log_Type LIKE '%Error%' ORDER BY ID DESC" Dim varDataTable As DataTable = hspi.ExecuteSQL(strSQL, recordCount, pageSize, pageCount, pageCur) Dim varDataTableReader As DataTableReader = varDataTable.CreateDataReader If varDataTableReader.HasRows Then While varDataTableReader.Read If v_isDebug Then hs.WriteLog(v_logging_name, varDataTableReader("Log_Data").ToString & " [" & varDataTableReader("Log_Type").ToString & "] " & varDataTableReader("Log_Date").ToString) End If 'update the status string of the Error device hs.SetDeviceString(varStatusError, varDataTableReader("Log_Data").ToString, True) End While End If End SubEnd Module
            - Pete

            Auto mator
            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

            HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
            HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

            X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

            Comment


              #7
              Upgraded/downgraded such that both HS Pro / HS Standard are identical versions (44). Same results as above with the older HSPro running the script fine and the newer HS Standard erroring out (very light database at this time).
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

              HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
              HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

              Comment


                #8
                Tested script again this morning with both of the instances of Homeseer (V44) and it worked fine this morning showing the following on the two boxes.
                The only changes over the last few days were a downgrade of the HS standard to V.44 and an upgrade of the HS Pro to V.44 from V.20.
                Note in the above post I tried it and it still was erroring out. Now its been a few days (more data?)

                Code:
                6/27/2012 2:01:17 PM  Event  Event Trigger "Gavin Test" 
                6/27/2012 2:01:17 PM  Event  Running script and waiting: gavin.vb
                - Pete

                Auto mator
                Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

                HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                Comment


                  #9
                  Pete, are you using SQL as your database?
                  Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin

                  Comment


                    #10
                    Yes; SQLite.
                    Attached Files
                    - Pete

                    Auto mator
                    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

                    HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
                    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

                    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

                    Comment

                    Working...
                    X