View Source mix nerves_hub.device (nerves_hub_cli v2.0.1)

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

You must 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 - (required) Path to the signer certificate
  • --signer-key - (required) Path to signer certificate's private key
  • --validity - (Optional) Time in years a certificate should be valid. 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.

Summary

Functions

Link to this function

bulk_create(org, product, args)

View Source
@spec bulk_create(String.t(), String.t(), keyword()) :: :ok
@spec burn(
  String.t(),
  keyword()
) :: :ok
Link to this function

cert_create(org, identifier, opts)

View Source
@spec cert_create(
  String.t(),
  String.t(),
  keyword()
) :: :ok
Link to this function

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

View Source
@spec cert_import(
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  keyword()
) :: :ok
Link to this function

cert_list(org, product, identifier)

View Source
@spec cert_list(String.t(), String.t(), String.t()) :: :ok
Link to this function

create(org, product, opts)

View Source
@spec create(String.t(), String.t(), keyword()) :: :ok
Link to this function

delete(org, product, identifier)

View Source
@spec delete(String.t(), String.t(), String.t()) :: :ok
Link to this function

list(org, product, opts)

View Source
@spec list(String.t(), String.t(), keyword()) :: :ok
@spec render_help() :: no_return()
@spec run([String.t()]) :: :ok | no_return()

Callback implementation for Mix.Task.run/1.

Link to this function

update(org, product, identifier, data)

View Source
@spec update(String.t(), String.t(), String.t(), [String.t()]) :: :ok