Nimbelink Device Setup

A user who wants a nimbelink device to send data to ClearBlade’s Asset Monitoring system needs to perform the below setup

  • Place the order for Nimbelink device and then request support@nimbelink.com to send the credentials for the device. The credentials should include a <credentials>.json and username, password & api_key.

ClearBlade Setup for Pull Subscription

Associated Assets

  • Code Services:
    • accessTokenManager - queries the subscription collection to grab the config information for every subscription and makes a http request to google api for an accessToken every 30 mins and updates the shared-cache with that token, which is used by the pullSubscription service.
    • pullSubscription - polls all the subscription topics(each row in subscriptions collection) every minute and if there’s a publish, it parses and has the ability to 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 the credentials for each subscription. Each row in the collections counts as a unique subscription

      Steps

  • User can then use the <credentials>.json to manually fill up the subscriptions collection in the asset-monitoring system. Here’s how to add an entry to the collection:

    • id: unique_id_string can be chosen by the user.
    • item_id: auto-generated
    • details: optional information about the subscription
    • type: only subscriptions of type googlepubsub are processed by the accessTokenManager service
    • config: 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"
}
  • Use the nimbelink username, password and api_key and replace them with the default ones in the system_info collection. api_access -> nimbelink.
  • After performing the above changes one can use the nimbelink_configportal to make updates to the nimbelink devices’ config.