Announcement

Collapse
No announcement yet.

Copying Events using mcsMQTT is broken

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

    Copying Events using mcsMQTT is broken

    When I copy event A to event B it appears to work
    Click image for larger version

Name:	1.PNG
Views:	184
Size:	76.8 KB
ID:	1257399

    After I edit event A, Event B is also changed.
    Click image for larger version

Name:	2.PNG
Views:	166
Size:	76.9 KB
ID:	1257400

    This does not happen with native events.

    #2
    same here. Forgot to report it

    Comment


      #3
      I looked into this and confirmed the behavior. Where the problem seems to come is that the copied Unique ID (UID) is the same as the original one. I had expected HS to give each event trigger a different UID. I have a question on the developer forum on best practice to handle this. It may also help if you have another plugin that support triggers to see if it has the same behavior or not. If not then perhaps I can reach out to that author to see how he/she handles it.

      Comment


        #4
        You might ping Spud. Easy Trigger does not exhibit the same behavior. I also have duplicated other plug-in specific triggers and have not seen problems.

        Here is an event I just created and a copy. Then I edited the first event. They have different event IDs

        Click image for larger version  Name:	D5166139-4D58-4CD1-836B-6BAFA94CE8A8.jpeg Views:	1 Size:	59.5 KB ID:	1257602

        Click image for larger version  Name:	6A18BE59-0891-4A51-927E-B4AE80307434.jpeg Views:	1 Size:	56.3 KB ID:	1257601
        Last edited by randy; November 6, 2018, 04:23 PM.
        HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

        Comment


          #5
          I tried to send PM to Spud, but have quota issues. I have other post as how to resolve my quota problem.

          I acknowledge that the two events have different IDs, but triggers contain UID property. I do the same thing as the HS3 Sample Plugin to identify the trigger which is to use only the UID. I could form the key based upon both Event ID and trigger UID, but this is not what was in the sample so I prefer to find the best practice rather than blazing a new approach.

          Code:
              Friend Function TriggerFromInfo(ByVal TrigInfo As HomeSeerAPI.IPlugInAPI.strTrigActInfo) As strTrigger
                  Dim sKey As String = ""
                  sKey = "K" & TrigInfo.UID.ToString
                  If colTrigs IsNot Nothing Then
                      If colTrigs.ContainsKey(sKey) Then

          Comment


            #6
            I don't know if it is the best practice, but here is how I do it and it looks like it works:

            In TriggerBuildUI, I create an UID based on the trigger UID and the sUnique parameter:
            Code:
                    public string TriggerBuildUI(string sUnique, IPlugInAPI.strTrigActInfo trigInfo)
                    {
                        string UID = trigInfo.UID.ToString() + sUnique;
            then I use this UID everytime I create a control:

            Code:
            clsJQuery.jqDropList deviceDL = new clsJQuery.jqDropList("device_" + UID, PAGENAME, true);

            Comment


              #7
              Thanks spud, I do a similar to create the control. Where my problem occurs is with the local collection as shown in the sample plugin. This collection exists to improve trigger processing efficiency. I did confirm that all seems to be fine if I use both the trigger UID and event reference ID to make the trigger unique. I will just go with it as it was not too much of a change and is backward compatible with prior versions.

              Comment


                #8
                I put update 3.4.11.2 to resolve the copy event issue at http://mcsSprinklers.com/mcsMQTT_3_4_11_2.zip I do not have my plugin portal login credentials with me so will not be able to put it in the updater for a couple weeks. The only file that changed is HSPI_mcsMQTT.exe in the zip file. It can be manually placed in the HS folder when mcsMQTT is not enabled.

                Comment


                  #9
                  It works Michael ! Thanks
                  Attached Files

                  Comment


                    #10
                    Sorry for delay,
                    Thanks for getting this fixed. Works great

                    Comment


                      #11
                      I have noticed that the "Last Run" Field is copied. It would be ideal if it was "Never" after being copied
                      Low priority.... just a loose end.

                      Comment


                        #12
                        HS3 copies the event. The plugin does not know if an event was created from scratch or copied. I had expected HS3 to give the new event trigger a unique ID, but it did not. It looks to be a true copy with no consideration of implications.

                        Comment

                        Working...
                        X