Announcement

Collapse
No announcement yet.

retain flag not being set.

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

    retain flag not being set.

    I have gone to the setup pages, and in the "Outbound (Publish) Management" page if have set the "Default Message Retain" to "Retain at Broker", yet the flag isn't being set from my MQTT publish events in automations.

    I have tried restarting they system. Still doesn't send messages with retained flag set.

    Is this feature broke?

    Thanks,
    Marc

    #2
    Michael McSharry you still maintaining this package? thanks!

    Comment


      #3
      I have been on vacation and did not have a means to provide a meaningful response until now. I associated a device and a publish topic. I used the edit tab to change the retain flag from false to true. I triggered a change to cause a message to be published. In the debugger I trapped on the call to M2Mqtt.dll library that I am using and see that the retain flag was set to true. What do you use to assess the retain flag being true or false?

      Comment


        #4
        Originally posted by Michael McSharry View Post
        I have been on vacation and did not have a means to provide a meaningful response until now. I associated a device and a publish topic. I used the edit tab to change the retain flag from false to true. I triggered a change to cause a message to be published. In the debugger I trapped on the call to M2Mqtt.dll library that I am using and see that the retain flag was set to true. What do you use to assess the retain flag being true or false?
        Thank you very much for looking into this so quickly upon your return!

        I publish messages from HS3 to Mosquitto broker 1.4.15, then from MQTT.fx i subscribe to that topic, it grabs the messages from the broker and will show if its a retained value, or not. Since it isn't retained, I don't see the latest messages.

        If I use the script method you have in your package, which I then set the retain flag, it works fine.

        Code:
        {"iot/rgbstatus/state/" & parms(0), parms(1), "EXACTLY_ONCE", "TRUE"}
        So for some reason on my install, the Event trigger MQTT message sending isn't listening to my global setting of True for retain flags

        Comment


          #5
          mosquitto logs:

          HS3 Event message:

          Code:
          Received PUBLISH from 51ae30f8-825d-4f72-8f19-XXX (d0, q0, r0, m0, 'iot/rgbstatus/status/2', ... (7 bytes))
          you see that "r0"

          Same message from MQTT.fx

          Code:
          Received PUBLISH from MQTT_FX_Client (d0, q0, r1, m0, 'iot/rgbstatus/status/2', ... (7 bytes))
          you see that "r1" is set...

          I'm assuming that is the retain flag.

          Comment


            #6
            There are about half-dozen publish instances. One is the Event Action that was not updated from false to global when the global option was added. I corrected it in 3.4.6.2 and submitted to updater. It is also at http://mcsSprinklers.com/mcsMQTT_3_4_6_2.zip.
            If this is not what you mean by "Event trigger MQTT message" then let me know exactly what you are doing to publish with the retain set false. Also thank you for the info on the Mosquitto status.

            Comment


              #7
              Thanks Michael McSharry i look forward to testing.
              I mean this Event doesn't use the global retain flag:

              Click image for larger version

Name:	mcsmqtt-event-retain-not.PNG
Views:	62
Size:	26.0 KB
ID:	1243189

              Comment


                #8
                If you find yourself with time; I'd love to see an option in the Event "Send Mqtt Message" to set the retain flag per event, perhaps with another '=' to separate out the True/False

                Comment


                  #9
                  What are you doing in the Action that cannot be done in one-line script where both QOS and retain can be specified? It may also be easier to change a device to publish the desired message. The device also gives you full control of both QOS and retain.

                  Comment


                    #10
                    Originally posted by Michael McSharry View Post
                    What are you doing in the Action that cannot be done in one-line script where both QOS and retain can be specified? It may also be easier to change a device to publish the desired message. The device also gives you full control of both QOS and retain.
                    For now, Just send status changes based upon a set of conditions (set an RGB led).
                    I don't know scripting much. I did find and use a script from your docs (more than 1 line, but easy enough to setup with variables, which is what I was using). But I like your trigger better for reading once setup.

                    I will look into the device status change notification as well, thanks!

                    Comment


                      #11
                      Perhaps if you explain more fully what "send status changes" is then further suggestions can be made. Typically a device contains the status and when the status changes then the MQTT message with that status is published. This way all management is done via the device and dont need to be concerned with maintaining events. If it is the case where only some status changes are to be published then an event may be required.

                      Comment

                      Working...
                      X