Announcement

Collapse
No announcement yet.

Getting started with McsMQTT

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

    #16
    Originally posted by Michael McSharry View Post
    Do not include the JSON payload as part of the Topic in the event trigger. The JSON payload breakdown follows the colon. For example, your last screen shot should be tele/tasmota_5AF25D/RESULT
    This worked! Thank you and sorry for the hand holding. I could start to build logic off of this, but I feel like it would be good to invest some time into translating the payloads from "26D406" to something like "hallway motion". Is this something that I should do in HS4 with virtual devices, or is this something better suited within the mcs addon?

    At one point I was able to use the payload replace function to replace one of my other sensor payloads "16D123" with "motion", but I could not figure out how to do this same action with multiple sensor payloads. Is there a best practice for something like this?

    Later in the project, I have a door sensor that broadcasts "705C0A" for an opening and a "705C0E" for closing. I see that there is a way in mcs to group items like this so I feel like I will need to learn how to use some of the more advanced features soon.

    Comment


      #17
      For the MQTT Receive trigger there is no way to use friendly names for the hex codes. In this case since each event trigger will be for a specific hex code I would use the name of the trigger as the means to document the friendly name.

      If using the Device with List or Button type Status/Control UI you are able to provide a different status vs. control so that a button, for example, will have a different label than the displayed status. (e.g. button label is "Close" and status shows "Closed"). When I look at the Elevate today I will also take a look at setting this up. You will notice in the referenced figure in the document I did this to document "RoadMotion" for one of the hex codes.

      Picking out two hex codes out of a list may be a different problem depending upon what you want to show in HS. When Elevate is used then there is suppose to be an row in the Association table for each of the Hex codes from which you can then use the "A" checkbox to associate with HS device. In this case you will not use the "A" checkbox for the second, but use the Ref text box to enter the Ref number of the first of the one that was already associated. This way either code would update the same HS device. The other thing you would need to do is something such that the DeviceValue being updated is uniquely different between the two. Once I review what is happening with Elevate I can provide some suggestions.

      Comment


        #18
        I had forgotten that E column on Association is Express and not Elevate. The elevate function is at the top of the Edit tab. The process is to "A"ssociate the topic that has the keys being received. Click on the newly created Ref button on that row and then at the top right use the checkbox to elevate the JSON payload value to be treated as a JSON key and then handled by mcsMQTT as JSON-enhanced Topic.

        In my example I have two message with data JSON key being "key1" and "key2" and the JSON payload also contains a JSON key of "value". The association table now has rows for key1:value and key2:value. I associated each of these two to create two additional HS devices. Now there is the parent and three children.

        I looked at the VSP Control vs. Status and see that the Status is what is reported via MQTT payload and if a text string is added to the Edit tab VSP then it becomes the control. This is just the opposite of what you want for this situation. I will look at adding provision to swap these, but first let us see what you actually want to do.
        Click image for larger version

Name:	Capture1.JPG
Views:	122
Size:	61.2 KB
ID:	1487277

        Click image for larger version

Name:	Capture2.JPG
Views:	99
Size:	49.6 KB
ID:	1487278

        Click image for larger version

Name:	Capture3.JPG
Views:	99
Size:	29.3 KB
ID:	1487279

        Comment


          #19
          Moving on to the subject of two RF codes mapped into a single HS device. I gave it a try with my test cast of key1 and key2 message. In this case I first Associated data:key1. Then I used the Ref from this to enter into the text box for key2. I use Edit tab to assure Control/Status UI is Button. The created device will take on a value of 0 or 1 depending upon if the first or second RF code is received. This means that the created HS device can be used to trigger one code vs. the other code.

          Click image for larger version

Name:	Capture1.JPG
Views:	98
Size:	31.6 KB
ID:	1487305

          Comment


            #20
            I made updates to allow two buttons to be assigned and take on the text and values of each topic's VSPs. This update is at

            HS3: http://mcsSprinklers.com/MCSMQTT_51740.zip
            HS4: http://mcsSprinklers.com/MCSMQTTHS4_51740.zip

            Note that the Edit tab VSP now allows another parameter to be more explicit about controls vs. status of HS devices. Format is MQTTtext=HSValue;HSControlText;HSStatusText. This should allow you to get whatever text you want in HS which is independent of the text in the MQTT payload.

            Comment

            Working...
            X