Java json/python error
-
I am trying to generate some mqtt json data that I publish to a mosquitto server, and mango gives me this error.
MY python code:
import paho.mqtt.client as mqtt
import jsonbroker = "192.168.111.51"
topic = "/BrokerID/Support/Broker"d = {}
d["Format"] = "RegisterBroker"
d["BrokerID"] = "AABBCCDDEEFF"
d["Version"] = "1.0.5"data_out = json.dumps(d, ensure_ascii=False)
print(data_out)mqttc = mqtt.Client()
mqttc.username_pw_set("xxx", password="************")
mqttc.connect(broker, port=1883, keepalive=60)
mqttc.publish(topic, data_out)
Mango error:
ERROR 2018-03-03T19:55:39,388 (com.infiniteautomation.m2m2.mqtt.client.MqttClientDataSourceRT.messageArrived:371) - Error during read topic: "/BrokerID/Support/Broker" datapoint: "MyPi - Register Broker" payload: "{"Format": "RegisterBroker", "BrokerID": "AABBCCDDEEFF", "Version": "1.0.5"}" exception: "Invalid input: JSON Pointer expression must start with '/': ":""THanks, hope somebody can put some light on this.
Christoff
-
Hi Christoff,
Have you configured any data points on your MQTT data source? Can you share the JSON of their configuration?
-
Sorry, missed the most important part.
-
@christoffv said in Java json/python error:
Invalid input: JSON Pointer expression must start with '/': "
There's your answer there. It looks like there is a comma in the "JSON point for value" field. Click the blue help icon for more information on JSON pointers.
-
Thanks a million, It works now, This is why you need that extra pair of eyes.
Thanks everyboy
-
@christoffv, you can conect to mosquito broker is using data source mqtt client, with the configuration in the data sourse don't neccesary create a file json, I can publish information if you create a data point, you can asignate a topic and public information.
-
I know this is really a very dumb question, but hy do I see the history point values and not the value in the Data Point block. I have played with my setting of the data point but no luck.
-
That is weird. It looks like it was receiving updates while the page was open, even. Are you experiencing that with other types of data points? Are you on the latest versions of things?
-
I have created a new data point, plain subscribe to /motor1/temp1 and I get the value to show. The only difference is that the value that I can't see is a json value.