Skip to content

Commit af47d21

Browse files
Maurizio Brancapolldo
Maurizio Branca
authored andcommitted
Initial import
0 parents  commit af47d21

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
iot-cloud-cli is a command line interface that allows to exploit the features of Arduino IoT Cloud. As of now, it is possible to provision a device.
2+
3+
### Requirements
4+
5+
This is all you need to use iot-cloud-cli for device **provisioning**:
6+
* A client ID and a secret ID, retrievable from the [cloud](https://create.arduino.cc/iot/integrations) by creating a new API key
7+
* The folder containing the precompiled provisioning firmwares (`binaries`) needs to be in the same location you run the command from
8+
9+
## Set a configuration
10+
11+
iot-cloud-cli needs to be configured before being used. In particular a client ID and the corresponding secret ID should be set.
12+
You can retrieve them from the [cloud](https://create.arduino.cc/iot/integrations) by creating a new API key.
13+
14+
Once you have the IDs, call this command with your parameters:
15+
16+
`$ iot-cloud-cli config -c <clientID> -s <secretID>`
17+
18+
A file named `config.yaml` will be created in the Current Working Directory containing the login credentials.
19+
Example
20+
21+
```yaml
22+
client: 00112233445566778899aabbccddeeff
23+
secret: 00112233445566778899aabbccddeeffffeeddccbbaa99887766554433221100
24+
```
25+
26+
## Device provisioning
27+
28+
When provisioning a device, you can optionally specify the port to which the device is connected to and its fqbn. If they are not given, then the first device found will be provisioned.
29+
30+
Use this command to provision a device:
31+
32+
`$ iot-cloud-cli device create --name <deviceName> --port <port> --fqbn <deviceFqbn>`

cli/root.go

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cli
2+
3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/arduino/iot-cloud-cli/cli/config"
8+
"github.com/arduino/iot-cloud-cli/cli/device"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
func Execute() {
13+
rootCmd := &cobra.Command{}
14+
rootCmd.AddCommand(config.NewCommand())
15+
rootCmd.AddCommand(device.NewCommand())
16+
17+
if err := rootCmd.Execute(); err != nil {
18+
fmt.Fprintln(os.Stderr, err)
19+
}
20+
}

go.mod

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/bcmi-labs/iot-cloud-cli
2+
3+
go 1.15

go.sum

Whitespace-only changes.

main.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/bcmi-labs/iot-cloud-cli/cli"
4+
5+
func main() {
6+
cli.Execute()
7+
}

0 commit comments

Comments
 (0)