Announcement

Collapse
No announcement yet.

Event or Script to create a "Motion Log" ?

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

    Event or Script to create a "Motion Log" ?

    Goal: quickly & easily see the sequence of motion events in a given time period without messing with the HS Log, which is difficult to target specfics

    Thought I'd tap the collective before I create something myself.

    Anyone have anything that creates a Log File for specific devices (I just want Motion devices for now) that is viewable on the admin/console website - additional link or whatever to open a separate page or popup, etc?

    Thx!


    #2
    Have you tried tenHsEvents? You can filter it down to any devices you want to monitor.
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Originally posted by Uncle Michael View Post
      Have you tried tenHsEvents? You can filter it down to any devices you want to monitor.
      Didnt know it existed... thank you!

      but looking at it, it doesnt save a viewable log, which is what I want... I dont want realtime. I need for historical review and troubleshooting

      Comment


        #4
        Can you provide an example of the information you want to log and how you intend to do the troubleshooting? tenHsEvents can record events for several hours if you filter out highly repetitive things like timers and data logging events. How long after the fact do you want to do your reviews?
        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548, NUC i3

        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

        Comment


          #5
          I'd like to keep a running record, text log file, of motion - full time. This way I can quickly and easily pull up the file and review what motion sensors got triggered, in what order, based on date/time. If it is days ago or only seconds ago, it would be captured in log file. tenHSEvents would need to run 24x7 and see if he'd add a feature to log to a text file. Its probably more than I need... I may just write a script if I cant find anything easier.

          Comment


            #6
            I think a custom script sounds like the way to go. You could also take a look at the UltraLog plug-in and Jon00's database charting utility. (It allows you to define what you collect in the database. You don't have to chart it.) I suspect, though, that your application is sufficiently unique that doing it yourself is the best way to get what you want.
            Mike____________________________________________________________ __________________
            HS3 Pro Edition 3.0.0.548, NUC i3

            HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

            Comment


              #7
              Here's a simple script that I have been using to write to a log file:

              Code:
              Imports System.IO
              
              Sub Main(ByVal Parms As String)
              
                  Dim logName As String = "Log to File"               'set log type for HS log
                  Dim Debug As Boolean = False                        'set to True if the script give you errors and it will provide additional info in the HS3 log to help troubleshoot
              
                  Try
                      Dim ParmArray() As String = Split(Parms,"|")    'split parameter into an array
                      Dim refID As Integer = CInt(ParmArray(0))        'the first parameter is the reference id of the device    
                      Dim loggingFileName As String = ParmArray(1)    'the second parameter is the file name to log too
              
                      Dim CurDate As String = Now.ToString("yyyy-MM-dd")
                      Dim CurTime As String = Now.ToString("hh:mm:ss tt")
                      Dim CurValue As String = CStr(hs.DeviceValueEx(refID))
              
                      Dim mydocpath As String = hs.GetAppPath & "/data/" & loggingFileName & ".csv"
              
                      If Debug Then hs.writelog(logName,mydocpath)
                      If Debug Then hs.writelog(logName,CurDate & "," & CurTime & "," & CurValue)
              
                      Using outputFile As New StreamWriter(mydocpath, True)
                          outputFile.WriteLine(CurDate & "," & CurTime & "," & CurValue)
                      End Using
              
                  Catch ex As Exception
                      hs.WriteLog(logName, ex.Message)
                  End Try
              
              End Sub
              The script takes two parameters separated by a |, the reference ID of the device and the filename to use for the script. I have a similar script that logs to a SQLite database file.
              HS 4.2.8.0: 2134 Devices 1252 Events
              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

              Comment


                #8
                Originally posted by sparkman View Post
                Here's a simple script that I have been using to write to a log file:

                Code:
                Imports System.IO
                
                Sub Main(ByVal Parms As String)
                
                Dim logName As String = "Log to File" 'set log type for HS log
                Dim Debug As Boolean = False 'set to True if the script give you errors and it will provide additional info in the HS3 log to help troubleshoot
                
                Try
                Dim ParmArray() As String = Split(Parms,"|") 'split parameter into an array
                Dim refID As Integer = CInt(ParmArray(0)) 'the first parameter is the reference id of the device
                Dim loggingFileName As String = ParmArray(1) 'the second parameter is the file name to log too
                
                Dim CurDate As String = Now.ToString("yyyy-MM-dd")
                Dim CurTime As String = Now.ToString("hh:mm:ss tt")
                Dim CurValue As String = CStr(hs.DeviceValueEx(refID))
                
                Dim mydocpath As String = hs.GetAppPath & "/data/" & loggingFileName & ".csv"
                
                If Debug Then hs.writelog(logName,mydocpath)
                If Debug Then hs.writelog(logName,CurDate & "," & CurTime & "," & CurValue)
                
                Using outputFile As New StreamWriter(mydocpath, True)
                outputFile.WriteLine(CurDate & "," & CurTime & "," & CurValue)
                End Using
                
                Catch ex As Exception
                hs.WriteLog(logName, ex.Message)
                End Try
                
                End Sub
                The script takes two parameters separated by a |, the reference ID of the device and the filename to use for the script. I have a similar script that logs to a SQLite database file.
                Old thread, sorry. Could you post the code for writing to an sqlite database? I have been creating my own log files for some time now but thought it deserved an upgrade from txt files. Thanks.

                Comment


                  #9
                  You should check mcsMQTT plugin. It will push user selected HS devices/data to a database ( InfluxDB or MySQL). You can then use Grafana to track everything in a table or customizable charts.

                  Comment

                  Working...
                  X