如何将数据从数据记录器发送到 Azure IoT 中心或 AWS IoT?

How do I send data from Data Loggers to Azure IoT Hub or AWS IoT?

我想通过我的数据记录器将我的数据发送到 MS Azure 或 AWS IoT 平台。 我该怎么做?

Azure IoT 中心公开设备端点:

Device endpoints

For each device provisioned in the device identity registry, IoT Hub exposes a set of endpoints that a device can use to send and receive messages:

  • Send device-to-cloud messages. Use this endpoint to send device-to-cloud messages.
  • Receive cloud-to-device messages. A device uses this endpoint to receive targeted cloud-to-device messages.

[...]

These endpoints are exposed using MQTT v3.1.1, HTTP 1.1, and AMQP 1.0 protocols. Note that AMQP is also available over WebSockets on port 443.

最简单的方法是 REST 调用:
https://msdn.microsoft.com/en-us/library/azure/mt590784.aspx

POST https://{IoTHubName}.azure-devices.net/devices/{deviceId}/messages/events?api-version={api-version}

The body can be any octet-stream. Note that the size of the whole message (body plus properties) has to be less than 256 Kb.

例如

$ curl -X POST https://heresthething.azure-devices.net/devices/aNewArduino/messages/events?api-version=2016-02-03 \
       -H "Authorization: SharedAccessSignature sr=HeresTheThing.azure-devices.net&sig=t8Pf2lXXXVDlMY%3d&se=1489585285&skn=device" \
       -H "Transfer-Encoding: Chunked" \
       -H "Connection: Close" \
       -k -v \
       --data "New Arduino, who dis?"

使用 Device Explorer 注册您的设备并生成 SAS。

你应该从这里开始:
https://azure.microsoft.com/en-us/documentation/articles/iot-hub-devguide/

根据您的项目规模(2 台设备还是 2000 台?),您可能需要不那么复杂的东西,例如 App Service Mobile Apps with Easy Tables. It's essentially a CRUD API.

一个 POST 是您获取遥测数据所需的全部。然后,您可以使用 OData v3 语法 GET 并过滤您的数据集。