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. Development
  3. LAN connected MQTT nodes

LAN connected MQTT nodes

Scheduled Pinned Locked Moved Development
8 Posts 3 Posters 2.0k Views 4 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.
  • 8 Offline
    8 Offline
    8667
    wrote on last edited by
    #1

    I try to rebuild my custom Arduino nodes with MySensors platform. Need some input as I can not recreate all functions I need.

    I have 3 Arduino/ethernet boxes. By removing radio definitions I can make them act as individual gateways with their own root MQTT topic. In essence, they will have 6 digital inputs and 8 outputs/relays (will see how many pins are free at the end).

    1. I selected different MQTT topics for each gateway as they all have NODE_ID 0 (hardcoded by MySensors). How to control/differentiate if all 3 post to the same topic? By sensor ID?

    2. There is no support for MQTT Last Will in MySensors from what I searched... that is a pity. I will probably invent phantom sensor as a heartbeat that will contain a random value, then inspect that on a higher level (NodeRED most likely)

    3. Is there a way to know the MQTT status from inside the node? For example, if my node/gateway loose Ethernet or the MQTT broker is down I want to set relays to a safe state.

    4. Is there a watchdog implemented in the Arduino code by default? I know that Arduino can reset itself if stuck for longer then 8 secs (not getting confirmation message).

    1 Reply Last reply
    0
    • 8 Offline
      8 Offline
      8667
      wrote on last edited by
      #2
      1. I found that I can check like this

      if (_MQTT_client.connected())
      {

      }

      1 Reply Last reply
      1
      • mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #3

        For question 1, use MY_MQTT_CLIENT_ID and/or MY_MQTT_PUBLISH_TOPIC_PREFIX.

        8 1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          For question 1, use MY_MQTT_CLIENT_ID and/or MY_MQTT_PUBLISH_TOPIC_PREFIX.

          8 Offline
          8 Offline
          8667
          wrote on last edited by
          #4

          @mfalkvidd Yes I settled for different MY_MQTT_PUBLISH_TOPIC_PREFIX. per device. but the Client_ID can not be defined for gateway...but that is not a problem now

          mfalkviddM 1 Reply Last reply
          0
          • 8 8667

            @mfalkvidd Yes I settled for different MY_MQTT_PUBLISH_TOPIC_PREFIX. per device. but the Client_ID can not be defined for gateway...but that is not a problem now

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #5

            @8667 that’s strange. The documentation says

            Set client ID for MQTT connections.

            This define is mandatory for all MQTT client gateways.

            Sonit seems to be for gateways. I have never used it myself though.

            8 1 Reply Last reply
            0
            • mfalkviddM mfalkvidd

              @8667 that’s strange. The documentation says

              Set client ID for MQTT connections.

              This define is mandatory for all MQTT client gateways.

              Sonit seems to be for gateways. I have never used it myself though.

              8 Offline
              8 Offline
              8667
              wrote on last edited by
              #6

              @mfalkvidd I was talking about MY_NODE_ID As each device will be a gateway with onboard sensors only they all have I think 1 as ID by default and that can not be changed.

              MY_MQTT_CLIENT_ID is different as I create different MQTT user/pass for each device

              For 2. I created a fake sensor that I update with 1 each minute.

              present(99, V_VAR1, "Status");

              Then at the software side (NodeRED) I create additional logic to find out if the device is dead.

              1 Reply Last reply
              0
              • CarywinC Offline
                CarywinC Offline
                Carywin
                wrote on last edited by
                #7

                You don’t need MySensors for a direct connection to MQTT. Just use pubsubclient.

                8 1 Reply Last reply
                0
                • CarywinC Carywin

                  You don’t need MySensors for a direct connection to MQTT. Just use pubsubclient.

                  8 Offline
                  8 Offline
                  8667
                  wrote on last edited by
                  #8

                  @carywin Yes I know. I had my own "firmware" for few years but I want to use something mainstream that will be easier to maintain (by someone else :) ).

                  1 Reply Last reply
                  1

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  21

                  Online

                  12.0k

                  Users

                  11.2k

                  Topics

                  113.4k

                  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