I have a system in which devices use REST to talk to my server which acts as an IOT gateway to register and send events on behalf of the devices. This works fine. Now I would like to add remote command/control to the device for which I am creating a DeviceClient (Using the Java APIs). The device uses the same api key and auth token as the gateway and I can see the device in the Devices view on of the dashboard, yet when I connect() I get a connection failure. Are devices created under a gateway allowed to connect directly to the IOT platform? If so, any suggestions.
Looks like one or more connection parameters are wrong !!!
Apr 27, 2017 9:19:40 AM com.ibm.iotf.client.AbstractClient connect
SEVERE: main: Connecting to Watson IoT Platform failed - one or more connection parameters are wrong !!!
Not authorized to connect (5)
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:28)
at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:990)
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:118)
at java.lang.Thread.run(Thread.java:745)
The connection Properties are as follows:
{API-Key=a-sl0l32-..., iotp.enabled=true, type=AudioSensor,
Organization-ID=sl0l32, Authentication-Method=token, Authentication-Token=....,
id=cognitiveear-gmail.com-sensor-name}
and my Device is listed in the dashboard as follows:
Device ID cognitiveear-gmail.com-sensor-name
Device Type AudioSensor
Date Added Thursday, April 27, 2017
Added By a-sl0l32-rsmowsjmuj
Connection State Registered Refresh