Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. OpenHAB
  4. MQTT losing messages...

MQTT losing messages...

Scheduled Pinned Locked Moved OpenHAB
7 Posts 3 Posters 80 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ben999B Offline
    ben999B Offline
    ben999
    wrote on last edited by ben999
    #1

    Hi guys,

    Long story cut short :

    I've had lots of "temporary gone bad nodes" since migrating from serial to mqtt.

    Nodes that are normally working fine but then stop responding (most annoying being the one driving the garage door motor :scream: i now keep a key anytime with me instead of just relying on openHab...). A reboot cures it.

    So i decided to design a simple logger with arduino + sd card + rtc.

    Beside that i am also designing an automatic cat flap locking node, so cats dont go out at night. As i dont want any rtc on that node, i rely on time supplied by controller with requestTime(). So here i am trying to understand how to send that request to controller via mqtt by sending publications...

    That's how i discovered that many publications are lost.

    What do you suggest to investigate further ? I might have reached my limits... :grimacing: some help would be welcome :+1:

    Thanks a lot :blush:

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JeeLet
      wrote on last edited by
      #2

      Hello

      can you tell us more about your mysensors architecture.
      see the chain of elements, hardware and software.

      your message is about : Mqtt 'mosquitto? - OpenHab - Arduino" uno?"

      ben999B 1 Reply Last reply
      0
      • J JeeLet

        Hello

        can you tell us more about your mysensors architecture.
        see the chain of elements, hardware and software.

        your message is about : Mqtt 'mosquitto? - OpenHab - Arduino" uno?"

        ben999B Offline
        ben999B Offline
        ben999
        wrote on last edited by
        #3

        @JeeLet thanks a lot for your message

        You're right :

        • openhab 3
        • Raspberry Pi 3 MQTT gateway with Mosquitto
        • arduino nodes
        • nRF24 network

        TBH i don't know where to start, so difficult to point a finger...

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JeeLet
          wrote on last edited by
          #4

          here can be the beginning of an answer:
          https://forum.mysensors.org/topic/812/realtimeclockdisplaysensor-ino-no-fetch-time-from-controller

          "I don't know where to start," ... in a chain there are
          links, see which one is at fault

          "defective" since the migration from serial to mqtt" ...? what does it mean?

          I dialogue with you, but without really knowing, just to create a chain reaction of ideas :)

          maybe others have an idea !??

          Translated with www.DeepL.com/Translator (free version)

          1 Reply Last reply
          0
          • OldSurferDudeO Offline
            OldSurferDudeO Offline
            OldSurferDude
            wrote on last edited by
            #5

            I'm not familiar with Hab. Does it include an MQTT broker or is Hab a client? If the latter, on what machine are you running the MQTT broker? I have put the broker in three places, 1) the same RPi as the MySensors MQTT Gateway, 2) a separate linux box, 3) the same linux box as Home Assistant. I haven't had any reason the think that MQTT had problems.

            Now if you have multiple nodes publishing to the same MQTT topic, you can and probably will see messages getting lost. This is because one node can overwrite another's message before the client picks up the message. Each node should be sending messages to its own topic.

            I like the cat door project :)

            OSD

            ben999B 1 Reply Last reply
            0
            • OldSurferDudeO OldSurferDude

              I'm not familiar with Hab. Does it include an MQTT broker or is Hab a client? If the latter, on what machine are you running the MQTT broker? I have put the broker in three places, 1) the same RPi as the MySensors MQTT Gateway, 2) a separate linux box, 3) the same linux box as Home Assistant. I haven't had any reason the think that MQTT had problems.

              Now if you have multiple nodes publishing to the same MQTT topic, you can and probably will see messages getting lost. This is because one node can overwrite another's message before the client picks up the message. Each node should be sending messages to its own topic.

              I like the cat door project :)

              OSD

              ben999B Offline
              ben999B Offline
              ben999
              wrote on last edited by ben999
              #6

              @JeeLet
              @OldSurferDude

              Thank you both :+1:

              My Raspberry 3 does it all :

              • gateway with nrf24 module (standard one)
              • mysensors MQTT gateway
              • Mosquitto broker

              MQTT Explorer has been installed on my fav laptop and it helps seeing clearer.

              Nevertheless i cannot reproduce the errors.

              I have multiple points of view:

              • node : using arduino ide serial monitor
              • mysensors gateway: using tail log in a terminal window
              • openHab : using tail log in an internet explorer window
              • MQTT explorer : in its own window

              I can sent MQTT messages from different devices :

              • iOS openhab from my phone
              • openhab (basic UI) from an internet explorer window
              • MQTT explorer (messages can be made-up, very cool tool)
              • terminal window (linux laptop via ssh)

              The less reliable way of sending MQTT message is via terminal : after 2 to 10 succesfull messages it then stops working. At first, node receives messages and processes them (servo moves). But after a few messages, node doesn't receive anymore. MQTT Explorer shows the change of state of the topic but message doesn't go anyfurther... no other monitor show a change.

              @OldSurferDude i'm not sure i understand

              Each node should be sending messages to its own topic.

              Can the mysensor gateway subscribe to more than one topic (which is mysensors-in at the mo) ?

              Thanks a lot for helping me through :blush:

              1 Reply Last reply
              0
              • OldSurferDudeO Offline
                OldSurferDudeO Offline
                OldSurferDude
                wrote on last edited by
                #7

                @ben999

                Check out Serial Protocol

                I have four Arduinos. Each has a different MY_NODE_IDs (I use 130, 131, 132, 133). Each has four sensors: moisture, humidity, temperature, and voltage each of which has a CHILD_ID: CHILD_ID_MOISTURE is 0 , CHILD_ID_HUMIDITY is 1, CHILD_ID_TEMPERATURE is 2, CHILD_ID_VOLTAGE is 3.

                When an Arduino makes a measurement, it sends that measurement to a unique MQTT topic. In the case of the Arduino with MY_NODE_ID of 130 that is sending the moisture measurement, that MQTT topic is mysensors_out/130/0/1/0/35 and the message is [something like] 760 (35 is the value type)

                Similarly, when a controller sends a command to a device (Arduino), the topic is unique.

                If you have two actuators with the same MY_NODE_ID and CHILD_ID (MQTT topic) there would be confusion as to what you want each actuator to do. Likewise, if two sensors had the same MQTT topic, how would the controller know how to handle the data.

                1 Reply Last reply
                1
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                34

                Online

                11.7k

                Users

                11.2k

                Topics

                113.1k

                Posts


                Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • MySensors
                • OpenHardware.io
                • Categories
                • Recent
                • Tags
                • Popular