Announcement

Collapse
No announcement yet.

HS start up trigger

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

    HS start up trigger

    There are a number of things I like to check if the HS3 CPU reboots. What trigger can I use to notify me when HS3 restarts (loads)?
    HS4Pro on Windows 10
    One install with 2 Ethernet Z-nets
    2nd install with 1 Ethernet Z-net
    300 devices, 250 events, 8 scripts
    6 CT-100 tstats
    Serial IT-100 interface to DSC Panel with 8 wired zones
    18 Fortrezz water sensors & two valve controls

    #2
    There is a script (startup.vb) in your scripts folder that HS runs when it starts. You can add a line to trigger an event that will allow you to set a device or whatever you want to happen.
    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.OpenComPortTerm(21, "9600,N,8,1", 1, "Data_GetSG_ASCII.vb", "Main", "$")
    
    	hs.TriggerEvent("Startup Stuff")
    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
      I have a line at the end of my startup.vb

      hs.triggerevent("Reboot Occurred")


      Within that event I take care of any housekeeping I need after boot up. It is easy to add actions, other events with conditions honored, timer controls, counter controls, etc. I send myself a Pushover message telling me HomeSeer restarted and at what time, restart an uptime counter, get my lights synchronized with the time of day, poll a couple of critical devices to make sure they didn't change state while HomeSeer was down, etc. It is a one stop repository for startup events.

      I ended up putting the delay in to give HomeSeer a chance to settle down before proceeding with cleanup.

      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

      Comment


        #4
        Thank you, that did it.


        Sent from my iPhone using Tapatalk
        HS4Pro on Windows 10
        One install with 2 Ethernet Z-nets
        2nd install with 1 Ethernet Z-net
        300 devices, 250 events, 8 scripts
        6 CT-100 tstats
        Serial IT-100 interface to DSC Panel with 8 wired zones
        18 Fortrezz water sensors & two valve controls

        Comment


          #5
          Randy, could expand on z-net power on. Is this just a restart of the z-net.

          Also I see the Cleanup Events Day/Night...
          How are exactly are you synchronizing lights to time of day.


          Sent from my iPhone
          Tom
          baby steps...starting again with HS3
          HS3Pro: Z-NET & 80 Z wave Devices,
          HSTouch: 4 Joggler (Android Kitkat), 2 iPhone, 3 iPads
          Whole House Audio: 5 SqueezePlay Jogglers w Bose Speakers
          In The Works: 10 Cameras Geovision, new Adecmo/Envisalink Alarm, Arduinos
          System: XP on Fanless Mini-ITX w/ SSD

          Comment


            #6
            Originally posted by TomTom View Post
            Randy, could expand on z-net power on. Is this just a restart of the z-net.

            Also I see the Cleanup Events Day/Night...
            How are exactly are you synchronizing lights to time of day.


            Sent from my iPhone
            I use an Arduino pin to drive an opto-coupled relay whose N.C. contacts are wired in series with the Z-Net power. If I need to reset the Z-Net that relay is turned on. The event in the reboot cleanup looks to see if that relay is on at restart. If it is I turn it off and write a log entry noting that it was off. This makes sure that the Z-Net is powered when HomeSeer is restarted - no matter what state it was in when HomeSeer shut down.

            Restarting the Z-Net by brute force has not been a problem, but it is not an ideal solution. I intend a weekend project to be to change the relay to have its N.O. contacts wired to the Pi 2's run pins which when shorted will reset the Z-Net.

            I asked Rich to provide a "Restart controller" as an event action. He wasn't wanting to do that and he said he thought there was a JSON command to restart it, but that was the last I heard of it. The reset button would probably be a better solution in case the Z-Net quits communicating over Ethernet, which happens to be the only problem I have ever had. It happened twice in two weeks last September, never before and not since. I cannot be sure if it was a network problem or a Z-Net problem, but restarting it cured it both times. Now I trap log entries that indicate that the Z-Net is not communicating and if 10 occur within 2 minutes, I get a Pushover message allowing me to restart the controller by an acknowledgement. If I get 25 of the errors in a 5 minute period, HomeSeer restarts the Z-Net automatically.

            Hopefully all this makes sense.
            .
            Attached Files
            Last edited by randy; March 9, 2016, 11:33 PM.
            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

            Comment


              #7
              Originally posted by TomTom View Post
              Randy, could expand on z-net power on. Is this just a restart of the z-net.

              Also I see the Cleanup Events Day/Night...
              How are exactly are you synchronizing lights to time of day.


              Sent from my iPhone
              On the day night cleanup events, I have a couple of virtual devices that enable/disable motion controlled lighting based upon time of day. One is for the basement and the other for upstairs. I also look at about 10 key lights or lighting groups that are controlled by the time of day - outside lights, stair lights, living area lights, bathroom night lights and kitchen cabinet accent lights.

              If HomeSeer is shut down at noon and restarted at 8:00 PM these events will turn the appropriate lights on.

              These devices are set to turn on before, at or after sunset and off at a certain time. If I have an event to turn a light or virtual device on at sunset via that trigger, I also put nighttime in as a condition. When HomeSeer is running normally, it triggers at sunset and the condition would understandably be true.

              When a restart of HomeSeer occurs, my Reboot Occurred event calls the Day/Night lighting cleanup event, which in turn calls the device control events with the conditions respected. Since triggers are ignored calling the event skips the sunset trigger but will still respect the nighttime condition.

              For example my front porch light comes on at sunset and is turned off at 1:00 AM. The two events are:

              IF the time is 1m, 0s after sunset
              AND IF the time is after sunset but before 12;00 AM
              AND IF the front porch light is OFF

              OR IF this event is manually triggered
              AND IF the time is before 1:00 AM
              AND IF the front porch light is OFF

              THEN Turn the Front Porch Light ON

              IF the time is 1:00:01 AM
              AND IF the time is before sunset but after 1:00 AM
              AND IF the front porch light is ON

              THEN Turn the Front Porch Light OFF

              Both of those events can run with their primary trigger or be called from another event that respects their conditions.

              I never found powerfail recovery to work predictably or reliably, so this structure allows me to keep time controlled devices in sync, no matter how long HomeSeer might have been shut down.
              Last edited by randy; March 9, 2016, 11:28 PM.
              HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

              Comment


                #8
                Thanks Randy. VERY VERY useful(as always). Thank you !
                Tom
                baby steps...starting again with HS3
                HS3Pro: Z-NET & 80 Z wave Devices,
                HSTouch: 4 Joggler (Android Kitkat), 2 iPhone, 3 iPads
                Whole House Audio: 5 SqueezePlay Jogglers w Bose Speakers
                In The Works: 10 Cameras Geovision, new Adecmo/Envisalink Alarm, Arduinos
                System: XP on Fanless Mini-ITX w/ SSD

                Comment


                  #9
                  Originally posted by rprade View Post
                  On the day night cleanup events, I have a couple of virtual devices that enable/disable motion controlled lighting based upon time of day. One is for the basement and the other for upstairs. I also look at about 10 key lights or lighting groups that are controlled by the time of day - outside lights, stair lights, living area lights, bathroom night lights and kitchen cabinet accent lights.

                  If HomeSeer is shut down at noon and restarted at 8:00 PM these events will turn the appropriate lights on.

                  These devices are set to turn on before, at or after sunset and off at a certain time. If I have an event to turn a light or virtual device on at sunset via that trigger, I also put nighttime in as a condition. When HomeSeer is running normally, it triggers at sunset and the condition would understandably be true.

                  When a restart of HomeSeer occurs, my Reboot Occurred event calls the Day/Night lighting cleanup event, which in turn calls the device control events with the conditions respected. Since triggers are ignored calling the event skips the sunset trigger but will still respect the nighttime condition.

                  For example my front porch light comes on at sunset and is turned off at 1:00 AM. The two events are:

                  IF the time is 1m, 0s after sunset
                  AND IF the time is after sunset but before 12;00 AM
                  AND IF the front porch light is OFF

                  OR IF this event is manually triggered
                  AND IF the time is before 1:00 AM
                  AND IF the front porch light is OFF

                  THEN Turn the Front Porch Light ON

                  IF the time is 1:00:01 AM
                  AND IF the time is before sunset but after 1:00 AM
                  AND IF the front porch light is ON

                  THEN Turn the Front Porch Light OFF

                  Both of those events can run with their primary trigger or be called from another event that respects their conditions.

                  I never found powerfail recovery to work predictably or reliably, so this structure allows me to keep time controlled devices in sync, no matter how long HomeSeer might have been shut down.
                  Randy, firstly thanks for posting you solution. I would have thought that system reboot would have been built-in, but this works also and I've adapted to my situation. Is it possible for you to post examples (screen shots) of your; Restart cleanup events for both z-wave and Night/Day events? A picture is worth a thousand words... Mike
                  Computer: CUK Intel NUC7i7BNH
                  Op System: Windows10 Pro - Work Station
                  HS Version: HS4 Pro Edition 4.2.19.0

                  Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                  Comment


                    #10
                    Originally posted by MNB View Post
                    Randy, firstly thanks for posting you solution. I would have thought that system reboot would have been built-in, but this works also and I've adapted to my situation. Is it possible for you to post examples (screen shots) of your; Restart cleanup events for both z-wave and Night/Day events? A picture is worth a thousand words... Mike
                    +1
                    Michael

                    Comment


                      #11
                      Originally posted by MNB View Post
                      Randy, firstly thanks for posting you solution. I would have thought that system reboot would have been built-in, but this works also and I've adapted to my situation. Is it possible for you to post examples (screen shots) of your; Restart cleanup events for both z-wave and Night/Day events? A picture is worth a thousand words... Mike
                      I just got home from 8 hours of driving in the Colorado mountains. I will try to post tomorrow.
                      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                      Comment


                        #12
                        Originally posted by rprade View Post
                        I just got home from 8 hours of driving in the Colorado mountains. I will try to post tomorrow.
                        Randy, many Thanxs, will be waiting with baited breath ;-) Trust you went somewhere nice (pleasure or business)? Mike
                        Computer: CUK Intel NUC7i7BNH
                        Op System: Windows10 Pro - Work Station
                        HS Version: HS4 Pro Edition 4.2.19.0

                        Plug-Ins: AK Weather 4.0.5.25,APCUPSD 3.3.2.3,BLBackup 2.0.63.0,BLEditor 2.0.11.0,BLGData 3.0.55.0,BLOccupied 2.0.28.0,BLShutdown 1.0.6.0,Blue-Iris 3.1.3.33206,Device History 3.2.0.2,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,iRobot 5.22.41.1,JowiHue 4.0.8.7,Nest 3.0.0.34,NetCam Plugin 1.0.0.5,PHLocation2 3.0.0.64,Pushover 4.0.10.0,Random 3.0.0.2,Restart 1.0.0.7,Ring 1.0.0.9,SDJ-Health 3.1.1.3,Sonos 3.1.0.59,Sonos4 4.0.1.12,UltraCID3 3.0.6681.34300,UltraMon3 3.0.6554.33094,UltraNetCam3 3.0.6413.20219,Unifi 4.0.32.0,Zigbee 4.0.11.0,Z-Wave 4.0.3.0, and Jon00 scripts.

                        Comment


                          #13
                          Originally posted by MNB View Post
                          Randy, many Thanxs, will be waiting with baited breath ;-) Trust you went somewhere nice (pleasure or business)? Mike
                          It was a business trip, I had to drive south to Saguache, then back home. Snowy and cold both ways
                          HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                          Comment


                            #14
                            OK Here goes. This is my primary cleanup event. It is triggered from my startup script. The purpose is to get everything in the correct state after startup, whether HomeSeer was down for minutes, hours or days.

                            Click image for larger version

