Announcement

Collapse
No announcement yet.

gracefully shutting down homeseer when windows reboot?

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

    gracefully shutting down homeseer when windows reboot?

    Running HS as service, whenever I reboot the computer, A few HS devices (especially the VD) are out of sync. Often time, the "last change" time stamps are from days ago.

    I believe this is due to HS isn't properly ending its services whenever the computer reboots. Does anyone have this issue? What's the remedy for it?

    #2
    Windows operating system has well defined and documented way for application to be notified about system shutting down. It is expected that application will save unsaved changes and gracefully exit. In rare cases it can even notify operating system to stop shutdown.

    I've seen reports that HS corrupts its own database if not closed manually before shutdown. I, personally, never experienced such problems. And I don't know if HS does register for shutdown notification from OS.

    That said, you are saying that you are running HS as service. Since HS does not support that mode natively, you must be running some kind of service wrapper. Since services use different way of registering with operating system for shutdown messages, it would be wrapper's task to register with OS and when shutdown message is received it should translate that into shutdown notification appropriate for application it wraps and send it to it. That's probably not happening. It may just terminate HS before telling Windows service manager that it it's done cleaning up.

    We would need more details about how you are running HS as service to help you.

    Comment


      #3
      Originally posted by crab987 View Post
      Windows operating system has well defined and documented way for application to be notified about system shutting down. It is expected that application will save unsaved changes and gracefully exit. In rare cases it can even notify operating system to stop shutdown.

      I've seen reports that HS corrupts its own database if not closed manually before shutdown. I, personally, never experienced such problems. And I don't know if HS does register for shutdown notification from OS.

      That said, you are saying that you are running HS as service. Since HS does not support that mode natively, you must be running some kind of service wrapper. Since services use different way of registering with operating system for shutdown messages, it would be wrapper's task to register with OS and when shutdown message is received it should translate that into shutdown notification appropriate for application it wraps and send it to it. That's probably not happening. It may just terminate HS before telling Windows service manager that it it's done cleaning up.

      We would need more details about how you are running HS as service to help you.

      I start HS3 with Windows in the mean of task scheduler. It just start HS3 doesn't load the interface or anything. HTH

      A lot, if not everyone running HS in Windows does this.

      Comment


        #4
        I don't think you are running HS as a service. You just do not have the GUI.
        There are several plug-ins and scripts that will allow you to shut down HS from the web interface. Blades's 'BLShutdown', CFGUy's 'Restart', and Jon00's restart and shutdown utility come to mind.
        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
          If you are running HS under Windows and do not see it running on the desktop, it is not running as a service, it is running as a background application. As Uncle Michael stated, there are at least three plug-ins that can shut down HomeSeer from an Event, script or dropdown command. I use BLShutdown here along with Jon00's link manager to provide potions on a dropdown. My choices allow me to
          • Restart HomeSeer
          • Restart HomeSeer and Server
          • Restart HomeSeer, Server and Z-Nets
          • Reset Z-Nets (hard reset through external device)
          • Reboot Z-Nets (soft reset)
          Click image for larger version  Name:	Capture.PNG Views:	1 Size:	52.3 KB ID:	1242821

          I control my system through those choices 99% of the time. When I upgrade the HS program, I have to RDP into the server, shutdown HomeSeer and manually stop the HSSentry service. For that reason I prefer to have my server run as an application under a logged in user. I use netplwiz.exe to configure the server to automatically log-in as an administrative user. Then I use R2 labs Startup Delayer to launch HomeSeer. That way I can always see the application interface on the desktop.
          HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

          Comment


            #6
            Originally posted by rprade View Post
            If you are running HS under Windows and do not see it running on the desktop, it is not running as a service, it is running as a background application. As Uncle Michael stated, there are at least three plug-ins that can shut down HomeSeer from an Event, script or dropdown command. I use BLShutdown here along with Jon00's link manager to provide potions on a dropdown. My choices allow me to
            • Restart HomeSeer
            • Restart HomeSeer and Server
            • Restart HomeSeer, Server and Z-Nets
            • Reset Z-Nets (hard reset through external device)
            • Reboot Z-Nets (soft reset)
            Click image for larger version Name:	Capture.PNG Views:	1 Size:	52.3 KB ID:	1242821

            I control my system through those choices 99% of the time. When I upgrade the HS program, I have to RDP into the server, shutdown HomeSeer and manually stop the HSSentry service. For that reason I prefer to have my server run as an application under a logged in user. I use netplwiz.exe to configure the server to automatically log-in as an administrative user. Then I use R2 labs Startup Delayer to launch HomeSeer. That way I can always see the application interface on the desktop.
            Please pardon the OT question but Randy would you mind describing how you're hard resetting your Z-nets? Is power on an independent controller? Don't want to add a controller for just this purpose but may not be another way. Thx.
            -Wade

            Comment


              #7
              Originally posted by cc4005 View Post

              Please pardon the OT question but Randy would you mind describing how you're hard resetting your Z-nets? Is power on an independent controller? Don't want to add a controller for just this purpose but may not be another way. Thx.
              I have an Arduino near each Z-Net with a relay that shorts the reset pins on each Raspberry Pi. I initially was having a lot of problems with my first Z-Net (a beta release in 2015). This method was the only thing that would work when the Z-Net would forcibly close its connection. HomeSeer did some software updates, I replaced the Kingston SD cards for very fast and more robust Samsung Pro cards and replaced the two Pi B+ boards for Pi 2 boards. That ended them locking up or disconnecting, so I really don’t need the hard reset. The soft reset simply calls the Reboot.php page from a small script. A soft reset is all I have needed over the last couple of years and it is much easier on the SD cards. Since going to Pi 3 boards last year, not one of of my 3 have skipped a beat.

              HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

              Comment


                #8
                I'm using BLShutdown... but I've been using it to restart HS3 only. I never bothered looking but now I see an option to shut down HS3 and the computer. Going to try that later.

                Comment


                  #9
                  Originally posted by rprade View Post
                  I have an Arduino near each Z-Net with a relay that shorts the reset pins on each Raspberry Pi. I initially was having a lot of problems with my first Z-Net (a beta release in 2015). This method was the only thing that would work when the Z-Net would forcibly close its connection. HomeSeer did some software updates, I replaced the Kingston SD cards for very fast and more robust Samsung Pro cards and replaced the two Pi B+ boards for Pi 2 boards. That ended them locking up or disconnecting, so I really don’t need the hard reset. The soft reset simply calls the Reboot.php page from a small script. A soft reset is all I have needed over the last couple of years and it is much easier on the SD cards. Since going to Pi 3 boards last year, not one of of my 3 have skipped a beat.
                  Thanks Randy and again sorry for going OT.
                  -Wade

                  Comment


                    #10
                    Originally posted by dannieboiz View Post
                    I'm using BLShutdown... but I've been using it to restart HS3 only. I never bothered looking but now I see an option to shut down HS3 and the computer. Going to try that later.
                    +1

                    BlShutdown work fine .

                    JF

                    Comment


                      #11
                      Are there any graceful shutdown solutions that can shut down HS3 when windows 10 has been commanded to reboot? Most run-as-a-service programs can call a shutdown script. I really don't think manual user intervention to pull up a web page and click a drop-down restart menu is the right answer. When windows is asked to reboot, HS3 should automatically shut down. Sounds like this might be an auto-run script intervention, but I see this as the only acceptable solution to gracefully rebooting.

                      Comment


                        #12
                        Originally posted by lifespeed View Post
                        Are there any graceful shutdown solutions that can shut down HS3 when windows 10 has been commanded to reboot? Most run-as-a-service programs can call a shutdown script. I really don't think manual user intervention to pull up a web page and click a drop-down restart menu is the right answer. When windows is asked to reboot, HS3 should automatically shut down. Sounds like this might be an auto-run script intervention, but I see this as the only acceptable solution to gracefully rebooting.
                        HS3 runs in user mode, it is not run as a service. The problem is that when Windows is asked to shut down, it also asks HomeSeer to shut down, but Windows usually doesn't wait long enough. The default is 20 seconds, but there are registry tweaks.

                        There are three registry settings that control what Windows does with running applications when you shut down your computer:
                        • WaitToKillAppTimeout: When you shut down your PC, Windows gives open applications 20 seconds to clean up and save their data before offering to close them. This value controls how many seconds Windows waits for.
                        • HungAppTimeout: Windows considers applications “hung” if they don’t respond within 5 seconds and gives you a “force shut down” option. This value controls how many seconds Windows waits before considering applications unresponsive.
                        • AutoEndTasks: Windows normally displays an “force shut down” button after the number of seconds expires, asking for your permission to close any running applications. If you enable this option, Windows will instead automatically close any applications and shut down without your input.
                        If you don't have all of the registry entries, you may have to create them. Here is a link explaining it.

                        I preferred to go the BLShutdown route and use it to shutdown or restart the computer, unless I am connected to the server by RDP.

                        I have disabled automatic Windows updates, so my system is never asked to shutdown unless I ask it to.
                        HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                        Comment


                          #13
                          Originally posted by rprade View Post
                          HS3 runs in user mode, it is not run as a service. The problem is that when Windows is asked to shut down, it also asks HomeSeer to shut down, but Windows usually doesn't wait long enough. The default is 20 seconds, but there are registry tweaks.
                          Thanks for the quick response. It sounds like windows 10 default behavior is to notify user-mode programs (HS3) to shut down, and in some cases this may work OK - notifying HS3 to shut down, causing a clean exit. So long as there are not situations where something is causing a "hang" when HS3 tries to shut down, like a balky plugin, it should be fine to reboot using the standard windows interface. If this is not OK, the result will be the usual complaint windows pops up when a program is not responding quickly enough to the shutdown request. This clean exit may be confirmed in the log file?

                          It also sounds like there is no reason to implement NSSM for HS3 (I already run this software for Emby Server) rather than the task scheduler method, as NSSM's ability to call a shutdown script would not be any better than Windows notifying HS3 to shut down.

                          The caveat with using a regular windows shut down is to confirm that HS3 continues to shut down in a timely fashion as configurations evolve, and if more time is needed to implement this as described above.

                          Is my understanding of how to implement automatic HS3 start and clean exit (no user login), without additional computer training for other family members who will occasionally touch this computer, correct?

                          Comment


                            #14
                            While there are many options I highly recommend r2 Studios Startup Delayer for starting HS3.
                            • Use netplwiz.exe to set Windows to log in to a password protected administrator's account
                            • Set Windows UAC to minimum
                            • Use Startup Delayer to launch HS3 with the highest privileges
                            If you do this it will start reliably, but still keep access to the computer password protected, except at the console. You can safely use RDP to access the computer locally, but a password and user is required. I do not recommend RDP over the WAN by port forwarding, because it is not encrypted.

                            I have used this method since 2014 and have helped several others setting it up.

                            For shutdown use one of the utilities from Blade, CFGuy or Jon00. Jeff Farmer gives you shutdown options on the Management drop down. I use BLShutdown with Jon00's Links package to put options on my Tools menu.

                            Click image for larger version  Name:	capture.png Views:	1 Size:	62.4 KB ID:	1246678

                            I no longer offer shutting down HomeSeer, because HSSentry will automatically restart HS if it is down for more than a minute. If I need to do computer maintenance I RDP in and manually shutdown HS and end the HSSentry service with the task manager. The rest of the options are Events that call BLShutdown actions and/or directly rebooting or resetting the Z-Nets.

                            My HomeSeer runs on a dedicated SuperMicro (headless) Xeon E3-1270 Windows 10 server. With IPMI I never have or need to attach a monitor or keyboard to it.

                            WRT shutdown time, My HS3 takes 20-40 seconds to shut down and about 90 seconds to start up.

                            Number of Devices: 2556
                            Number of Events: 1416
                            Available Threads: 800
                            HSTouch Enabled: True
                            Event Threads: 0
                            Event Trigger Eval Queue: 1
                            Event Trigger Priority Eval Queue: 0
                            Device Exec Queue: 0
                            HSTouch Event Queue: 1
                            Email Send Queue: 0
                            Anti Virus Installed: Windows Defender

                            Enabled Plug-Ins
                            2.1.0.88: AmbientWeather
                            1.0.0.148: Arduino Plugin
                            2.0.59.0: BLBackup
                            2.0.11.0: BLEditor
                            3.0.19.0: BLLock
                            2.0.27.0: BLOccupied
                            1.0.4.0: BLShutdown
                            2.0.84.0: BLStat
                            1.3.4.2: Device History
                            3.0.0.50: EasyTrigger
                            3.0.0.40: EnvisaLink
                            2.0.2.6: JowiHue
                            3.1.0.1: MeiHarmonyHub
                            1.2018.717.1011: MyQ
                            3.0.1.121: PHLocation
                            3.0.0.5: PHLocation2
                            0.0.0.43: Pushover 3P
                            3.1.0.24: Sonos
                            3.0.6629.22233: Ultra1Wire3
                            3.0.6678.32449: UltraECM3
                            3.0.6644.26753: UltraLog3
                            3.0.6554.33094: UltraMon3
                            3.0.6702.34494: UltraWeatherWU3
                            3.0.1.236: Z-Wave
                            Last edited by randy; January 9, 2020, 08:56 AM.
                            HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                            Comment


                              #15
                              Originally posted by rprade View Post
                              While there are many options I highly recommend r2 Studios Startup Delayer for starting HS3.
                              • Use netplwiz.exe to set Windows to log in to a password protected administrator's account
                              • Set Windows UAC to minimum
                              • Use Startup Delayer to launch HS3 with the highest privileges
                              If you do this it will start reliably, but still keep access to the computer password protected, except at the console. You can safely use RDP to access the computer locally, but a password and user is required. I do not recommend RDP over the WAN by port forwarding, because it is not encrypted.
                              While I appreciate the suggestions, I am not looking for a solution that requires a user to be logged in. I am running HS3 on a server that performs multiple other functions, and this just doesn't work for my use case. Past experience has shown the task scheduler method (and I would guess NSSM as well, although I haven't tried it with HS3 yet) works fine to start HS3, so I'm not looking to replace it with a user-login approach.

                              All I want to do is close HS3 gracefully, preferably within standard windows functionality - no extra menus or shutdown procedures. Like I said, other people sometimes access this computer. And while they don't usually reboot it, I also don't want to make things non-standard in the unlikely event my wife or child needs to reboot the machine.

                              I'll set up a fresh install of HS3 and check for a clean shutdown using nothing other than task scheduler and windows shutdown notification to HS3, and see how it works.

                              Comment

                              Working...
                              X