mix nerves_hub.device (nerves_hub_cli v0.11.1) View Source

Manage your NervesHub devices.

create

Create a new NervesHub device. The shell will prompt for information about the device. This information can be passed by specifying one or all of the command line options.

mix nerves_hub.device create

Command-line options

  • --product - (Optional) The product name. This defaults to the Mix Project config :app name.
  • --identifier - (Optional) The device identifier
  • --description - (Optional) The description of the device
  • --tag - (Optional) Multiple tags can be set by passing this key multiple times

bulk_create

Create many NervesHub devices via a csv file.

mix nerves_hub.device bulk_create

The CSV file should be formated as:

identifier,tags,description

Where tags is a double-quoted string, containing comma delimited tags.

Example CSV file:

identifier,tags,description
00000000d712d174,"tag1,tag2,tag3",some useful description of the device
00000000deadb33f,"qa,region1",this device should only be used with QA

Command-line options

  • --csv - Path to a CSV file

  • --product - (Optional) The product name. This defaults to the Mix Project config :app name.

update

Update values on a device.

Examples

List all devices

mix nerves_hub.device list

Command-line options

  • --product - (Optional) The product name. This defaults to the Mix Project config :app name.
  • --identifier - (Optional) Only show device matching an identifier
  • --description - (Optional) Only show devices matching a description
  • --tag - (Optional) Only show devices matching tags. Multiple tags can be supplied.
  • --status - (Optional) Only show devices matching status
  • --version - (Optional) Only show devices matching version

Update device tags

mix nerves_hub.device update 1234 tags dev qa

delete

Delete a device on NervesHub

mix nerves_hub.device delete DEVICE_IDENTIFIER

burn

Combine a firmware image with NervesHub provisioning information and burn the result to an attached MicroSD card or file. This requires that the device was already created. Calling burn without passing command-line options will generate a new cert pair for the device. The command will end with calling mix firmware.burn.

mix nerves_hub.device burn DEVICE_IDENTIFIER

Command-line options

  • --product - (Optional) The product name. This defaults to the Mix Project config :app name.
  • --cert - (Optional) A path to an existing device certificate
  • --key - (Optional) A path to an existing device private key
  • --path - (Optional) The path to put the device certificates
  • --firmware - (Optional) The path to the fw file to use. Defaults to <image_path>/<otp_app>.fw

cert list

List all certificates for a device.

mix nerves_hub.device cert list DEVICE_IDENTIFIER

Command-line options

  • --product - (Optional) The product name. This defaults to the Mix Project config :app name.

cert create

Creates a new device certificate pair. The certificates will be placed in the current working directory if no path is specified.

mix nerves_hub.device cert create DEVICE_IDENTIFIER

By default, this will send a certificate signing request to be signed by NervesHubCA (or other specified CA used with NervesHub if hosting your own).

You can also take on the role of the CA by providing your own signer certificate and key and using the --signer-cert and --signer-key options. These will be used with a NervesHub-defined certificate template to sign the generated device certificate locally

Command-line options

  • --product - (Optional) The product name. This defaults to the Mix Project config :app name.
  • --path - (Optional) A local location for storing certificates
  • --signer-cert - (Optional) Path to the signer certificate (requires --signer-key)
  • --signer-key - (Optional) Path to signer certificate's private key (requires --signer-cert)
  • --validity - (Optional) Time in years a certificate should be valid. Only used with --signer-cert and --signer-key options. Defaults to 31.

cert import

Import a trusted certificate for authenticating a device.

mix nerves_hub.device cert import DEVICE_IDENTIFIER CERT_PATH

Command-line options

  • --product - (Optional) The product name. This defaults to the Mix Project config :app name.

Link to this section Summary

Link to this section Functions

Link to this function

bulk_create(org, product, args)

View Source

Specs

bulk_create(String.t(), String.t(), keyword()) :: :ok

Specs

burn(String.t(), keyword()) :: :ok
Link to this function

cert_create(org, product, identifier, opts, auth \\ nil)

View Source

Specs

cert_create(
  String.t(),
  String.t(),
  String.t(),
  keyword(),
  nil | NervesHubUserAPI.Auth.t()
) :: :ok
Link to this function

cert_import(org, product, identifier, cert_path, opts)

View Source

Specs

cert_import(String.t(), String.t(), String.t(), String.t(), keyword()) :: :ok
Link to this function

cert_list(org, product, identifier)

View Source

Specs

cert_list(String.t(), String.t(), String.t()) :: :ok
Link to this function

create(org, product, opts)

View Source

Specs

create(String.t(), String.t(), keyword()) :: :ok
Link to this function

delete(org, product, identifier)

View Source

Specs

delete(String.t(), String.t(), String.t()) :: :ok
Link to this function

list(org, product, opts)

View Source

Specs

list(String.t(), String.t(), keyword()) :: :ok

Specs

render_help() :: no_return()

Specs

run([String.t()]) :: :ok | no_return()

Callback implementation for Mix.Task.run/1.

Link to this function

update(org, product, identifier, data)

View Source

Specs

update(String.t(), String.t(), String.t(), [String.t()]) :: :ok