NimbeLink device setup
A user who wants a NimbeLink device to send data to ClearBlade’s Intelligent Assets system needs to perform the below setup.
NimbeLink setup
Order the NimbeLink device and email
support@nimbelink.com
to send the device’s credentials. The credentials should include a<credentials>.json
,username, password and api_key
.
ClearBlade pull subscription setup
Associated assets
Code services:
accessTokenManager
: Queries the subscription collection to grab the config information for every subscription, makes an HTTP request to Google API for an accessToken every 30 minutes and updates the shared cache with that token, which is used by the pullSubscription service.pullSubscription
: Polls all the subscription topics (each subscription collection row) every minute, and if there’s a publish, it parses and can forward it to a ClearBlade topic.
Code libraries:
GoogleIoTConfig
: Holds some constants for the services.Base64
: Supporting library for the above services.CryptoLib
: Supporting library for the above services.
Collection:
subscriptions
: Holds each subscription’s credentials. Each row in the collections counts as a unique subscription.
Users can then use the
<credentials>.json
to fill up thesubscription
collection in the asset-monitoring system manually. Here’s how to add an entry to the collection:id
: unique_id_string can be chosen by the user.item_id
: Auto-generateddetails
: Optional subscription informationtype
: Only subscriptions of typegooglepubsub
are processed by the accessTokenManager serviceconfig
: This is what an example config looks like:
{
"config": {
"PROJECT_ID": "clearblade-testing",
"SUBSCRIPTION_SERVICE_ACCOUNT_PRIVATE_KEY": "-----BEGIN PRIVATE KEY-----...\n-----END PRIVATE KEY-----\n",
"SERVICE_EMAIL": "testing-pub-sub-for-@clearblade-testing.iam.gserviceaccount.com",
"SUBSCRIPTION_TOPIC": "projects/clearblade-testing/topics/mqtt-testing",
"SUBSCRIPTION_NAME": "projects/clearblade-testing/subscriptions/mqtt-subscription-testing", // note the subscription name is prefixed with `projects/<PROJECT_NAME>/subscriptions/<NAME>`
"TOKEN_EXPIRY_PERIOD_IN_SECS": 3600, // need not be changed
"MAX_MESSAGES_TO_PULL": 10,
"FORWARD_TO_CB_TOPIC": true,
"CB_FORWARD_TOPIC": "_monitor/asset/nimbelink/data",
"AUTH_SCOPE": "https://www.googleapis.com/auth/pubsub", // need not be changed
"ALGORITHM": "RS256" // need not be changed
},
"type": "googlepubsub",
"id": "sub-1",
"details":"NimbeLink device at Lake Tahoe"
}
Changing NimbeLink device configs setup
Use the NimbeLink
username, password, and api_key
and replace them with the default ones in thesystem_info
collection.api_access -> nimbelink
.After performing the above changes, you can use the
nimbelink_config
portal to update the NimbeLink devices’ config.