Skip to content

Remove ping command #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 1 addition & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# iot-cloud-cli

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.
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.

### Requirements

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

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


## Set a configuration

iot-cloud-cli needs to be configured before being used. In particular a client ID and the corresponding secret ID should be set.
Expand All @@ -37,65 +32,3 @@ When provisioning a device, you can optionally specify the port to which the dev
Use this command to provision a device:

`$ iot-cloud-cli device create --name <deviceName> --port <port> --fqbn <deviceFqbn>`


## Use iot-cloud-cli as a virtual device

The iot-cloud-cli can be used as a virtual device for Arduino IoT Cloud for testing.

```
$ iot-cloud-cli ping -d "<deviceId>" -s "<secret>" -t <thing ID>>
Connected to Arduino IoT Cloud
Subscribed true
Property value sent successfully 81
Property value sent successfully 87
```

### How to set up the device and thing in IoT Cloud

#### Device

* Visit https://create.arduino.cc/iot/devices and select "Add device".
* Select "Set up a 3rd party device".
* Select "ESP8266".
* From the drop down select "Generic ESP8266 Module", and click "Continue".
* Pick a nice and friendly device name.
* 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.

#### Thing ID

* Visit https://create.arduino.cc/iot/things and select "Create Thing".
* Select "Add Variable".
* Give the variable the name "counter", type "Integer Number" and leave the variable permission the value "Read & Write".
* Press the "Add Variable" button to confirm.
* Copy the "Thing ID" from the bottom right of the page.

#### Connect the device and the thing

You should connect the new device to the new thing.

#### Testing

##### Connect to the PROD environment

```shell
$ iot-cloud-cli ping -d "<Device ID>" -s "<Secret Key>" -t <Thing ID>>
```

If every works as expected you should see something similar to this output:
```
Connected to Arduino IoT Cloud
Subscribed true
Property value sent successfully 81
Property value sent successfully 87
```

If you visit https://create.arduino.cc/iot/devices the "Generic ESP8266 Module" device status should be "Online".

##### Connect to the DEV environment

The DEV environment is using a different broker, so you need to add the option `--host`:

```shell
$ iot-cloud-cli ping --host tcps://mqtts-sa.iot.oniudra.cc:8884 -d "<Device ID>" -s "<Secret Key>" -t "<thing-id>"
```
48 changes: 0 additions & 48 deletions cli/ping/ping.go

This file was deleted.

2 changes: 0 additions & 2 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import (

"github.com/arduino/iot-cloud-cli/cli/config"
"github.com/arduino/iot-cloud-cli/cli/device"
"github.com/arduino/iot-cloud-cli/cli/ping"
"github.com/spf13/cobra"
)

func Execute() {
rootCmd := &cobra.Command{}
rootCmd.AddCommand(ping.NewCommand())
rootCmd.AddCommand(config.NewCommand())
rootCmd.AddCommand(device.NewCommand())

Expand Down
95 changes: 0 additions & 95 deletions command/ping/ping.go

This file was deleted.

7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ require (
github.com/arduino/arduino-cli v0.0.0-20210607095659-16f41352eac3
github.com/arduino/go-paths-helper v1.6.0
github.com/arduino/iot-client-go v1.3.3
github.com/bcmi-labs/oniudra-cli v0.15.8
github.com/eclipse/paho.mqtt.golang v1.3.2
github.com/howeyc/crc16 v0.0.0-20171223171357-2b2a61e366a6
github.com/juju/errors v0.0.0-20200330140219-3fe23663418f
github.com/sirupsen/logrus v1.8.1
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.6.1
Expand All @@ -21,5 +18,3 @@ require (
google.golang.org/genproto v0.0.0-20210504143626-3b2ad6ccc450 // indirect
google.golang.org/grpc v1.39.0
)

replace github.com/cisco/senml => github.com/bcmi-labs/senml v0.1.0
Loading