繁体   English   中英

无法向 Azure IoT 中心向设备 ID 中带有“:”的设备发送消息

[英]Cannot send message to Azure IoT Hub to units with ":" in their device id

我正在尝试将消息从我的机器发送到 IoT 中心。 我正在使用以下代码:

    message = Message('{{"temperature": 20,"humidity": 10}}')
    client = IoTHubDeviceClient.create_from_connection_string(CONNECTION_STRING)
    client.send_message(message)

这在 CONNECTION_STRING 中的 deviceId 中没有冒号时有效。

CONNECTION_STRING = "HostName=my-iot-hub.azure-devices.net;DeviceId=E0:DC:A0:73:C6:C3;SharedAccessKey=password"


CONNECTION_STRING = "HostName=my-iot-hub.azure-devices.net;DeviceId=my_device;SharedAccessKey=password"

第一个连接字符串不起作用。 尝试发送消息时进程挂起 - 但没有给我一条错误消息。 第二个发送没有任何问题。

有没有办法逃避冒号?

我们确认这是 url 编码的错误。 azure-iot-device的下一个版本(高于 2.3.0 的版本)中,我们将添加一个修复程序。

谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM