Announcement

Collapse
No announcement yet.

Where to look for trouble with running an event?

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

    Where to look for trouble with running an event?

    I took advice from another thread and created a startup and shutdown timer to monitor when HS starts and stops.
    Everything was working fine until I upgraded the PC HS runs on.
    Now it takes about 40 seconds to reboot and for some reason the shutdown timer event doesn't run properly.

    From the log:
    Code:
    1/23/2023 12:57:57 HomeSeer Shutdown Shutdown Script Completed
    1/23/2023 12:57:57 HomeSeer Event Event Trigger "Timers Shutdown Timer"
    1/23/2023 12:57:56 HomeSeer Shutdown Running shutdown script ...ā€‹
    But the event:
    Click image for larger version

Name:	event.png
Views:	97
Size:	12.9 KB
ID:	1588406

    And the timers themselves:
    Click image for larger version

Name:	timers.png
Views:	85
Size:	8.4 KB
ID:	1588407

    The thing is is does run sometimes, that's how I know it takes 40 seconds to reboot but it hasn't been working for a little while now.

    And the actual event:
    Click image for larger version

Name:	event2.png
Views:	84
Size:	15.0 KB
ID:	1588408

    #2
    You can turn on debug event logging with:

    hs.debugmode=2

    I'm not sure if that will help narrow it down or not though...
    HS4Pro Running on a Raspberry Pi4
    67 Z-Wave Nodes, 111 Events, 422 Devices
    Z-Wave, UPB, WiFi
    Plugins: EasyTrigger, weatherXML, OMNI, Z-Wave, Tuya, Device History
    HSTouch Clients: 3 Android, 1 Joggler

    Comment


      #3
      Where are you restarting the timer? The timing is critical because HS stops processing Events almost immediately after shutdown is initiated. I reset the timer at the top of my shutdown script with a scripting statement and immediately call a cleanup Event. My cleanup Event is simple with only a couple of actions.

      Code:
      Imports System.Diagnostics
      
      Sub Main(Parm As Object)
      
      hs.TimerReset("HS Downtime")
      hs.triggerevent("ShutdownCleanup")
      hs.WriteLog("Shutdown", "(RAPShutdown.vb script) Scripting is OK and is now running RAPShutdown.vb")
      
      'Process.GetProcessesByName("HS4Sentry")(0).Kill()
      
      ' Speak - comment the next line if you do not want HomeSeer to speak at shutdown
      ' hs.Speak("Home-Seer has been shut down", True, "$SONOS$ALERT$")
      hs.RunScriptFunc ("Maximum Uptime.vben","LastRun","",True,True)
      
      End Sub
      ā€‹
      HS4 Pro, Windows 10 pro

      Comment


        #4
        As shown in the picture, I set it to 0 first, then start it in the event.
        If you're saying that won't work then neither would the timer itself since that's also in the event.

        I just tried the reset in the script and it still didn't work, although the log still says it ran.
        Also, running the event manually does work.

        Comment


          #5
          Iā€™m out of ideas. The method I use works reliably here and I have added the same logic to several other systems for friends. It works for them as well. I reset the timer in the script and start it in the cleanup event. The call in the script is redundant since starting a timer starts it at 0.
          HS4 Pro, Windows 10 pro

          Comment


            #6
            Started noticing a few other things that weren't working right, even posted about the speak.sh trouble where the files attributes weren't set correctly so I reinstalled HS and all is good again.
            Thanks for the effort though!
            Especially since you were the one who gave me the shutdown timer idea.

            Comment


              #7
              randy Are you running any Linux systems that use the shutdown script?
              I thought it was fixed but it's not running events again. Tried on 2 other Linux systems and they don't run events or control devices from the shutdown script either.

              Comment


                #8
                I only run Windows.
                HS4 Pro, Windows 10 pro

                Comment

                Working...
                X