Announcement

Collapse
No announcement yet.

Excessive CPU and Excessive MQTT Topics

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

    #46
    That was already done in V3.1.3.0. It is an option in the same place as the History data option was selected. The broker connection was also added as an event Trigger so one could use it in events to detect when a broker connection is made or lost. It also could be done by an event trigger that is based upon the value of broker connection status device.

    Comment


      #47

      Comment


        #48
        Not familiar with this. Can you point me to somewhere where I can learn?

        Comment


          #49
          Here's some code from a script made a while ago. Can't remember exactly how it works, but I believe you need to set the root device as parent, then the child devices as child, then tell the child devices who the parent is. I tried to comment this as good as I could at the time but it should get you in the ball park.

          Code:
                         If vHSTouchElementsRoot_ID = -1 Then 'if virtual root device does not exist
                              dv = CType(hs.GetDeviceByRef(hs.NewDeviceRef(vHSTouchElementsRoot_Name)), Scheduler.Classes.DeviceClass) 'create the root device and name
                              dv.Location(hs) = "Virtual" 'room
                              dv.Location2(hs) = "Root" 'category
                              dv.Interface(hs) = "HSTouch Elements" 'assigns plugin and removes image and images
                              dv.Device_Type_String(hs) = "HSTouch Elements"
                              dv.Last_Change(hs) = Now ' update last changed time to now
                              dv.Relationship(hs) = HomeSeerAPI.Enums.eRelationship.Parent_Root ' set as parent
                              vHSTouchElementsRoot_ID = dv.Ref(hs) ' save the Dev ID
                              hs.SetDeviceString(vHSTouchElementsRoot_ID, "No Status", True) ' Set string to temporarily set status and image
                          End If
          
                          If StatusWindow_ID = -1 Then 'if StatusWindow device does not exist
                              dv = CType(hs.GetDeviceByRef(hs.NewDeviceRef(StatusWindow_Name)), Scheduler.Classes.DeviceClass) 'create the device and name
                              dv.Location(hs) = "Virtual" 'room
                              dv.Location2(hs) = "Match Device" 'category
                              dv.Interface(hs) = "HSTouch Elements" 'assigns plugin and removes image and images
                              dv.Device_Type_String(hs) = "HSTouch Elements"
                              dv.Last_Change(hs) = Now ' update last changed time to now
                              dv.Relationship(hs) = HomeSeerAPI.Enums.eRelationship.Child
                              dv.AssociatedDevice_Add(hs, vHSTouchElementsRoot_ID) 'relationship from this child to root
                              StatusWindow_ID = dv.Ref(hs) ' save the Dev ID
                              dv = CType(hs.GetDeviceByRef(vHSTouchElementsRoot_ID), Scheduler.Classes.DeviceClass)
                              dv.AssociatedDevice_Add(hs, StatusWindow_ID) 'relationship from root to this child
                              hs.SetDeviceString(StatusWindow_ID, "No Status", True)

          Comment


            #50
            I used your code to create a parent and the set of child devices. I can see this status in the Advanced tab of Device Management. I do not see any difference in the rendering of the devices on this page. I do see some scripting call related to it. What do you do that makes effective use of the parent / child relationship?

            Comment


              #51
              If I remember correctly the following should work.

              In the parent device set it's relationship to parent:

              Code:
              dv = CType(hs.GetDeviceByRef(123), Scheduler.Classes.DeviceClass)
              dv.Relationship(hs) = HomeSeerAPI.Enums.eRelationship.Parent_Root
              In the child device set it's relationship to child and also add an associated device pointing to the root:

              Code:
              dv = CType(hs.GetDeviceByRef(321), Scheduler.Classes.DeviceClass)
              dv.Relationship(hs) = HomeSeerAPI.Enums.eRelationship.Child
              dv.AssociatedDevice_Add(hs, 123)
              Since the root device was created first you need to go into it again and add the child as an associated device:

              Code:
              dv = CType(hs.GetDeviceByRef(123), Scheduler.Classes.DeviceClass)
              dv.AssociatedDevice_Add(hs, 321)

              Comment


                #52
                One other thing I just noticed is that there is no way to subscribe to a topic and have it set the state of a non-plugin device.

                Would it be possible to add this?

                Comment


                  #53
                  I did not catch the 3rd step in the association process. I will go back and take care of it. My question still applies. What is the value in having these parent/child relationships.\

                  The question about controlling a non-plugin device is being discussed in the other active thread in this forum. Should have it done tomorrow as I am now just in the testing phase.

                  Comment


                    #54
                    Several reasons:
                    • When sorting, the entire group of devices will stay with the parent.
                    • If you change the room to something already existing, the devices will remain together.
                    • The list of devices look cleaner.
                    • The list of devices takes less room.
                    Attached Files

                    Comment


                      #55
                      V3.2.0.0 includes the linking of the children in the parent device. It also has the control of non-plugin devices via MQTT topics. Related threads have been posted.

                      Comment


                        #56
                        Hello Michael, Updated to 3.2.0.0 and the plugin has failed.

                        Here's the steps I took and what I noticed.

                        - Disabled the plugin.
                        - Upgraded over the previous version.
                        - Started the plugin and went to its page.
                        - Could not see any previous associations. No data appeared in the associations tab regardless of the settings or buttons clicked. Reloaded (f5), clicked the refresh button, changed all selection boxes, etc. Nothing workied.
                        - Went to the HS logs and found the following

                        Mar-25 21:57:29 Error Posting back to plugin web page MQTT Setup: Object reference not set to an instance of an object-> at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr) at (wrapper remoting-invoke) HomeSeerAPI.IPlugInAPI:PostBackProc (string,string,string,int) at Scheduler.proxyPage.postBackProc (Scheduler.StateObject& state, System.String Data) [0x00036] in :0
                        Mar-25 21:57:29 Error Initializing plug-in(2): mcsMQTT Instance::Object reference not set to an instance of an objectSTACK: at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_remoting_wrapper (intptr,intptr) at (wrapper remoting-invoke) HomeSeerAPI.IPlugInAPI:SupportsMultipleInstances () at Scheduler.clsHSPI.CheckInterfaces () [0x00150] in :0

                        - Reviewed the debug log and this was the only line.

                        3/25/2018 10:11:18 PM 2 | mcsMQTT Running at /usr/local/HomeSeer

                        - Stopped the plugin and deleted the database, debug and history files.
                        - Started the plugin and received the following error in the plugin manager on the far right column.

                        CRITICAL: Plugin has disconnected.

                        - Completely erased the plugin and all files. Reinstalled and the plugin, it appeared to start then displayed the critical error again.
                        - Reviewed the HS logs and there are several of the log below

                        I/O interface mcsMQTT is down, executable is not running, restarting ...

                        - Disabled the plugin and left it off.

                        Comment


                          #57
                          Is it possible to revert to the previous version while the issues are looked into?

                          Comment


                            #58
                            You did everything I would have done to try to get it working. I evaluated on both Windows and Linux so surprised of the difficulty. I will see what I can discover.

                            The updater packages are on http://mcsSprinklers.com and take the format of "mcsSprinklers_3_x_y_z.zip". Only the mcsMQTT.exe from the file gets updated. The x_y_z can be seen on the change log at the top of the sticky thread on this forum.

                            If you are having backup databases generated then they are in \data folder with the filename containing the datetime information. They can be renamed to mcsMQTT.db to go back to a specific configuration.

                            Comment


                              #59
                              Yeah, I really have no clue. Could it be a mono issue? Do you know what version you're running?

                              Thanks, I'll grab it from your site.

                              The link is http://mcssprinklers.com/mcsMQTT_3_1_4_0.zip in case anyone needs it. Copy HSPI_MCSMQTT.exe and HSPI_MCSMQTT.exe to the root directory. M2Mqtt.Net.dll, Mono.Data.Sqlite.dll and
                              sqlite3.dll go in the /HomeSeer/bin directory.

                              3_1_4_0 is reinstalled and appears to be working fine.
                              Last edited by mwolter; March 26, 2018, 12:45 PM.

                              Comment


                                #60
                                I compiled 3.2.0.0 on a different computer than the 3.1.x.x series. I will do 3.2.1.0 on the original to see if that makes any difference. drodegeb seems to have 3.2.0.0 working, but don't know if Linux or Windows.

                                The Associations tab only renders the table after the button push at the bottom and it could take some seconds depending upon how much data is being rendered. It seems the page loaded initially, but later attempts degraded in your case.

                                With 3.2.0.0 a new key Version=3.2.0.0 is added to mcsMQTT.ini. If this key is not present then it will try to rebuild the database to remove null fields and get the subscription topic field set blank for non-plugin records. If the database is not present then it should not matter as a new one would be created independent of the Version key.

                                My Linux install is on Odroid C1 running Diet Pi (Debian Jessie). Mono is 5.4.1.7 (Jan 17, 2018). I put instructions in the How-To forum to build this image and it contains how to get latest Mono installed. https://forums.homeseer.com/showthread.php?t=193799

                                Comment

                                Working...
                                X