1

I am trying to connect an arduino to Watson IoT. With the following command:

mqtt.connect(0, "d6acq3.messaging.internetofthings.ibmcloud.com",1883,"d:d6acq3:Arduino_Helligkeit:1234567890","use-token-auth","<as it was provided>");

This is the lib I use for MQTT and where the connect command is specified as follows:

bool connect (int id, String brooker, unsigned int port, String deviceId);

bool connect ([s.o], String userName , String password);

On the Watson Platform I see the following messages in my device´s connection log:

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

Thanks in advance for any help to get this working.

Andy K
  • 4,944
  • 10
  • 53
  • 82

1 Answers1

1

As Dan said, only certain topic strings are allowed for the Watson IoT platform so you should confirm you are using the right topic string.

For applications, events topic: iot-2/type/{device type}/id/{device id}/evt/{event type}/fmt/{format type}

For applications, commands topic: iot-2/type/{device type}/id/{device id}/cmd/{command type}/fmt/{format type}

For devices, events topic: iot-2/evt/{event type}/fmt/{format type}

For devices, commands topic: iot-2/cmd/{command type}/fmt/{format type}

However, what I see in logs indicates you are trying to connect with a longer client ID than what you specified in your post. I see this error:

Token auth failed (Device does not exist): ClientID='d:d6acq3:Arduino_Helligkeit:12345678901486464057428',

So you need to check to be sure your connection is using the right device ID that you have registered.

ValerieLampkin
  • 2,620
  • 13
  • 27
  • Dear Valerie, as far as I can see, I do not even get a connection. So, I assume the topic does not play a role yet, right? Meanwhile, I created another Device-ID (18fe34a46709) which I cannot connect, neither. – Markus Weinberger Feb 07 '17 at 19:33
  • I tried connecting a third Device-ID with MQTTBox (a Chrome client) which worked. (At least for the connection) – Markus Weinberger Feb 07 '17 at 19:34
  • I see your MQTTBox connections are working fine. Checking back for the device 18fe34a46709, it was getting this error so looks like it was putting the wrong value in the topic field: The topic is not valid: use-token-auth The topic does not match an allowed rule. Reason="The topic is not valid: use-token-auth The topic does not match an allowed rule" – ValerieLampkin Feb 08 '17 at 11:35