Announcement

Collapse
No announcement yet.

What is best way to detect event stopping by computer reboot

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

  • What is best way to detect event stopping by computer reboot

    Can anyone help with an event (not sure I can use event) or a script that would detect an event being interrupted by the computer being re-booted?
    During a watering cycle last night somehow the computer was re-booted in the middle of it and of course it never finished. It had to be MSoft even though I have set the time for updates in the AM!

    Is there a way to know if this happens? thanks

  • #2
    The application/plugin/script that is running needs to have logic that can detect its state at time of startup and know if it should continue at some point. mcsSprinklers records it state every minute for situations like this and any other unexpected event.

    Comment


    • #3
      Click image for larger version  Name:	image_69949.png Views:	1 Size:	37.7 KB ID:	1197534
      Originally posted by cowinger View Post
      Can anyone help with an event (not sure I can use event) or a script that would detect an event being interrupted by the computer being re-booted?
      During a watering cycle last night somehow the computer was re-booted in the middle of it and of course it never finished. It had to be MSoft even though I have set the time for updates in the AM!

      Is there a way to know if this happens? thanks
      The only way I know of is to trigger an event when the system starts up through your startup script. That is the only time HomeSeer can execute actions. I have these lines in my startup script:

      hs.triggerevent("StartupCleanup") this runs an event immediately
      hs.DelayTrigger (60, "StartupCleanupDelayed") this runs an Event with a delay

      These two lines call Events named "StartupCleanup" and "StartupCleanupDelayed". A single Event is all that is needed, but I chose to do it in two with a 60 second delay before launching the second. The first event does a couple of actions, starts my uptime timer and optionally sends me a pushover message. I have this message disabled for now.


      The second one is delayed by 60 seconds to give the system time for everything to get running then it takes care of getting everything synchronized with the time, sets virtual devices, polls Z-Wave devices, various other tasks and sends a Pushover message. You could also send an email or SMS message.

      You could either act on the system manually when you get the message, or you could have HomeSeer perform some action at startup that would stop your sprinkler program.

      Click image for larger version  Name:	image_69950.png Views:	1 Size:	118.4 KB ID:	1197535

      I also have a shutdown script that will execute when I ask for an orderly shutdown, but I found it only runs when I shutdown HomeSeer. Obviously on a disorderly shutdown (power or hardware failure) will not run it. This event could also send a Pushover (or email) notification.

      Click image for larger version  Name:	image_69948.png Views:	2 Size:	43.1 KB ID:	1197533
      Last edited by rprade; September 20th, 2018, 07:18 PM.
      Randy Prade
      Aurora, CO
      Prades.net

      PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

      Comment


      • #4
        Originally posted by Michael McSharry View Post
        The application/plugin/script that is running needs to have logic that can detect its state at time of startup and know if it should continue at some point. mcsSprinklers records it state every minute for situations like this and any other unexpected event.
        Thanks Michael, I will download a trial and take a look.

        Comment


        • #5
          Originally posted by rprade View Post
          The only way I know of is to trigger an event when the system starts up through your startup script. That is the only time HomeSeer can execute actions. I have these lines in my startup script:

          hs.triggerevent("StartupCleanup")
          hs.DelayTrigger (60, "StartupCleanupDelayed")

          The first event does a couple of actions, starts my uptime timer and optionally sends me a pushover message. I have this message disabled for now.

          [ATTACH]69949[/ATTACH]

          The second one is delayed by 60 seconds to give the system time for everything to get running then it takes care of getting everything synchronized with the time, sets virtual devices, polls Z-Wave devices, various other tasks and sends a Pushover message. You could also send an email or SMS message.

          You could either act on the system manually when you get the message, or you could have HomeSeer perform some action at startup that would stop your sprinkler program.

          [ATTACH]69950[/ATTACH]

          I also have a shutdown script that will execute when I ask for an orderly shutdown, but I found it only runs when I shutdown HomeSeer. When it is shutdown by the O/S for an update, it hasn't run the shutdown script. This event could also send a Pushover (or email) notification.

          [ATTACH]69948[/ATTACH]
          Thanks Randy, I can see how this script thing might be a little above my pay grade. All of those Then statements are intimidating. I am not sure where I would start. Would I start by polling the z-wave devices? But how would HS know where the event left off and how would it continue from where it left off? Sounds complicated.

          Comment


          • #6
            Originally posted by cowinger View Post
            Thanks Randy, I can see how this script thing might be a little above my pay grade. All of those Then statements are intimidating. I am not sure where I would start. Would I start by polling the z-wave devices? But how would HS know where the event left off and how would it continue from where it left off? Sounds complicated.
            The script thing could simply trigger a startup event. For your use the event could simply send a message letting you know the system had restarted. Then you could manually intervene with irrigation. I don't know how your sprinkler program works. Since my irrigation schedule is offloaded to the controller, it will continue to run even when HomeSeer is stopped. For that reason I do not need to do anything on a restart. When HomeSeer runs my Irrigation Event, a virtual device is updated, so it will always "know" when it last ran.

            In your original post you said "of course it never finished". What would you like to see happen. How is your irrigation controlled by HomeSeer? If you want it to continue where it left off, I'm sure you could figure a way or as Mike suggests, have a script update every minute or so as to what its status is. You could store it in a virtual device or text file.
            Randy Prade
            Aurora, CO
            Prades.net

            PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

            Comment


            • #7
              Originally posted by rprade View Post
              The script thing could simply trigger a startup event. For your use the event could simply send a message letting you know the system had restarted. Then you could manually intervene with irrigation. I don't know how your sprinkler program works. Since my irrigation schedule is offloaded to the controller, it will continue to run even when HomeSeer is stopped. For that reason I do not need to do anything on a restart. When HomeSeer runs my Irrigation Event, a virtual device is updated, so it will always "know" when it last ran.

              In your original post you said "of course it never finished". What would you like to see happen. How is your irrigation controlled by HomeSeer? If you want it to continue where it left off, I'm sure you could figure a way or as Mike suggests, have a script update every minute or so as to what its status is. You could store it in a virtual device or text file.
              I have the GoControl Sprinkler unit. It is controlled by HS through an event that turns the valves on/off. You said a script could be used to run an event that would alert me. That would work. Are there any scripts out there that I could copy that will do that? You said it could be included in the startup script in HS, right? I think I can figure out how to write the event, maybe. thanks

              EDIT: Ok, so would I create like a subroutine in the start.vb file that would call an event if HS is rebooted? Then create an event called ex. HSreboot, put that name in the sub as to be called and the event would be named that and if manually triggered, then do this? Am I close?
              Last edited by cowinger; July 14th, 2018, 01:43 PM.

              Comment


              • #8
                Originally posted by cowinger View Post
                I have the GoControl Sprinkler unit. It is controlled by HS through an event that turns the valves on/off. You said a script could be used to run an event that would alert me. That would work. Are there any scripts out there that I could copy that will do that? You said it could be included in the startup script in HS, right? I think I can figure out how to write the event, maybe. thanks
                All you need is a single line added to your Startup.vb script. This is mine. (I cleverly named my event 'Startup Stuff'. )
                Code:
                    ' You may add your own commands to this script.
                    ' See the scripting section of the HomeSeer help system for more information.
                    ' You may access help by going to your HomeSeer website and clicking the HELP button,
                    ' or by pointing your browser to the /help page of your HomeSeer system.
                
                    hs.TriggerEvent("Startup Stuff")
                Mike____________________________________________________________ __________________
                HS3 Pro Edition 3.0.0.548

                HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

                Comment


                • #9
                  Originally posted by Uncle Michael View Post
                  All you need is a single line added to your Startup.vb script. This is mine. (I cleverly named my event 'Startup Stuff'. )
                  Code:
                      ' You may add your own commands to this script.
                      ' See the scripting section of the HomeSeer help system for more information.
                      ' You may access help by going to your HomeSeer website and clicking the HELP button,
                      ' or by pointing your browser to the /help page of your HomeSeer system.
                  
                      hs.TriggerEvent("Startup Stuff")
                  Thanks Mike. I assume it doesn't matter where in the startup.vb it goes or just at the end? Now for another question. Is there a way to get the watering event to resume where it left off?

                  Comment


                  • #10
                    GOT IT TO WORK! How do I get it to honor the conditions in the event if it is manually triggered?

                    Comment


                    • #11
                      Originally posted by cowinger View Post
                      GOT IT TO WORK! How do I get it to honor the conditions in the event if it is manually triggered?
                      To do that have the script run an intermediate event, which would run the target event only if the conditions are true.
                      Mike____________________________________________________________ __________________
                      HS3 Pro Edition 3.0.0.548

                      HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

                      Comment


                      • #12
                        Originally posted by Uncle Michael View Post
                        To do that have the script run an intermediate event, which would run the target event only if the conditions are true.
                        Great, thanks. I didn't think of that.

                        Also, is there a way to get it to resume where it left off in the watering cycle? Or does that get complicated.

                        One more thing, I shouldn't put a manually triggered IF statement in the second event, right?

                        Event A is in that script you gave me in the startup.vb file

                        Event A:
                        IF this event is manually triggered
                        Then if conditions are true run another event B

                        Event B:
                        IF time is within waterstopped time range
                        then send email
                        then speak
                        then....
                        Last edited by cowinger; July 14th, 2018, 06:27 PM.

                        Comment


                        • #13
                          Originally posted by cowinger View Post
                          Great, thanks. I didn't think of that.

                          Also, is there a way to get it to resume where it left off in the watering cycle? Or does that get complicated.

                          One more thing, I shouldn't put a manually triggered IF statement in the second event, right?

                          Event A is in that script you gave me in the startup.vb file

                          Event A:
                          IF this event is manually triggered
                          Then if conditions are true run another event B

                          Event B:
                          IF time is within waterstopped time range
                          then send email
                          then speak
                          then....
                          Triggers are ALWAYS ignored when the Event is run manually, so it doesn't matter what the Trigger is. Thata way you can have a single Event that runs autonomously by a time or some other Trigger and you can run it manually when needed. The only reason you would need "This Event is Manually Triggered" is if you want it to ONLY be manually triggered.

                          You wrote "I have the GoControl Sprinkler unit. It is controlled by HS through an event that turns the valves on/off". Is this a single Event or a series of events? If it is a series of single Events that each control a valve, I'm sure we could figure out a way to have it catch up. One way would be with Power Fail recovery.

                          If you would describe or provide screenshots of your irrigation Events, it would help.
                          Randy Prade
                          Aurora, CO
                          Prades.net

                          PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

                          Comment


                          • #14
                            Originally posted by rprade View Post
                            Triggers are ALWAYS ignored when the Event is run manually, so it doesn't matter what the Trigger is. Thata way you can have a single Event that runs autonomously by a time or some other Trigger and you can run it manually when needed. The only reason you would need "This Event is Manually Triggered" is if you want it to ONLY be manually triggered.
                            So would my two events above be correct?


                            You wrote "I have the GoControl Sprinkler unit. It is controlled by HS through an event that turns the valves on/off". Is this a single Event or a series of events? If it is a series of single Events that each control a valve, I'm sure we could figure out a way to have it catch up. One way would be with Power Fail recovery.
                            Here is an event. It is all under one event as you can see. Would I need to separate it into individual events to get it to resume?
                            Attached Files

                            Comment


                            • #15
                              Randy, I created separate events for the sprinklers. Do you think this would be usable to create a script that would resume the watering if the computer got rebooted?
                              Attached Files

                              Comment

                              Working...
                              X