Skip to content

Commit 2baf528

Browse files
authored
Remove ping (#18)
mqtt diagnostic and debugging commands are moved into another specific tool. This PR removes the ping command and all its dependencies (mqtt, codec etc..)
1 parent 1fbe184 commit 2baf528

File tree

9 files changed

+8
-595
lines changed

9 files changed

+8
-595
lines changed

README.md

+1-68
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# iot-cloud-cli
22

3-
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 and to simulate a device to be connected to the cloud using MQTT for troubleshooting purposes.
3+
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.
44

55
### Requirements
66

77
This is all you need to use iot-cloud-cli for device **provisioning**:
88
* A client ID and a secret ID, retrievable from the [cloud](https://create.arduino.cc/iot/integrations) by creating a new API key
99
* The folder containing the precompiled provisioning firmwares (`binaries`) needs to be in the same location you run the command from
1010

11-
This is all you need to use iot-cloud-cli as a **virtual device**:
12-
* A "Generic ESP8266 Module" or "Generic ESP32 Module" device in IoT Cloud (requires a Maker plan)
13-
* A thing with a `counter` property connected to the "Generic ESP8266/ESP32 Module" device
14-
15-
1611
## Set a configuration
1712

1813
iot-cloud-cli needs to be configured before being used. In particular a client ID and the corresponding secret ID should be set.
@@ -37,65 +32,3 @@ When provisioning a device, you can optionally specify the port to which the dev
3732
Use this command to provision a device:
3833
3934
`$ iot-cloud-cli device create --name <deviceName> --port <port> --fqbn <deviceFqbn>`
40-
41-
42-
## Use iot-cloud-cli as a virtual device
43-
44-
The iot-cloud-cli can be used as a virtual device for Arduino IoT Cloud for testing.
45-
46-
```
47-
$ iot-cloud-cli ping -d "<deviceId>" -s "<secret>" -t <thing ID>>
48-
Connected to Arduino IoT Cloud
49-
Subscribed true
50-
Property value sent successfully 81
51-
Property value sent successfully 87
52-
```
53-
54-
### How to set up the device and thing in IoT Cloud
55-
56-
#### Device
57-
58-
* Visit https://create.arduino.cc/iot/devices and select "Add device".
59-
* Select "Set up a 3rd party device".
60-
* Select "ESP8266".
61-
* From the drop down select "Generic ESP8266 Module", and click "Continue".
62-
* Pick a nice and friendly device name.
63-
* Save the "Device ID" and "Secret Key" in a safe place (1Password, KeepassXC, a piece of paper in your vault) , because you will not be able to see them anymore.
64-
65-
#### Thing ID
66-
67-
* Visit https://create.arduino.cc/iot/things and select "Create Thing".
68-
* Select "Add Variable".
69-
* Give the variable the name "counter", type "Integer Number" and leave the variable permission the value "Read & Write".
70-
* Press the "Add Variable" button to confirm.
71-
* Copy the "Thing ID" from the bottom right of the page.
72-
73-
#### Connect the device and the thing
74-
75-
You should connect the new device to the new thing.
76-
77-
#### Testing
78-
79-
##### Connect to the PROD environment
80-
81-
```shell
82-
$ iot-cloud-cli ping -d "<Device ID>" -s "<Secret Key>" -t <Thing ID>>
83-
```
84-
85-
If every works as expected you should see something similar to this output:
86-
```
87-
Connected to Arduino IoT Cloud
88-
Subscribed true
89-
Property value sent successfully 81
90-
Property value sent successfully 87
91-
```
92-
93-
If you visit https://create.arduino.cc/iot/devices the "Generic ESP8266 Module" device status should be "Online".
94-
95-
##### Connect to the DEV environment
96-
97-
The DEV environment is using a different broker, so you need to add the option `--host`:
98-
99-
```shell
100-
$ iot-cloud-cli ping --host tcps://mqtts-sa.iot.oniudra.cc:8884 -d "<Device ID>" -s "<Secret Key>" -t "<thing-id>"
101-
```

cli/ping/ping.go

-48
This file was deleted.

cli/root.go

-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ import (
66

77
"github.com/arduino/iot-cloud-cli/cli/config"
88
"github.com/arduino/iot-cloud-cli/cli/device"
9-
"github.com/arduino/iot-cloud-cli/cli/ping"
109
"github.com/spf13/cobra"
1110
)
1211

1312
func Execute() {
1413
rootCmd := &cobra.Command{}
15-
rootCmd.AddCommand(ping.NewCommand())
1614
rootCmd.AddCommand(config.NewCommand())
1715
rootCmd.AddCommand(device.NewCommand())
1816

command/ping/ping.go

-95
This file was deleted.

go.mod

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ require (
66
github.com/arduino/arduino-cli v0.0.0-20210607095659-16f41352eac3
77
github.com/arduino/go-paths-helper v1.6.0
88
github.com/arduino/iot-client-go v1.3.3
9-
github.com/bcmi-labs/oniudra-cli v0.15.8
10-
github.com/eclipse/paho.mqtt.golang v1.3.2
119
github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6
12-
github.com/juju/errors v0.0.0-20200330140219-3fe23663418f
13-
github.com/sirupsen/logrus v1.8.1
10+
github.com/sirupsen/logrus v1.4.2
1411
github.com/spf13/cobra v1.1.3
1512
github.com/spf13/viper v1.7.0
1613
github.com/stretchr/testify v1.6.1
@@ -21,5 +18,3 @@ require (
2118
google.golang.org/genproto v0.0.0-20210504143626-3b2ad6ccc450 // indirect
2219
google.golang.org/grpc v1.39.0
2320
)
24-
25-
replace github.com/cisco/senml => github.com/bcmi-labs/senml v0.1.0

0 commit comments

Comments
 (0)