Electron Azure IoT Integration null values coming in


Working with Azure integration. We have an Electron that was publishing 5 values from sensors connected to the Electron. We changed the publish payload and the integration JSON to reflect adding a few more values at which point we could only receive the publish date and guid in Azure IoT hub side. We went back to the original publish payload and JSON, still can’t get any other values than publish date and guid. We can hard code a value in the publish command which makes it through to Azure IoT hub but every value comes in as a empty value as in “”.

We changed the ‘working’ publish / integration on Friday, Sept 29th - have not been able to pass over a variable since. Looking for any insight / ideas…

Here’s the publish statement:

   int encoder = 15;
   float s1 = 3.3;
   float temp = 75;
   float humidity = 35;
   //float uv = 42;
   char uv[10] = "test";
   char payload[255];

   snprintf(payload, sizeof(payload), "{ \"e1\" : %x, \"s1\" : %f }", encoder,s1);
   Particle.publish("EBMStest", payload, PRIVATE);

Here’s the JSON configuration in the Azure IoT Hub Integration:

  "e1": "{{e1}}",
  "s1": "{{s1}}"

Here’s the JSON coming into the console:

{"data":"{ \"e1\" : f, \"s1\" : 3.300000 }","ttl":60,"published_at":"2017-10-03T12:45:44.209Z","coreid":"41003d001951353338363036","userid":"597618e4354af525dff8cdad","version":0,"public":false,"productID":5188,"name":"EBMStest"}

In Azure we get “” for the values of the e1 and s1 variables.

Thanks for any ideas

Figured it out…

WRONG: snprintf(payload, sizeof(payload), “{ “e1” : %x, “s1” : %f }”, encoder,s1);

RIGHT: snprintf(payload, sizeof(payload), “{ “e1” : “%x”, “s1” : “%f” }”, encoder,s1);


Thanks for posting your solution!