Ibm cloud Arduino未使用MQTT连接到Watson IoT

Ibm cloud Arduino未使用MQTT连接到Watson IoT,ibm-cloud,watson-iot,Ibm Cloud,Watson Iot,我正在尝试将arduino连接到Watson IoT。 使用以下命令: mqtt.connect(0, "d6acq3.messaging.internetofthings.ibmcloud.com",1883,"d:d6acq3:Arduino_Helligkeit:1234567890","use-token-auth","<as it was provided>"); 在Watson平台上,我在设备的连接日志中看到以下消息: Closed connection from 93

我正在尝试将arduino连接到Watson IoT。 使用以下命令:

mqtt.connect(0, "d6acq3.messaging.internetofthings.ibmcloud.com",1883,"d:d6acq3:Arduino_Helligkeit:1234567890","use-token-auth","<as it was provided>");
在Watson平台上,我在设备的连接日志中看到以下消息:

Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule    07.02.2017 11:58:16
Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule 2 times in the last 5 minutes  07.02.2017 11:58:16
Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule    07.02.2017 11:56:03
Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule    07.02.2017 11:45:36

提前感谢您提供的帮助。正如Dan所说,Watson IoT平台只允许使用特定的主题字符串,因此您应该确认您使用的主题字符串是正确的

对于应用程序,事件主题: iot-2/type/{device type}/id/{device id}/evt/{event type}/fmt/{format type}

对于应用程序,命令主题: iot-2/type/{device type}/id/{device id}/cmd/{command type}/fmt/{format type}

对于设备,事件主题: iot-2/evt/{事件类型}/fmt/{格式类型}

对于设备,命令主题: iot-2/cmd/{命令类型}/fmt/{格式类型}

但是,我在日志中看到的情况表明,您正在尝试使用比您在文章中指定的更长的客户端ID进行连接。我看到这个错误:

令牌身份验证失败(设备不存在):ClientID='d:d6acq3:Arduino_Helligkeit:1234567801486464057428'


因此,您需要检查以确保您的连接使用的是您已注册的正确设备ID

亲爱的瓦莱丽,据我所知,我甚至连电话都没有。所以,我认为这个话题还没有发挥作用,对吧?同时,我创建了另一个设备ID(18fe34a46709),但我也无法连接。我尝试将第三个设备ID与MQTTBox(Chrome客户端)连接起来,这可以正常工作。(至少对于连接而言)我看到您的MQTTBox连接工作正常。检查设备18fe34a46709时,它收到此错误,因此看起来它在主题字段中输入了错误的值:主题无效:使用令牌身份验证主题与允许的规则不匹配。Reason=“主题无效:使用令牌身份验证主题与允许的规则不匹配”
Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule    07.02.2017 11:58:16
Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule 2 times in the last 5 minutes  07.02.2017 11:58:16
Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule    07.02.2017 11:56:03
Closed connection from 93.231.145.115. 
The topic is not valid: use-token-auth 
The topic does not match an allowed rule    07.02.2017 11:45:36