MQTT Broker Gateway with ruby-mqtt
-
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
-
@mainali Could you show us some of your app code?
-
The following is the code I am using.
-
I am running the mqtt gateway code in an arduino with ethernet shield taken from mysensor library.(Only changes was to enable soft SPI)
-
Using ruby gem mqtt from ruby-mqtt.
-
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. -
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.
-
-
@mainali I am almost certain that 24 is the number of bytes ruby-mqtt sent to the gateway.
-
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.
-