Announcement

Collapse
No announcement yet.

Wildcard Template for Auto-Association of MQTT control topics to existing HS devices

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

    Wildcard Template for Auto-Association of MQTT control topics to existing HS devices

    Introduced in 3.4.13.0 of mcsMQTT is a time-saving feature for those who have the ability to publish standard topic formats to control HS devices. The topic will include the HS Device Reference. When the wildcard template is setup (General Tab, Incoming Subscription Management) mcsMQTT will match it with existing HS device and make an automatic acceptance. Default publish and payload templates will be associated so when the device changes it will be reported via MQTT. Once setup it is possible to edit any of the properties on a Device by Device basis. The manual was updated to reflect a use-case example and as a method to assign Topics to existing HS devices.

    #2
    AWESOME!

    Comment


      #3
      The PDF manual is not extracting for me.
      Anyone else have this problem?

      Comment


        #4
        The pdf is also at http://mcsSprinklers.com/mcsMQTT.pdf

        It extracts for me from the zip using Windows 7 and Windows Explorer.

        Comment


          #5
          As I uncovered windows I see that the upload had not completed. It is complete now.

          Comment


            #6
            mcsMQTT is substituting spaces for %20's in MQTT topics for both subscribe and publish.
            Any chance we could change that or have a regex replacement we can run against the topic?

            Backwards incompatible change though

            Comment


              #7
              Not trying to be a drag...
              Subscriptions would be much more useful for me if there was access to;
              $$ROOM:
              $$TYPE:
              $$NAME:

              It appears only $$REF: works for subscriptions

              Not sure how your accomplishing the subscription
              What do you think about something like

              PHP Code:
              WILDCARD_MASK "Home/$$ROOM:/$$TYPE:/$$NAME:"
              for device in all_devices:
                  
              mqtt.subscribe(WILDCARD_MASKdevice

              Comment


                #8
                I can make the wildcard more generic to include the other appropriate substitution patterns.

                I believe the %20 is being done outside of mcsMQTT. Could be in the M2Mqtt library or by the broker. I will investigate a little.

                Comment


                  #9
                  Submitted to Updater and available at http://mcsSprinklers.com/mcsMQTT_3_4_14_0.zip contains the update to allow use any of the Topic substitution parameters in the manual's Table 1.

                  I also published a topic with %20 embedded and the %20 was shown on the mcsMQTT association tab for the message. Could it be your observation is based upon your client that may have converted the %20 into space before it sent it to the broker?

                  Comment


                    #10
                    I am using mosquitto as my broker
                    My clients are Node-RED and MQTT.fx java app on windows.

                    Both clients receive for example
                    PHP Code:
                    Home/Deck/Z-Wave%20Switch%20Multilevel/Deck%20Light%20Dimmer/Status 
                    This is using outbound template
                    PHP Code:
                    Home/$$ROOM:/$$TYPE:/$$NAME:/Status 
                    The Type and Name are actual spaces in homeseer obviously.

                    I get the following results from testing
                    HS3 -> Node-Red = %20
                    HS3 -> MQTT.fx = %20
                    MQTT.fx -> Node-Red = Space Character
                    Node-Red -> MQTT.fx = Space Character
                    MQTT.fx -> mcsMQTT = Space Character (In association tab)

                    Comment


                      #11
                      Can you explain exactly when the subscriptions are updated.

                      For example if I have set inbound wildcard to
                      Home/Control/$$REF:/Command
                      I send a message to Home/Control/101/Command=60 and it works

                      I then change inbound wildcard to
                      Home/Control/$$NAME:/Command
                      I send a message to Home/Control/Deck Light Dimmer/Command=60 and it does NOT work
                      I send a message to Home/Control/101/Command=60 and it works

                      I've resorted to deleting the entire database during testing here but it's a bit confusing

                      Comment


                        #12
                        I can get these working
                        Home/Control/$$NAME:/Command
                        Home/Control/$$REF:/Command

                        I can not get these working
                        Home/Control/$$TYPE:/$$NAME:/Command
                        Home/Control/$$ROOM:/$$NAME:/Command

                        **
                        Also cannot get this working
                        Home/Control/$$NAME:/$$REF:/Command

                        Comment


                          #13
                          The wildcards are processed during non-plugin device enumeration. This is done at startup and done when the button on bottom of General tab is used. This was done to minimize the time it takes to evaluate each received message. I can see that I should rebuild automatically if wildcard template is changed. I'll do this in next update.

                          The topics are case-sensitive so make certain room names obey the case of what is in HS

                          $$TYPE: is DeviceTypeString property of the device

                          $$ROOM: is Location property of the device

                          $$FLOOR is Location2 property of the device

                          Use of any substitution in addition to $$REF: is not a good idea because $$REF: is unique and needs no further specification. If you ever get out of sync between name and ref in your example it will not recognize the topic.

                          Do any of these help?

                          Comment


                            #14
                            Yes I can get the output of all these wildcard on the publish side of mcsMQTT
                            I use this below to ensure I generate valid data
                            PHP Code:
                            Publish MaskHome/$$ROOM:/$$TYPE:/$$NAME:/Status
                            Publish Result
                            Home/Deck/Z-Wave%20Switch%20Multilevel/Deck%20Light%20Dimmer/Status

                            Ideal Subscribe Mask
                            Home/$$ROOM:/$$TYPE:/$$NAME:($$REF:)/Command 
                            I could not get the above subscription to work.
                            So I simplified and tried the ones below

                            PHP Code:
                            Home/Control/$$REF:/Command
                            Home
                            /Control/101/Command with payload 60
                            WORKS

                            Home
                            /Control/$$NAME:/Command
                            Home
                            /Control/Deck Light Dimmer/Command with payload 60
                            WORKS

                            Home
                            /Control/$$NAME:/$$REF:/Command
                            Home
                            /Control/Deck Light Dimmer/101/Command with payload 60
                            NOT working 
                            I watch the mcsMQTT debug.log to ensure the messages are received. (which they are)
                            11/28/2018 3:57:51 PM 3156772 | ActoOnMessageForTrigger Topic Home/Control/Deck Light Dimmer/101/Command,Payload=50


                            Could you see if Home/Control/$$NAME:/$$REF:/Command works on your end?

                            Comment


                              #15
                              My mistake. Corrected in 3.4.14.1. http://mcsSprinkers.com/mcsMQTT_3_4_14_1.zip. It should also have the refresh after change of template, but have not confirmed this yet. Dinner time now.

                              Comment

                              Working...
                              X