【问题标题】:Connection error in Google IoT end-to-end exampleGoogle IoT 端到端示例中的连接错误
【发布时间】:2018-07-24 07:14:08
【问题描述】:

我最近出于纯粹的兴趣尝试了 google 的 iot 端到端示例 (https://cloud.google.com/iot/docs/samples/end-to-end-sample)。但是,在我必须连接设备的过程的最后部分,我一直遇到运行时错误。

Creating JWT using RS256 from private key file rsa_private.pem
Connection Result: 5: The connection was refused.
Disconnected: 5: The connection was refused.
Connection Result: 5: The connection was refused.
Disconnected: 5: The connection was refused.
Traceback (most recent call last):
  File "cloudiot_pubsub_example_mqtt_device.py", line 259, in <module>
    main()
  File "cloudiot_pubsub_example_mqtt_device.py", line 234, in main
    device.wait_for_connection(5)
  File "cloudiot_pubsub_example_mqtt_device.py", line 100, in 
wait_for_connection
    raise RuntimeError('Could not connect to MQTT bridge.')
RuntimeError: Could not connect to MQTT bridge.

上面是插入剪贴板上的命令字符串后得到的错误。下面是我如何得到错误的更详细的过程。

关于设备 ID,我是在 google iot 平台上手动创建的。对于私钥/公钥 rsa 密钥对,我按照 Google 的说明生成它们,并将公钥粘贴到设备的公钥中,并将私钥复制到包含 python 文件的同一目录中。

谢谢。

【问题讨论】:

  • 同样的问题 - 有更新吗?

标签: python google-api mqtt


【解决方案1】:

要解决这个问题,只需将正确的云区域参数传递给命令 --cloud_region=asia-east1

【讨论】:

    【解决方案2】:

    您可以尝试在运行设备脚本时提供云区域 Ex : "--cloud_region=asia-east1"

    python cloudiot_pubsub_example_mqtt_device.py --project_id=applied-grove-246108 --registry_id=my-registry --device_id=my-device --private_key_file=rsa_private.pem --algorithm=RS256 --cloud_region=asia-east1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-24
      • 2020-08-12
      • 1970-01-01
      • 1970-01-01
      • 2021-03-20
      • 1970-01-01
      • 2022-01-09
      • 2020-12-01
      相关资源
      最近更新 更多