Node-RED, IOT Foundation Out Node Not Sending Commands

扶醉桌前 提交于 2019-12-04 12:06:40

A simple test to check if the commands are reaching IBM IoT Foundation is - developing another flow having an IoT App In node which subscribes to the commands. I am attaching the Node-RED flow for the same here

[
{
    "id": "40560f8b.30693",
    "type": "ibmiot in",
    "authentication": "boundService",
    "apiKey": "",
    "inputType": "cmd",
    "deviceId": "b827eb764b7a",
    "applicationId": "",
    "deviceType": "table",
    "eventType": "",
    "commandType": "test",
    "format": "string",
    "name": "IBM IoT App In",
    "service": "registered",
    "allDevices": false,
    "allApplications": "",
    "allDeviceTypes": false,
    "allEvents": "",
    "allCommands": false,
    "allFormats": false,
    "x": 268,
    "y": 171,
    "z": "6bd610b9.7b40a",
    "wires": [
        [
            "2f9b9c00.8b7ba4"
        ]
    ]
},
{
    "id": "2f9b9c00.8b7ba4",
    "type": "debug",
    "name": "",
    "active": true,
    "console": "false",
    "complete": "false",
    "x": 493,
    "y": 195,
    "z": "6bd610b9.7b40a",
    "wires": []
}
]

It would appear this way in the workspace.

After you have added this flow, you can test the device command publishing from the same workspace.
Can you please try this? Since you would now have 2 debug nodes, you should be able to see the same timetamp output twice. I have tried the same flow, with the same details (except the organization) and it works fine.

Thanks and Regards
Amit M Mangalvedkar

I tried the following code

#!/usr/bin/python

import ibmiotf.device
from time import sleep

options = {
  "org": "uguhsp",
  "type": "iotsample-raspberry",
  "id": "00aabbccde03",
  "auth-method": "token",
  "auth-token": "MASKED"
}

def myCommandCallback(cmd):
  print('inside command callback')
  print cmd

def main():
  client = ibmiotf.device.Client(options)
  client.connect()
  client.commandCallback = myCommandCallback
  while True:
    sleep(1)

if __name__ == "__main__":
  main()

which is essentially similar code as yours.
And I am able to publish the commands to reach the device.

Can you please confirm if only 1 device (or simulated device) is using the device credentials and that the credentials are not being shared by multiple devices (either physical device or simulated device)?

Thanks and Regards
Amit M Mangalvedkar

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