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

北战南征 提交于 2019-12-13 05:50:40

问题


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 @ Bluemix

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:

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

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 Pi

with the all commands node being as follows:

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):

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...

回答1:


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.




回答2:


I have accepted Paul's answer as correct, as it helped me figure out what goes on, but it is rather cryptic. Here is what exactly is happening, along with a remedy.

If (even accidentally) you try to erroneously connect a device as a gateway (or vice versa), the whole thing gets messed up...:

  1. You cannot re-connect the device/gateway, even if you go back and correct the credentials (i.e. your device/gateway is doomed...)
  2. Once such a thing (accident...) has happened, all your other registered devices, although they can be successfully connected to Bluemix, give the error message I have described in my question above (including the status in the Node-RED console, forever reporting Connection was closed.
  3. Restarting your Bluemix app has no effect

So, once such a mistake/accident has happened for whatever reason, the remedy is to stop and start again your local Node-RED service (i.e. in my case the one running in my Raspberry Pi).

I hope this helps for future improvements of the platform - it is certainly an unexpected behavior.




回答3:


I had the same behavior. Just restarting the local Node-RED didn't help. After restart, I deleted the wiotp-credentials node, recreated it , deployed the flow, and worked finally my gateway connected.



来源:https://stackoverflow.com/questions/37731964/ibm-bluemix-device-connected-but-ibmiot-error-connection-refused-not-autho

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!