Setting system mode after getting configuration


#1

I’m looking at the possibility of using an Electron with the gateway shield. According to the best practices here, I should not let the DKs talk directly to the cloud due to data usage. However, my architecture requires each device (DK, Photon, Electron, etc.) to request its configuration from the cloud. The configuration information includes API keys and other critical information to allow it to properly post information to the cloud service I’m using (Grovestreams).

I’m wondering if I can call SYSTEM_MODE(MANUAL) after the DK receives its configuration information and then have the DKs send the data to the Electron (via BLE.sendData()) and have the Electron make the actual API call to Grovestreams.

Is this possible and does it make sense? I guess would also have to figure out when to call gateway.set_ble_local() in the gateway–after all the DKs have gotten their configuration.


#2

Is there a reason the Electron can’t request the credentials on behalf of each DK and send it down to it? That would be the simplest way. This way, your credentials would already be in the Electron for posting data.

If that isn’t possible for some reason, then yes, you could have some code that notifies each DK to move into local mode


#3

Each device makes an API call with its device ID to get its configuration. I guess if the Electron knew the device IDs of all of it’s subordinate DKs, then it could match up the data being pushed with the proper credentials. Thinking through this further…the only thing at a particular site that’s unique to the DK is its component ID in Grovestreams. The API key is the same for all the devices at that site. Is there a simple way for the Electron in the gateway to know the device IDs of its subordinate DKs?


#4

Yup, you can use the System.deviceID() function. You can do this in the DK and then pass it to the Electron with your data when you send it up. Docs are here: http://docs.bluz.io/reference/system/#deviceid