Announcement

Collapse
No announcement yet.

Timers and system restart question

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

    Timers and system restart question

    After a powerfail, I want to be able to send an email that the system restarted and how long it was down. It is working except for the downtime timer.

    Here is the way I thought I would do it. Better ways welcomed!

    Create a timer called HS3_DownTime from the web interface.

    Start it in an event triggered from startup.vb

    Another event resets the timer to zero after it reaches 1 minute. That is working fine.

    So I thought that would give me a timer that would reflect, +1 minute, the time down.

    However, it looks as though the timer, in startup.vb, has a value of zero (before being reset). I'm suspecting it did not live thru the restart.

    Is this the way timers work? If so, any way to make them live? I might could create a virtual device and work it out that way since devices to live thru a restart. Unfortunately, I'm not a scripter which I suspect would be needed to get the time back out of the device and calculate the downtime.

    #2
    One Option

    You could use my Cumulative uptime monitor for this.

    Download and use the following for the [Device1] entry in the Jon00UptimeHS3.ini:

    PHP Code:
    [Device1]
    Title=Homeseer downtime
    TextBeforeValue
    =
    TextAfterValue=
    TimeStringFormat=1
    ShowTriggers
    =0
    ShowCounter
    =0
    TriggerValueUnit
    =1
    DeviceValueUnit
    =1
    TriggerValue1
    =
    TriggerValue2=
    TriggerValue3=
    Device=
    DeviceOnRange
    Add the following to your startup.vb script:

    PHP Code:
    hs.RunscriptFunc("Jon00UptimeHS3.vben","Main","1;0",False,False
    This will stop the timer.

    Add the following to your shutdown.vb script:

    PHP Code:
    hs.RunscriptFunc("Jon00UptimeHS3.vben","Main","1;Reset|1;1",False,False
    This will reset and start the timer.

    That's it. You will get the result in a virtual device which you can time format as you wish.

    I would run the script whilst Homeseer is running so that the virtual device is created.
    Attached Files
    Jon

    Comment


      #3
      Originally posted by logbuilder View Post
      After a powerfail, I want to be able to send an email that the system restarted and how long it was down. It is working except for the downtime timer.

      Here is the way I thought I would do it. Better ways welcomed!

      Create a timer called HS3_DownTime from the web interface.

      Start it in an event triggered from startup.vb

      Another event resets the timer to zero after it reaches 1 minute. That is working fine.

      So I thought that would give me a timer that would reflect, +1 minute, the time down.

      However, it looks as though the timer, in startup.vb, has a value of zero (before being reset). I'm suspecting it did not live thru the restart.

      Is this the way timers work? If so, any way to make them live? I might could create a virtual device and work it out that way since devices to live thru a restart. Unfortunately, I'm not a scripter which I suspect would be needed to get the time back out of the device and calculate the downtime.
      Timers do live through restarts. I have a few right now that are in that situation. I've never tried accessing them in the startup script and am wondering if HS is not quite finished re-initializing them at that point or that your event to reset it has already triggered at that point. Can you post your code and events associated with this?

      Cheers
      Al
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        Got it working. I learned I needed to add a delay before restarting the timer. Works dandy. My place is highly prone to power fails and if I am not there, it gives me an idea of whether the power fail was long enough to be concerned about frig and freezer.

        Thanks much.

        Comment


          #5
          Originally posted by logbuilder View Post
          Got it working. I learned I needed to add a delay before restarting the timer. Works dandy. My place is highly prone to power fails and if I am not there, it gives me an idea of whether the power fail was long enough to be concerned about frig and freezer.



          Thanks much.


          So, do you add the startup script?

          Comment


            #6
            Originally posted by TechFan View Post
            So, do you add the startup script?
            I changed the startup script to trigger my own 'System Restart' event.

            Comment

            Working...
            X