Name:	Capture1.PNG
Views:	1
Size:	128.2 KB
ID:	1195537

                            First I make sure a virtual device that resets Z-Nets is off. In some cases there will be a trigger of this device prior to a restart. Then I start my uptime timer. I use this to stop certain automatic actions from starting until HS has been running for at least 2 minutes. Then I turn off a virtual device that might indicate the system was waiting for an acknowledgement from a Pushover emergency message. Then I send a Pushover message that HomeSeer was restarted. Then I put in a Wait for 1 minute to let HS settle after a startup. I do not load plug-ins in the background. If I did, the Wait would need to be 3 minutes.

                            After the wait, these are the steps
                            • Turn announcements off in one room so that it doesn't disturb my wife when she is working from home
                            • Announce that HS was restarted. Since I use the Sonos plug-in the announcements are all handled with a script
                            • Then I poll any critical devices to make sure they were not manually operated while HomeSeer was down
                            • Then I run an event that restarts Arduino board monitoring and testing. My 3 critical Arduinos have watchdog reset boards attached. These boards need to see an output toggle at least once every 4 minutes and if not they perform a hard reset on the board. The Arduinos are very reliable, this is just a layer to make them almost bulletproof
                            • Then I cleanup my day and night lighting. This runs an event that goes through all of our automatic lights and sets then according to their schedules
                            • Then a bunch more odds and ends making sure everything in in the proper state at startup, followed by a Pushover message telling me cleanup is complete


                            Here is the Polling Event which makes sure HomeSeer knows the status of boiler power and my network power switches

                            Click image for larger version

Name:	Capture2.png
Views:	1
Size:	23.9 KB
ID:	1195538

                            Here is the Event that calls all of my lighting cleanup Events

                            Click image for larger version

Name:	Capture3.PNG
Views:	1
Size:	60.1 KB
ID:	1195539

                            A typical lighting cleanup event. It is normally triggered by entry into a Easy Trigger Schedule, but the schedule is also a condition so that it can be run manually. This Event turns on all of the living end entry area lighting. There is another to turn them off and a third to put them in nightlight mode. There are others for outside and for specialty lighting.

                            Click image for larger version

Name:	Capture4.PNG
Views:	1
Size:	72.0 KB
ID:	1195540

                            This process sure has grown since I posted above about 2 years ago. Hopefully this makes sense. If you have questions I will try to answer them.
                            Last edited by randy; February 23, 2018, 06:31 PM.
                            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                            Comment


                              #15
                              Holy smokes Randy, that is quite a clean up system.
                              RJ_Make On YouTube

                              Comment

                              Working...
                              X