IoT Platform - Device Id (using variables)

Does anybody know how to use a global variable result in the IoTPlatform node device Id ?

  • wish to use this var on Device Id parameter node
    var deviceId = msg.payload;
    global.set("deviceId", deviceId);

node.warn("dropdown change")
node.warn(deviceId)

return msg;

Hi @sanserg

in general it helps to be clear on what node you are using - in particular which node module it comes from. There are 1800+ modules in the community, so it helps to narrow it down.

In this case, I recognise this as the IBM Watson IoT Platform node.

That node doesn't support directly referencing context in its configuration. As it is an Input node, there is no way to pass it a message to set the deviceId dynamically either. So your options are limited here.

Are you only able to identify the deviceId you want to receive events for at runtime? Do you know if before Node-RED starts? If so, you could use an environment variable to insert the value. Otherwise, I'm not sure there's much you can do here.

Thanks @knolleary
Got it...I was almost convinced that it would not be possible .. Thanks for the confirmation...I am using dashboard controls to visualize the data and I believe if receiving all devices data from IoTP would not be possible to filter it the the dashboard gauge node. I will try to think another solution and probably not using dropdown and dashboard controls.
Thanks again for answering.