Announcement

Collapse
No announcement yet.

mcsMQTT not staying subscribed to topic

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

    mcsMQTT not staying subscribed to topic

    Hello,

    I have setup a topic which mcsMQTT subscribes to and a couple of other devices. I have proven mcsMQTT receives messages.
    When I send a message to the topic from HS(see test screen shot), it looks like from that point mcsMQTT is no longer subscribed to the topic, and does not then receive any more messages on the said topic.

    There are a couple of device also attached to the same topic. They both continue receive messages to the same topic that mcsMQTT is/was subscribed to.

    A restart of HS, then allows mcsMQTT to receive messages again.

    I have included screenshots, the topic setup, the event that HS is setup to receive the message and the test message script.

    Reagrds John
    Attached Files

    #2
    Enable debug from the top of the General tab. Collected data will be in \data\mcsMQTT\mcsMQTT Debug.txt. Received messages will be lines containing something like "Act On Message for Trigger".

    Comment


      #3
      I did initially do so... I will again and report

      Comment


        #4
        OK, I have reun the tests....

        In the debug file I can see the incoming message

        02/12/2020 17:25:23 5595669 | ManageNewMessage home/pi1/doorbell/status
        02/12/2020 17:25:23 5595669 | ActoOnMessageForTrigger Topic home/pi1/doorbell/status,Payload={"TimeStamp": "2020-12-02 17:25:23", "action": "rung"}, Triggers=1
        02/12/2020 17:25:23 5595669 | Triggered1=True

        Which calls the HS event fine.

        I then run the test event, see screenshots, this correctly sends a message to the device.

        After this point I cause the doorbell to operate, thus I should see the Trigger event again, I do not.. only the following event in the log file, it does not trigger the event.

        02/12/2020 17:32:51 6044261 | ProcessMessage New home/pi1/doorbell/status

        and even if I recreate the the run message, the same line appears in the logfile, well different datetme stamp.

        John

        Comment


          #5
          You are using the same Topic for both publish and subscribe. mcsMQTT protects from circular logic and will ignore received topics that mcsMQTT has published. Typical systems will use /set, /command, /cmnd, etc. added to the status (subscribe) topic as the command (publish) topic so that the end point knows if it should treat the topic as something that it needs to act upon or is something that is a status update from something else.

          Comment


            #6
            I have most of my MQTT setup in the command/response pattern, must admit this is not quite the same.. maybe a rethink, I did wonder if it was that, trying to save some code.. doh

            Comment


              #7
              Refactored code, working as it should.

              Comment

              Working...
              X