locked
Azure IoT Starter Kit for ESP8266 not able to generate Telemetric data RRS feed

  • Question

  • I used remote_monitoring example from the Azure starter kit  for ESP8266 and was able to build and load the firmware onto my ESP8266 development board.

    Now, I do have a DHT11 sensor which was ensing humidity and temperature data over MQTT.

    MQTT connection to broker was fine as the code didnt report any error for it and continuously kepong senidng log messages stating the data has been sent to the cloud.

    I even ensured through iothub-explorer tool that my data was being sent to cloud as expected.

    Now, the Azure devices dashboard (https://bodhileafsample.azurewebsites.net/devices) is showing that my device is connected by doesnt show any telemetric data.

    What am I missing here?

    --------Snapshot of the logs from iothub-explorer------------ 

    <style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #34bc26; background-color: #ffffff} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #828282; background-color: #ffffff} span.s1 {font-variant-ligatures: no-common-ligatures} span.s2 {font-variant-ligatures: no-common-ligatures; color: #34bc26} </style>

    Vanamac-2:libraries arvindvanam$ iothub-explorer login "HostName=bodhileafsampleeaa35.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=33A18nCY6Jy8Zvqm3MIBSWPGoQ1VBmYO5ylRrLt1zjM="

    Session started, expires on Wed Mar 07 2018 14:01:05 GMT+0530 (IST)

    Session file: /Users/shwetathareja/Library/Application Support/iothub-explorer/config

    Vanamac-2:libraries arvindvanam$ iothub-explorer monitor-events bodhileaf_sample_1 -c mygroupiot --login "HostName=bodhileafsampleeaa35.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=33A18nCY6Jy8Zvqm3MIBSWPGoQ1VBmYO5ylRrLt1zjM="

    Monitoring events from device bodhileaf_sample_1...

    ==== From: 'bodhileaf_sample_1' at '2018-03-07T07:32:18.110Z' ====

    {

      "DeviceId": "bodhileaf_sample_1",

      "Temperature": 30,

      "Humidity": 23

    }

    ---- application properties ----

    {}

    ====================

    ==== From: 'bodhileaf_sample_1' at '2018-03-07T07:32:28.083Z' ====

    {

      "DeviceId": "bodhileaf_sample_1",

      "Temperature": 30,

      "Humidity": 23

    }


    Wednesday, March 7, 2018 9:50 AM

All replies

  • Hello Arvind,

    If you use iothub-explorer to receive device telemetry, stop it and to see if iotsuite dashboard receive you device telemetry.

    Make sure there is no other endpoint (outside of you iotsuite solution) receive your device telemetry.

    And about the sample, do you make any modification?

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 8, 2018 6:49 AM
  • I was earlier not using iothub-explorer to view the telemetric data. I directly checked on iot suite Dashboard and found that the device is shown as connected while there is no data being recorded for it.

    Post this observation, I used iothub-explorer to only confirm if the data from my ESP device is actually being transmitted to the aws endpoint or not? I found data was indeed being sent to the cloud.

    "Make sure there is no other endpoint (outside of you iotsuite solution) receive your device telemetry."

    >>>There's no other endpoint which receives my device telemetry data

    And about the sample, do you make any modification?

    >> I use the remote_mointoring example code as it is without any modification. 

    Friday, March 9, 2018 8:45 AM
  • Hello Arvind,

    Thanks for detailed information.

    >>>I even ensured through iothub-explorer tool that my data was being sent to cloud as expected. Now, the Azure devices dashboard (https://bodhileafsample.azurewebsites.net/devices) is showing that my device is connected by doesnt show any telemetric data.

    I reproduced your issue. 

    After tests I found that messages sent to cloud need some system properties that will be use to routed messages to the right endpoint. After the right route messages will be displayed on dashboard. These properties like this:

    However the esp8266 sample not send these required properties.

    So about this problem I opened an issue on GitHub.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 13, 2018 8:28 AM
  • Thanks Rita for opening a case on Github but I don't see any traction on the issue?

    Is there a WAR for the issue?

    How do I send the application properties? Does it have to be in the same JSON message as the actual data or a separate one. Can I have a sample message format which will be accepted as valid data by the endpoint?

    Saturday, March 17, 2018 10:34 AM
  • Hello Arvind,

    You can send application properties like this, in remote_monitoring.c:

    #include <time.h>
    
    ...
    
    /* Add message property */
    static void addProperty(MAP_HANDLE propMap, char* propName, char* propValue)
    {
      if (Map_AddOrUpdate(propMap, propName, propValue) != MAP_OK)
      {
        LogInfo("ERROR: Map_AddOrUpdate Failed on %s!\r\n", propName);
      }
    }
    
    static void sendMessage(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const unsigned char* buffer, size_t size)
    {
        IOTHUB_MESSAGE_HANDLE messageHandle = IoTHubMessage_CreateFromByteArray(buffer, size);
        if (messageHandle == NULL)
        {
            LogInfo("unable to create a new IoTHubMessage\r\n");
        }
        else
        {
    
                // Add properties
                MAP_HANDLE propMap = IoTHubMessage_Properties(messageHandle);
                addProperty(propMap, "$$MessageSchema", "chiller-pressure;v1");
                addProperty(propMap, "$$ContentType", "JSON");
    
                time_t rawtime;
                struct tm * ptm;
              
                time ( &rawtime );
              
                ptm = gmtime ( &rawtime );
    
                unsigned int year = ptm->tm_year + 1900;
                int month = ptm->tm_mon + 1;
                int day = ptm->tm_mday;
                int hour = ptm->tm_hour;
                int minute = ptm->tm_min;
                int second = ptm->tm_sec;
    
                // Add a constant UTC format time for testing. TODO: Convert real time(above) to a string with UTC format.
                addProperty(propMap, "$$CreationTimeUtc", "2018-03-21T03:15:14Z");
    
    ...

    In above code piece I use a constant time "2018-03-21T03:15:14Z", you can use for testing. I am not expert on Arduino and struggling to find a way to convert int year/month/day/hour/minute/second/ to a string. I tried sprintf but it always cause exception on Esp8266. I am trying to solve it. If you have any idea welcome to share. 

    But put my clumsy code out, so you can use it to test first. 

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, March 21, 2018 10:11 AM