raspberry-piibm-cloudnode-redwatson-iot

Device connected, but 'IBMIoT: Error: Connection refused: Not authorized' message keeps popping up


I am experimenting with IoT services in IBM Bluemix, attending a running MOOC at Coursera. I have set up my trial account and successfully registered some devices. I am testing the connectivity between Bluemix and my Raspberry Pi with the following simple Node-RED flow in Bluemix:

Node-RED flow @ Bluemixenter image description here

where normal and alert are simple injection nodes of the respective strings, the format message node is similarly simple (returns msg, where msg.payload = {'a' : {'indicator' : msg.payload}};, and the IBM IoT node is as follows:

enter image description here

The senseHAT device is registered and successfully connected to Bluemix, as apparent from the Watson IoT Platform dashboard:

enter image description here

From the Raspberry side, I have set the following simple flow to catch the 'commands' (normal and alert) issued in Bluemix:

Node-RED flow @ Raspberry Pienter image description here

with the all commands node being as follows:

enter image description here

Now, although the 'commands' normal and alert pass through from Bluemix to my Raspberry, I keep on getting the subject error message, as shown below (notice the time stamps):

enter image description here

and a similar error message is logged in the Node-RED console (once per minute):

Connection Error :: Error: Connection refused: Not authorized
9 Jun 19:41:19 - [error] IBMIoT: Error: Connection refused: Not authorized
Iotfclient is offline. Retrying connection
Connection was closed.

I wonder how it is possible, on the one hand to have the 'commands' passed through, while on the other hand to get at error message per minute claiming that I am not connected since my device is not authorized.

Any ideas?

On a side note (and as possibly useful additional info):

  1. pressing 'Refresh' in the Watson IoT Platform dashboard, the senseHAT device appears disconnected; refreshing the whole page (ie from the browser), it appears again connected
  2. no matter what I have tried, I cannot connect the other two devices shown above (b827eb0a0ee8 and b827eb5f5bbd) - I even tried deleting and re-registering them again in Bluemix...

Solution

  • It looks like the cause of this could be the mix up of gateways and devices as per my previous comment. From the logs it looks like you have changed the types of the device IDs between gateway and device, and in some cases a device with id b827eb0a0ee8 has connected as a gateway (shown as just a device in your screen shot) and subsequently been disconnected because it attempts something unauthorised (probably attempting to connect an unregistered device; ie the client ID mix up issue).

    Auto registration of devices is temporarily disabled and so if a device does not exist (because the client ID is wrong) then the gateway device will be disconnected.