Raspberry Pi 3 到 Azure IoT 中心无法在 python 中连接

Raspberry Pi 3 to Azure IoT Hub can't connect in python

我尝试了很多文章,但无法完成 this.I 想将消息从 raspberry pi 发送到 IOT 中心,从 IoT 中心发送到 Raspberry Pi。

目前正在关注此文档: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-python-python-c2d

问题是在执行这段代码时显示一个名为

的错误
Error: Time:Fri Feb  1 10:15:13 2019 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core_ll.c Func:IoTHubClientCore_LL_CreateFromConnectionString Line:1463 iotHubName is not found
Error: Time:Fri Feb  1 10:15:13 2019 File:/usr/sdk/src/c/iothub_client/src/iothub_client_core.c Func:create_iothub_instance Line:941 Failure creating iothub handle
Unexpected error IoTHubClient.IoTHubClient, IoTHubClientResult.ERROR from IoTHub

代码是

python SimulatedDevice.py

请帮我解决这个问题。 我安装了 python 3.5 到 raspberry pi 3

我想知道的是如何使用 raspberry pi 和 Iot hub 来打开和关闭已经打开的 LED led.Please 如果你有任何想法,请告诉我

如果您的连接字符串有问题,通常会出现此错误 - 它应该如下所示:

HostName=yourhubname.azure-devices.net;DeviceId=yourdeviceid;SharedAccessKey=yourdevicekey

这些文章中还有一些关于库版本的有用信息: