I've created a Cloud foundry app with pricing plan lite.
I've registed devices and gateway like this:
I'm trying to connect devices like mydevice1, mydevice2,.... through mygwt.
I following this tutorial: https://console.bluemix.net/docs/services/IoT/gateways/mqtt.html#mqtt
"A gateway can publish events from itself and on behalf of any device that is connected through the gateway"
"A gateway can subscribe to commands that are directed at the gateway itself and to any device in the organization, including other gateways."
And on nodered I've used ibmin node and ibmout node with device type and device Id like this:
In my project, I'm trying to send events from each mobile phone to each other device, after that, all of devices send that events through a gateway to nodered. or nodered send command to a gateway and gateway forward to all devices. my question:
How can I connect devices through a gateway?
Can I received behalf of any device that is connected through the gateway on nodered and send to all devices through gateway by ibmiot out node?
Answer by MikeRobertson (176) | Mar 22, 2018 at 04:59 PM
Gateways by default enforce access controls and are limited to publishing and subscribing on behalf of devices contained within their own resource group. For more information on this topic, refer to https://console.bluemix.net/docs/services/IoT/gateways/gateway-access-control.html#gateway-access-control
What this means is that in order for your gateway to send and receive messages for your devices, you will need to add those devices to the resource group of the gateway. This can be done using APIs:
GET /api/v0002/authorization/devices/g:{orgid}:{gwtypeid}:{gwdeviceid}
Use this API to find the resource group UID of the gateway. By default this will have a format like "gw_def_res_grp:{orgid}:{typeid}:{deviceid}".
PUT /api/v0002/bulk/devices/{groupid}/add [ { "deviceId": "{deviceid}", "typeId": "{typeid}" } ]
Use this API to add your device to the resource group of the gateway.