Skip to content

Commit

Permalink
Support custom orgs in mos watson-iot-setup
Browse files Browse the repository at this point in the history
CL: Support custom orgs in `mos watson-iot-setup`

PUBLISHED_FROM=e3b487e1500d55efdb71bb32635db1afebea2789
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Apr 24, 2018
1 parent 912229c commit 4d9a5d7
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

0 comments on commit 4d9a5d7

Please sign in to comment.