Announcement

Collapse
No announcement yet.

Different Buttons = different payload, want to display payload

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

    Different Buttons = different payload, want to display payload

    Hello,

    I have a setup a device from mcsMQTT, see below. I would like to set the status text to the return payload of each of the buttons.
    i.e. If I press 'SetA' I would get a return payload relating to it, i.e. 'Hello World' however it might not be this said value. 'SetB' would return different messages, aka 'Good Morning'

    I'm struggling on how to do this, I seem only to be able to get the Homesser value.

    Regards John

    Click image for larger version

Name:	HS-MQTT-Example.png
Views:	132
Size:	67.7 KB
ID:	1392091

    #2
    On the Edit tab I assume you have selected Button as the Control/Status UI radio.
    There will be a VSP list that maps "Set A" and "Set B" to values. Take a look at Figure 67 in the manual.
    I think what you are trying to achieve a Button Label "Set A", a DeviceValue 0 and a Status "Hello World". This would be VSP entry of "Set A=0;Hello World" (without quotes)
    In the Payload template textbox use $$STATUS:. If you wanted "Set A" to be sent then it would be $$LABEL:. If want 0 to be sent then it would be blank or $$VALUE:

    I many not have understood your request exactly, but the above may give you some direction.

    Comment


      #3
      I'm not sure I have explained myself.. when 'Set A' is pressed a message is returned in the status payload, which is not always the same content, thus I would like the status to be a text area, the same is also true of pressing the 'Set B' button.

      I know there is a text status, but that seems to go hand in hand with a text command. Not really applicable in the way I need it operating.

      John

      Comment


        #4
        I believe what you want mcsMQTT to do is to write to the DeviceString rather than DeviceValue on the received payloads for this topic. You will still have the buttons that will send either 0, 1 or Set-A, Set-B payloads for the HS Device UI

        Have I got this correct?

        Comment


          #5
          I implemented what I proposed above. It is at http://mcsSprinklers.com/mcsMQTT_5_2_10_0.zip. Extract HSPI_mcsMQTT.exe into HS folder and mcsMQTT_2020.dll into \bin\mcsMQTT folder.

          Notice the elipsed settings below as well as the VSP definition below it. The HS device has the control buttons and the status reflects the payload text received.


          Click image for larger version

Name:	Capture1.PNG
Views:	96
Size:	36.1 KB
ID:	1394052



          Click image for larger version

