Announcement

Collapse
No announcement yet.

HS Statistics not working when running homeseer as a service

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

    HS Statistics not working when running homeseer as a service

    I recently switched homeseer over to running as a service on my windows system and the mcsmqtt HS statistics on homeseer itself do not work. The other plugin stats do still work, but the primary HS one does not, it shows as stopped.

    #2
    Good observation. The service process is called HomeSeer HS4 Service (32 bit) rather than HSConsole, Looks like an update is in order to recognize either.

    Comment


      #3
      The attached has files that go into \bin\mcsMQTT. There was also a dll from the .NET framework that I used to manage services. It should be in your library of framework files, but if you get an error for missing file then add it to the same location.

      I was surprised that the API method hs.Shutdown() is non-functional when running as a service. The lack of shutdown itself was not the problem, but part of this call results in a call to all running plugins for an orderly shutdown. I now need to do this within mcsMQTT to assure plugins have awareness that HS will be shutting down. I also noticed that my HS Devices page filter for Floor/Room were sometimes lost when the HS service was restarted. Likely related to hs.Shutdown() design considerations. Anything else that HS may do during a shutdown process could be lost as well.

      The update determines if HS4 is running as a service and if so uses the CPU from the service process rather than the HS4 process. This takes care of your original observation. When Shutdown button for HS is used then the service will be stopped. When Restart button is used the service is stopped and then started after the process disappears.
      Attached Files

      Comment


        #4
        Thanks, I will get to test this as soon as I can. Might take me a couple of days. Appreciate your work!

        Comment


          #5
          I am especially interested if you need to install the additional .NET framework dll. This will tell me if I need to include that dll in the Updater submittal. I do not think you do, but hard to confirm on the development computer.

          Comment


            #6
            I had a few minutes tonight so I gave it a whirl. I replaced all the files from the mcsmqtthsservice folder and it correctly reported the cpu status. Interestingly enough, in my bin/mcsmqtt folder the other .Net you reference, system.serviceprocess.dll , did not exist. I did not add it since it seemed to be correctly reporting cpu /activity status. I tested the shutdown function and it did shut down the service, albeit with these errors in the HS log. I then tried a restart and that did not work. It seemed to hang for a while and I think windows killed the service. I had to manually start the service again. Should I retry with adding that dll?

            Click image for larger version

Name:	hserrors.png
Views:	89
Size:	107.7 KB
ID:	1527921
            Attached Files

            Comment


              #7
              The error indicates the pluginfunction parameter for plugin name was not recognized. I will try some of my other plugins running.

              The additional dll will not be needed since it was able to recognize HS was a service and got the correct process for cpu.

              There is a file in \bin\mcsMQTT called restart.trace. it logs info from RestartHS.exe which was also installed in the same folder from the zip. Confirm it was installed there and post the restart.trace file.

              Comment


                #8
                I tested again this evening and those errors in the screenshot were there but it did actually restart the service this time. It took a good 60 seconds for it to show as starting again after it had stopped. I think that I might not have waited long enough before to see what was going on.

                Comment


                  #9
                  I determined that hs.Shutdown() is working with service. It was an instrumentation error on my part.

                  The plugin monitors process status during shutdown & restart at 1 second intervals and allow 2 minutes. It does seem to take longer than expected, but I believe it is correct.

                  Update to take care of the log errors at bottom or first post at https://forums.homeseer.com/forum/hs...ge-log-hs4-hs3

                  Comment


                    #10
                    Yes that seemed to take care of the errors.

                    Comment

                    Working...
                    X