This section walks you through integrating a device with a NervesKey with NervesHub.
Devices must be registered with NervesHub via the commandline tools, web user interface or User API first. You will need the device's manufacturing serial number for this step. If you don't have it, the Quickstart firmware or NervesKey.manufacturing_sn/1 can retrieve it. From the CLI, run mix nerves_hub.device create. Fill in the manufacturing serial number when it asks for an identifier. Fill in the description and tags fields as you'd like:
$ mix nerves_hub.device create
NervesHub server: api.nerves-hub.org:443
NervesHub organization: your_organization
description: My favorite device
Local NervesHub user password:
Device 123456789ABCDE created
When registering devices in bulk, we've found that there's usually a convenient hook in the manufacturing process to call mix nerves_hub.device create with commandline parameters. A future enhancement to NervesHub will allows you to have NervesHub automatically create devices that present properly signed device certificates and firmware metadata.
Integration with your Nerves project
You can tell nerves_hub_link to read those certificates and key from the chip and assign the SSL options for you by enabling add it as a dependency in your mix.exs:
NervesKey will default to using i2c bus 1 and :primary cerificate pair. However, you can cusomtize these options as well to use a different bus and certificate pair: