Viewing MQTT messages

jetpax
Posts: 5
Joined: Mon Feb 20, 2023 9:58 pm

Viewing MQTT messages

Postby jetpax » Mon Nov 04, 2024 4:07 pm

Is there a way to view the MQTT messages sent by the node and received by the Rainmaker broker during development?

aliarifat794
Posts: 198
Joined: Sun Jun 23, 2024 6:18 pm

Re: Viewing MQTT messages

Postby aliarifat794 » Tue Nov 05, 2024 1:42 pm

You need to install the rainmaker CLI

Code: Select all

pip install espressif-rainmaker-cli

jetpax
Posts: 5
Joined: Mon Feb 20, 2023 9:58 pm

Re: Viewing MQTT messages

Postby jetpax » Tue Nov 05, 2024 4:11 pm

Thank you.

Which of the commands below allows me to do that?

Code: Select all

\usage: esp-rainmaker-cli [-h]
                         {configure,signup,login,logout,forgotpassword,getnodes,getnodeconfig,getnodestatus,setparams,getparams,removenode,provision,getmqtthost,claim,test,otaupgrade,getuserinfo,sharing,create_cmd_request,get_cmd_requests} ...

positional arguments:
  {configure,signup,login,logout,forgotpassword,getnodes,getnodeconfig,getnodestatus,setparams,getparams,removenode,provision,getmqtthost,claim,test,otaupgrade,getuserinfo,sharing,create_cmd_request,get_cmd_requests}
                        Functions
    configure           Configure ESP RainMaker
    signup              Sign up for ESP RainMaker
    login               Login to ESP RainMaker
    logout              Logout current (logged-in) user
    forgotpassword      Reset the password
    getnodes            List all nodes associated with the user
    getnodeconfig       Get node configuration
    getnodestatus       Get online/offline status of the node
    setparams           Set node parameters 
                        Note: Enter JSON data in single quotes
    getparams           Get node parameters
    removenode          Remove user node mapping
    provision           Provision the node to join Wi-Fi network
    getmqtthost         Get the MQTT Host URL to be used in the firmware
    claim               Claim the node connected to the given serial port 
                        (Get cloud credentials)
    test                Test commands to check user node mapping
    otaupgrade          Upload OTA Firmware image and start OTA Upgrade
    getuserinfo         Get details of current (logged-in) user
    sharing             Node Sharing Operations
    create_cmd_request  Create a Command Response Request (Beta)
    get_cmd_requests    Get Command Response Requests (Beta)

options:
  -h, --help            show this help message and exit

ESP_Piyush
Posts: 309
Joined: Wed Feb 20, 2019 7:02 am

Re: Viewing MQTT messages

Postby ESP_Piyush » Tue Nov 05, 2024 4:14 pm

You cannot check the messages received by the MQTT broker with public RainMaker, but you can see the messages being published by your device by adding a print here.

jetpax
Posts: 5
Joined: Mon Feb 20, 2023 9:58 pm

Re: Viewing MQTT messages

Postby jetpax » Tue Nov 05, 2024 7:21 pm

Thank you Piyush, I'll do that

jetpax
Posts: 5
Joined: Mon Feb 20, 2023 9:58 pm

Re: Viewing MQTT messages

Postby jetpax » Tue Nov 05, 2024 11:29 pm

Thank you Piyush. I have done as you suggested and it seems to me that Rainmaker is not using MQTT very efficiently.

As an example, say I want to send battery voltage = 12V

Rainmaker publishes the following to MQTT

Code: Select all

 topic: $aws/rules/esp_set_params/node/F412FA68E350/params/local, 
 data: {"Battery":{"Voltage (V)":12}}
We may assume that topic aliasing in MQTT5 might reduce the topic to 2 bytes, but since the payload is JSON encoded, a single integer value of 12 takes ~30 bytes, and I have many such values to send.

True, I could send "b" for Battery and "v" for voltage, but then the App display would not be correct, and it will still be ~15bytes.

Our current system makes use of MQTT topics

Code: Select all

 
topic: account/user/node/metric/device/battery/voltage  => 2 bytes with MQTT5 topic aliasing
data: 12
which is about 10X more efficient.

This is a show stopper for the use of Rainmaker in any metered application that uses cellular IoT services such as Hologram etc, ie for things like agriculture, object tracking etc.

Do you have any plans to reduce this overhead, or am I missing something here (like you are using Protobuf https://aws.amazon.com/blogs/iot/how-to ... -iot-core) or something)?

Who is online

Users browsing this forum: No registered users and 67 guests