将数据从MQTT.fx发布到Cloud IoT Core

时间:2017-12-21 12:43:07

标签: google-cloud-platform mqtt google-cloud-iot

使用CloudIotCore文档我可以在我的Google云平台项目中运行Quickstart示例和EndtoEnd示例。

使用MQTT.fx工具我无法连接到同一个Google云计划

Username      : unused
Password      : Generated from cretae_jwt function using code in cloudiot_pubsub_example_mqtt_device.py
Broker Address: mqtt.googleapis.com
Broker Port:    8883 
Client ID:      projects/myprojectid/locations/us-central1/registries/myregistryid/devices/mydeviceid

{在上面的一行我改变了我的项目和设备细节}

错误: MQTTException错误

2017-12-21 17:42:51,785  INFO --- Start App                      : Style: LIGHT /styles/mqttfx_theme_light.css
2017-12-21 17:42:52,137  INFO --- Start App                      : An update is availabe.
2017-12-21 17:42:55,668  INFO --- ScriptingManager               : Found action with name: Switch Fountain Test
2017-12-21 17:43:30,034  INFO --- BrokerConnectorController      : onConnect
2017-12-21 17:43:30,086  INFO --- MqttFX ClientModel             : MqttClient with ID projects/myprojectid/locations/us-central1/registries/myregistryid/devices/mydeviceid assigned.
2017-12-21 17:43:30,500 ERROR --- MqttFX ClientModel             : Error when connecting
org.eclipse.paho.client.mqttv3.MqttException: MqttException
    at 2017-12-21 17:43:30,505 ERROR --- MqttFX ClientModel             : Please verify your Settings (e.g. Broker Address, Broker Port & Client ID) and the user credentials!

1 个答案:

答案 0 :(得分:0)

一些注意事项:

  • 您的密码将在3600秒后过期
  • 在使用MQTT.fx连接之前,我必须从对话框中启用TLS 1.3 SSL/TLS settings MQTT.fx

连接后,您将只能发布到特定于设备的主题,并且只能订阅特定于设备的配置更改。

如果您需要使用Java,那里有Java样本,当您需要每小时重新生成密码时,使用客户端似乎有点不理想。