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. MQTT Broker Gateway with ruby-mqtt

MQTT Broker Gateway with ruby-mqtt

Scheduled Pinned Locked Moved Controllers
6 Posts 2 Posters 5.5k Views 1 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.
  • M Offline
    M Offline
    mainali
    wrote on last edited by
    #1

    I am trying to write a ruby on rails app for controlling my house. I am using MQTT gateway from mysensor. I am able to send message using the ruby-mqtt (mqtt gem) and actuate a relay.

    The issue is I get 24 as return value for any message that I pass to the gateway. What is this '24' return value exactly. Please HELP

    M 1 Reply Last reply
    0
    • M mainali

      I am trying to write a ruby on rails app for controlling my house. I am using MQTT gateway from mysensor. I am able to send message using the ruby-mqtt (mqtt gem) and actuate a relay.

      The issue is I get 24 as return value for any message that I pass to the gateway. What is this '24' return value exactly. Please HELP

      M Offline
      M Offline
      marceloaqno
      Code Contributor
      wrote on last edited by
      #2

      @mainali Could you show us some of your app code?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mainali
        wrote on last edited by
        #3

        The following is the code I am using.

        1. I am running the mqtt gateway code in an arduino with ethernet shield taken from mysensor library.(Only changes was to enable soft SPI)

        2. Using ruby gem mqtt from ruby-mqtt.

        3. Then I am creating a client as per the documentation.
          client = MQTT::Client.connect('192.168.1.234'). My Gateway is running at the given IP.

        4. Then following the gateway code example 'broker_prefix/node_id/sensor_id/sensor_type', message

        I am sending client.publish('MyMQTT/20/1/V_LIGHT', 1) which is actuating my relay. Everything fine till here
        but the issue is I get 24 as the return value when client.publish('MyMQTT/20/1/V_LIGHT', 1) is executed. The same value comes for any sensor_id or node_id.

        Is 24, which is returned is the default value for acknowledgement ? I was not able to find code which supports my assumption.

        M 1 Reply Last reply
        0
        • M mainali

          The following is the code I am using.

          1. I am running the mqtt gateway code in an arduino with ethernet shield taken from mysensor library.(Only changes was to enable soft SPI)

          2. Using ruby gem mqtt from ruby-mqtt.

          3. Then I am creating a client as per the documentation.
            client = MQTT::Client.connect('192.168.1.234'). My Gateway is running at the given IP.

          4. Then following the gateway code example 'broker_prefix/node_id/sensor_id/sensor_type', message

          I am sending client.publish('MyMQTT/20/1/V_LIGHT', 1) which is actuating my relay. Everything fine till here
          but the issue is I get 24 as the return value when client.publish('MyMQTT/20/1/V_LIGHT', 1) is executed. The same value comes for any sensor_id or node_id.

          Is 24, which is returned is the default value for acknowledgement ? I was not able to find code which supports my assumption.

          M Offline
          M Offline
          marceloaqno
          Code Contributor
          wrote on last edited by
          #4

          @mainali I am almost certain that 24 is the number of bytes ruby-mqtt sent to the gateway.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mainali
            wrote on last edited by
            #5

            MyMQTT/20/1/V_LIGHT.bytes returns me 19, If I add 1 also in the message I get 20. I don't know how it is arriving at number 24.

            M 1 Reply Last reply
            0
            • M mainali

              MyMQTT/20/1/V_LIGHT.bytes returns me 19, If I add 1 also in the message I get 20. I don't know how it is arriving at number 24.

              M Offline
              M Offline
              marceloaqno
              Code Contributor
              wrote on last edited by
              #6

              http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html#publish

              1 Reply Last reply
              0

              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


              30

              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