Regarding scripting of certification to cloud

Hi everyone!

In preparations of getting our custom nRF9160 HW, I'm making use of the fantastic scripts to generate credentials and provision our devices with nRFCloud.

I have successfully generate our CA as such:

python create_ca_cert.py -c NO -o "Copmany AS" -cn Company -e [email protected] -p absolute/path/to/output/folder -f company-

Then I installed the credentials as such:

python device_credentials_installer.py -A -d --ca absolute/path/to/...efd212_ca.pem --ca_key absolute/path/to/...efd212_prv.pem --csv provision.csv --rtt --devinfo devinfo.csv --devinfo_append --mosh_rtt_hex absolute/path/to/merged.hex

Finally I provisioned them as such:

python nrf_cloud_provision.py --apikey $APIKEY --csv provision.csv --devinfo devinfo.csv --name_prefix Company- --name_imei

All the scripts run without error.

However, after installing my own app on the device again, and attempting to connect to the cloud, I get 

<dbg> app: cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_CONNECTING
<err> nrf_cloud_transport: MQTT input error: -128
<err> nrf_cloud_transport: Error disconnecting from cloud: -128
<dbg> app: cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED

Q1: I guess I've missed a step somewhere? A new device shows up in the web portal. Can you please guide me? Is there something I've done wrong or missed?

Q2: The device in the web portal has a long and unreadable name. How can I chose my own name of the devices? I would like them to be more readable. I tried using devinfo with --name_prefix and --name_imei, but alas, to no avail. I guess I've misunderstood the meaning of the devinfo here? Are there any ways to chose my own name during this process?

Thank you all for all and any help!

Kind regards,

Torje

Parents
  • Hi Torje,

    You can find how they are used from the source codes: utils/nrf_cloud_provision.py at master · nRFCloud/utils (github.com).

      --name_imei          Use the device's IMEI as the friendly name. Requires --devinfo. (default: False)
      --name_prefix NAME_PREFIX
                            Prefix string for IMEI friendly name (default: None)

    If you input --devinfo devinfo.csv --name_prefix Company- --name_imei arguments, the client ID will be changed to Company-xxxxxxxxxxxxxxx and will be stored with credentials into nRF cloud, then you can use the following configuration when building the device firmware.

    CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=n
    CONFIG_NRF_CLOUD_CLIENT_ID_SRC_IMEI=y
    CONFIG_NRF_CLOUD_CLIENT_ID_PREFIX="Company-"

    Best regards,
    Charlie

Reply
  • Hi Torje,

    You can find how they are used from the source codes: utils/nrf_cloud_provision.py at master · nRFCloud/utils (github.com).

      --name_imei          Use the device's IMEI as the friendly name. Requires --devinfo. (default: False)
      --name_prefix NAME_PREFIX
                            Prefix string for IMEI friendly name (default: None)

    If you input --devinfo devinfo.csv --name_prefix Company- --name_imei arguments, the client ID will be changed to Company-xxxxxxxxxxxxxxx and will be stored with credentials into nRF cloud, then you can use the following configuration when building the device firmware.

    CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=n
    CONFIG_NRF_CLOUD_CLIENT_ID_SRC_IMEI=y
    CONFIG_NRF_CLOUD_CLIENT_ID_PREFIX="Company-"

    Best regards,
    Charlie

Children
  • Hi Charlie,

    I've been studying and testing based on this documentation, but I'm not really the wiser from it. It seems to me that getting the prefix and the IMEI as names is done by:

     --id_str ID_STR       Device ID to use instead of UUID. Will be a prefix if used with --id_imei (default: )
      --id_imei             Use IMEI for device ID instead of UUID. Add a prefix with --id_str (default: False)

    Using the devinfo made no difference, but these arguments did. I have tried the different combinations of it. In my case, the devinfo changes, with name_imei and name_prefix, makes no change. The changes in my snip above are what changes the name, and works when setting the corresponding configs the firmware.

    These are my obsevations, where the name_imei and name_prefix makes no difference. Am I mistaken or totally wrong? 

    Thanks again!

    -Torje

Related