Name:	Capture.PNG
Views:	104
Size:	221.7 KB
ID:	1394051

          Comment


            #6
            Hello,
            Copied the files as instructed, restart HS3, got the following error in the HS3 startup window

            16/06/2020 11:31:42 ~!~Error~!~Error, Creating plugin instance: HSPI_MCSMQTT.exe-old->Exception has been thrown by the target of an invocation.->Could not load file or assembly 'MCSMQTT_2020, Version=5.2.4.9, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

            Comment


              #7
              It looks like HSPI_MCSMQTT.exe is version 5.2.4.9 rather than 5.2.10.0. I recompiled and uploaded again http://mcssprinklers.com/mcsMQTT_5_2_10_0.zip.
              Make certain mcsMQTT is not enabled. Extract the two files and put them in their respective places. Enabled mcsMQTT.

              Comment


                #8
                I have got 5.2.4.10 running, However the device buttons no longer work, I sent messages to the mqtt broker from the linux command line to simulate the buttons, and I could see the status payload in the homeseer device.
                I swapped back to 5.2.4.9 and the device buttons started working again. However, as expected the payload did not get shown on the device
                I did check the debug output of the device, and I could not see the command messages being delivered on the 5.2.4.10, with 5.2.4.9 I could see the command messages.

                Comment


                  #9
                  Any hints as to the payload you want to send for the SetA and SetB buttons? The payload template is what is used to select the desired property with replacement variables $$LABEL: or $$VALUE: and do any replacements to get things into the exact format expected at the other end.

                  Comment


                    #10
                    I have carried out some more testing this morning.
                    I have stopped HS3
                    Replaced the two files with version 5.2.4.10
                    Restarted HS3

                    On the broker machine (linux)
                    Ran a tcpdump using the IP of the HS3 machine and port 1883
                    I do not see any packets when I press any on the buttons on the device (homeseer web page).
                    I have a second device setup that just uses the standard, on/off graphics, even this does not work on 5.2.4.10.

                    I then stoppedHS3
                    Replaced the two files with version 5.2.4.9
                    Restarted HS3

                    On the broker machine (linux)
                    Ran a tcpdump using the IP of the HS3 machine and port 1883
                    I can see packets flowing when I press any buttons associated with mcsMQTT devices (homeseer web page).

                    All I can conclude is that version 5.2.4.10 is not processing 'command' messages out.

                    Regards John

                    Comment


                      #11
                      I replicated my test and it works as I expect. If payload template is $$VALUE then it sends a number. If it is left blank then it sends the status text. There is a debug option at the top of the general page. It will put data in \data\mcsMQTT\mcsMQTT debug.txt file such as incoming and outgoing MQTT traffic and the processing of the button controls from HS. If you provide screenshots of the Edit tab for this device then I can be more specific. You also did not indicate what type of payload output you are expecting for the two buttons.

                      Comment


                        #12
                        Hello,

                        I have recreated the device, this time using 'on', and 'off', you will be able to see from the images. The command home/pi24/test/command will have a payload of either 'on' or 'off', case does not matter. When the real device gets the command 'on' it will return 'Started' if sent 'off' it will return 'Stopped' in the message home/pi24/test/status

                        I turned on the debugging as you mentioned.
                        I pressed each button and then investigated the said log, no entries relating to anything to do with home/pi24/test/command, nor anything close.

                        I then sent a message to the broker via the linux broker machine. I sent home/pi24/test/command with a payload of 'on', you will see from the images that this did get received and displayed.

                        Hope this helps.

                        Regards John


                        Attached Files

                        Comment


                          #13
                          In general your setup looks good with only exception being the payload template.

                          The line of interest in the log starts with "SetIOMulti 1546". This is when HS calls the plugin to act upon the command provided. If this is not visible the the plugin is never being called. For evaluation try both the On and Off buttons as it could be that HS will not call the plugin if the button value is the same as the device value. I don't think this is the case, but just trying to think of reasons a call is not made. There may be some other lines immediately after it that follow the logic within the plugin. They do not mean anything to you, but they would mean something to me.

                          HS provides a Value and a Label with the command. The default is to use the label (i.e. label on the button which will be on/off in this example). To explicitly specify its use then the payload template is $$LABEL:. To use the Value it is $$VALUE:

                          While not part of the problem, another option you have is to use the Value or Label with substitution. For example, if you want you button to be labeled Start and Stop and you want the command to be On and Off then you could do something like the following for payload template. The double less-than, greater-than indicates an inline expression. The Replace operator has three parameters. The various expressions available are shown in a table in the manual. I did not try these specifically, but should work or be close.
                          Code:
                          <<Replace(Replace($$LABEL:,"Start","On"),"Stop","Off)>>
                          <<Replace(Replace("$$VALUE":,"1","On"),"0","Off)>>

                          Comment


                            #14
                            Here is the log for the "SetIOMulti 1546" entries.., on and off buttons pressed.

                            20/06/2020 21:18:13 87526134 | SetIOMulti 1546, oCAPI.ControlType=Button, MQTTReceiveRefDictionary.Contains=True
                            20/06/2020 21:18:14 87526587 | HSEvent VALUE_CHANGE| 1024| C55E86C6-050-Q3| 117| 94.9| 1197
                            20/06/2020 21:18:15 87527385 | HSEvent VALUE_CHANGE| 1024| C55E86C6-010-Q62| 197.7| 198.4| 1408
                            20/06/2020 21:18:16 87528415 | ActoOnMessageForTrigger Topic home/shed/status,Payload=Ready, Triggers=0
                            20/06/2020 21:18:17 87529402 | SetIOMulti 1546, oCAPI.ControlType=Button, MQTTReceiveRefDictionary.Contains=True
                            20/06/2020 21:18:18 87530260 | HSEvent VALUE_CHANGE| 1024| C55E86C6-053-Q16| 37.4| 38.7| 1330
                            20/06/2020 21:18:18 87530600 | HSEvent VALUE_CHANGE| 1024| C55E86C6-050-Q3| 96.4| 117| 1197
                            20/06/2020 21:18:18 87531093 | ActoOnMessageForTrigger Topic home/shed/status,Payload=Ready, Triggers=0
                            20/06/2020 21:18:20 87532399 | HSEvent VALUE_CHANGE| 1024| C55E86C6-010-Q62| 198.1| 197.7| 1408
                            20/06/2020 21:18:20 87532756 | HSEvent VALUE_CHANGE| 1024| C55E86C6-013-Q24| 15.5| 15.9| 1280

                            Comment


                              #15
                              Hello,

                              Tried changing the on and off to SetA and SetB, made no difference :-(, Have posted the log in next messaage

                              Comment

                              Working...
                              X