0
votes

I am just starting out with IBM Watson IoT Platform. I am trying to figure out where I should solve my problem. Keep in mind, I can not change the remote device itself.

Background:

A third party sensor we are using sends us data as multiple JSON string in separate HTTP posts. I am forwarding data via the HTTP API

curl -v -X POST -H "Content-Type: application/json" -u "use-token-auth:passw0rd" -d @message.txt https://myOrgID.messaging.internetofthings.ibmcloud.com:8883/api/v0002/device/types/TestDevices/devices/TestPublishEvent/events/TestMessage

e.g. The device has multiple sensors and sends one HTTP message for each reading.

Message.txt could be:

{
    "device": "device001",
    "timestamp": "2018-05-18T11:16:00.000+0000",
    "sensor": "Temp",
    "value": "32.2",
    "unit": "C"
}

Message.txt could also be:

{
    "device": "device001",
    "timestamp": "2018-05-18T11:16:00.000+0000",
    "sensor": "Particles",
        "value": "200",
        "unit": "P_4.00_UM"
}

There a x amount of sensors which can have y types of units. e.g. Celsius and Fahrenheit for temp readings. And Particles come a dozen sizes. For now there is one device.

Currently I push data into the platform, but I can not figure out how to handle multiple sensors readings coming in over a single endpoint one reading for each message. I do not know where I am supposed to put the logic.

  1. I could write an IBM Cloud Function that sends data to specific "Topics" depending on the data- based on a filter.
  2. Or perhaps map this out in node-red by having a HTTPS listener there.
  3. I am thinking WIOTP can be configured to handle my case and I am missing something essential.

I am looking for a pointer on how to proceed, thank you.

1

1 Answers

0
votes

You can start from the POST phase, if possible. The post call is similar to:

/device/types/{typeId}/devices/{deviceId}/events/{eventName}

You can replace {eventName} with Temp or Particles (or any other value).

Also, the 3 ideas you exposed are very good. I would choose the 1st option (if production) and the 2nd if anything else(it is the easiest one as well).

For the 3rd one you can check the data management of the WIOTP:

https://console.bluemix.net/docs/services/IoT/GA_information_management/ga_im_definitions.html#definitions_resources

Daniel