gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 05:06:43 26 4
gpt4 key购买 nike

我想通过数据记录器将数据发送到 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 。它本质上是一个 CRUD API。

POST 即可获取遥测数据。然后,您可以使用OData v3语法来GET并过滤您的数据集。

Zumo-GET-sample

关于azure - 如何将数据从数据记录器发送到 Azure IoT 中心或 AWS IoT?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40459478/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com