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.
-
Suggested Topics
-
Contribution
General Discussion • 23 Mar 2014, 19:58 • edoardoo 23 Mar 2014, 21:40 -
Serial terminal
Controllers • 27 Nov 2014, 15:55 • dzairo 22 May 2023, 20:19 -
Homie MySensors bridge Controller. For use in OpenHab 3 (and others)
Controllers • 16 Jan 2021, 13:32 • David Dawson 18 Apr 2021, 16:22 -
Best choise for a controller
Controllers • 22 Dec 2019, 19:45 • dzjr 8 Mar 2021, 17:57 -
How can I choose a controller?
Controllers • 18 Feb 2022, 21:56 • Feliw05 20 Feb 2022, 18:25 -
testing with different controllers (mqtt brokers)
Controllers • 4 Jan 2023, 16:48 • OldSurferDude 5 Jan 2023, 07:26