B4R Code Snippet Adafruit IO: Sending multiple data feeds with only one mqtt Publish message

Hi, trying to send 4 feeds (IPPubl,IPLocal, SCATemp,SCAHum) from a NodeMCU skecth + DHT11 sensor I wish to do it like Thingspeak in one MQTT publish message (see @barx post at https://www.b4x.com/android/forum/threads/mqtt-connect-to-thingspeak.89453/post-566218)

Adafruit has a facility named Group: you can add feeds to a Group and Publish/Subscribe to/a Group (you can test it on Windows 10 with mqtt fx http://www.jensd.de/apps/mqttfx/1.7.1/)

The syntax of the Publish message is:

username/groups/default/json (you can change default name or create another group

and the json payload:
"feeds": {
"SCAIPPubl": "",
"SCAIPLocal": "",
"SCATemp": "28",
"SCAHum": "38"
"location": {
"lon": 2.5,
"ele": 500.0 }
With only one MQTT Publish, you can send several feeds (to a Group):

    Dim bc As ByteConverter
    Dim IPPubl As String=""                     '"https://api.myip.com"
    Dim IPLocal As String=""                 'Wifi.IPlocal
    Dim Temp As String=GetTemp                              'From DHT11
    Dim Hum As String=GetHum                                'From DHT11
    Dim fullstring As String
    fullstring=JoinStrings(Array As String _
    ("{""feeds"": {""SCAIPPubl"":""",IPPubl,""",""SCAIPLocal"":""",IPLocal,""",""SCATemp"":""",Temp,""",""SCAHum"":""",Hum,"""},""location"":  {""lat"":41.80,""lon"":2.5,""ele"":500}}"))

Adafruit IO DashBoard

Last edited:


Licensed User
Longtime User
Good morning @inakigarm... Thank you for the knowledge you supply this forum with. I have not tried what you are suggesting but I downloaded the MQTT.fx software you provided above. It looks very promising in debugging mqtt applications. Thanks.