Sending json data through MQTT



  • I am trying to send a json file using MQTT, with the following code:

    test=ujson.dumps({"value":value,"lat":lat,"long":long,"ele":ele})
    client.publish(topic=Feed,msg=test)
    

    The server seems to only receive value, but not lat, long, or ele. Yet the server is expecting the other variables (they are just showing up as blank on the server, currently).

    Do I need to modify the umqtt.py file or any of my other code for sending json files?

    https://io.adafruit.com/api/docs/mqtt.html#sending-data-with-location
    ^Also, this is the link which discusses the format the server expects for the data.


Log in to reply
 

Pycom on Twitter