From 4d9a5d7bb8ab51272b8a2618e28f4c219f9891ca Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Tue, 24 Apr 2018 16:40:05 +0100 Subject: [PATCH] Support custom orgs in `mos watson-iot-setup` CL: Support custom orgs in `mos watson-iot-setup` PUBLISHED_FROM=e3b487e1500d55efdb71bb32635db1afebea2789 --- README.md | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 276d1d8..b5897ed 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,42 @@ $ mos watson-iot-setup This does not require any credentials and will set up the device for [QuickStart cloud dashboard](https://quickstart.internetofthings.ibmcloud.com/#/) connectivity. With QuickStart dashboard, you will be able to send data from the device at a limited rate but device management (sending commands to the device) is not available. -## Own IBM Cloud Account setup. +## Own IBM Cloud Account setup -TODO +If you already have an IBM Cloud account and a cloud orgaization set up (you can register for a free trial [here](https://www.ibm.com/internet-of-things/spotlight/watson-iot-platform)) you can use `mos` to add a device to your org. + +You will need to obtain app access credentials for `mos` to use: + + * In the left side pane og your Watson IoT Platform dashboard select *Apps* + * Click the *Generate API Key* button in the upper right corner + * For description, enter any meaningful text - e.g. "MOS CLI tool" and click *Next* + * For *Role* select *Standard Application* + * Copy the *API Key* and *Authentication Token* and use them on the `mos` command line: + +``` +$ mos watson-iot-setup --watson-api-key a-bcdefgh-qwertyio --watson-api-auth-token "tokengoeshere" +Using port /dev/ttyUSB0 +Connecting to the device... + esp8266 1AFE34A5930F running demo-c +Org ID: bcdefgh +Device ID: esp8266_A5930F +Checking device type "mos"... +Creating device "esp8266_A5930F"... + +Updating config: + device.id = esp8266_A5930F + watson.client_id = d:bcdefgh:mos:esp8266_A5930F + watson.enable = true + watson.host_name = bcdefgh.messaging.internetofthings.ibmcloud.com + watson.token = SECRET +Setting new configuration... +Saving and rebooting... +``` +_Note: As with other flags, values can be specified as environment variables: `MOS_WATSON_API_KEY` and `MOS_WATSON_API_AUTH_TOKEN`._ + +Invoked with no additional flags, as above, `mos` will use device type `mos` (will be created if necessary) and device ID derived from platform and the device's unique ID (usually MAC address) and a random auth token. Additional flags can be provided to override these defaults: + * `--watson-device-type` - specifies device type + * `--watson-device-id` - specifies device id + * `--watson-device-auth-token` - specifies device auth token instead of generating a random one + * `--watson-api-host-name` - use this host name for API calls instead of `ORG_ID.internetofthings.ibmcloud.com` + * `--watson-messaging-host-name` - use this host name for device connections instead of `ORG_ID.messaging.internetofthings.ibmcloud.com`