Skip to content

Claim codes ​

A claim code links one device to the customer who bought it. This page shows you how to make codes, print box labels, and move or take back a device later.

The Claim codes screen with one batch, its codes, a sample box label and the ownership rules

Before you start ​

  • Add the devices to Sensora first. A code belongs to a device that exists, and a device can have one working code at a time.
  • The Serial column shows the External ID a device had when its code was made. Set that field first, in the Configuration card on the device's page.
  • Set PUBLIC_URL to the public address of your instance before you print labels. See The address on the label.

Make a batch of codes ​

A batch is one shipping run, for example one month of one product. It can hold up to 2,000 devices.

  1. In the dashboard, open Customers, then the Claim codes tab.
  2. Select New batch of codes.
  3. Type a Batch name.
  4. Under Devices without a code, tick the devices that ship in this run. The checkbox at the top selects every device in the list.
  5. Select the button that shows the number of codes, for example Make 6 codes.

The New batch of codes dialog with six devices ticked and the button Make 6 codes

A code looks like 7Q4M-2XPA-K9TD. Upper case, lower case, spaces and dashes make no difference when a customer types it.

In the Batches list, select Labels (PDF) next to the batch.

The PDF has 12 labels on each A4 page, with dashed lines for cutting. Each label has a QR code, the line "Set up your" followed by your app name, the address of your app, and the code as text. Revoked codes are left out. The label does not print your logo, although the Box label card says so.

For your own label design, select CSV in place of the PDF. Its claim_url column holds the link for each QR code.

The address on the label ​

The QR code holds a link such as https://app.example.com/add?code=7Q4M-2XPA-K9TD.

Sensora uses the first address that exists from this list:

  1. your own domain, once its DNS check has passed on the Customer app tab,
  2. the value of PUBLIC_URL,
  3. the address in your browser when you download the PDF.

Check one label with your phone before you print a full run

  • If you set neither a domain nor PUBLIC_URL and open the dashboard at http://localhost:8090, the labels point to localhost:8090. A customer cannot use that address.
  • The printed address line has room for about 17 characters. A longer address, such as app.example.com/add, is printed cut off and ends in three dots. The QR code always holds the full address.

What the customer does ​

  1. The customer scans the QR code with their phone camera. The link opens the customer app with the code filled in. They can also open the printed address and type the code.
  2. If they are not signed in, the app asks for their email address and sends a sign-in link. The link brings them back with the code still filled in. See How customers sign in.
  3. The app checks the code and shows the product name with "ready to add".
  4. They type the room the device is in and select Add device.
  5. The app shows your Wi-Fi instructions and waits for the first reading. When it arrives, the app shows Connected.

The customer app on a phone, step 1 of 2: the code is filled in and marked ready to add, and the room is Kitchen

The scan area inside the app works only over HTTPS and in browsers that can read QR codes themselves, such as Chrome on Android. Elsewhere the customer types the code. The phone's own camera app works on any phone.

The app tells the customer when a code is unknown, revoked, or already used by another account. Each account and each IP address can try 15 codes at once and then one more every 10 seconds.

Code status ​

Each code is Not claimed, Claimed or Revoked. A claimed row shows the customer and the date. A revoked row shows your note. The button in the row is Revoke, Transfer or Reissue, depending on the status. The search box above the table finds a code by code, serial number or device ID.

Transfer a device ​

Use a transfer when a device changes hands, or when a customer typed the wrong email address.

  1. Select Transfer in the row of a claimed code.
  2. Type the New owner's email.
  3. Select Transfer.

The device moves to the account with that email address. Sensora makes the account if it does not exist. Sensora does not email the new owner, so tell them to sign in with that address.

A transfer clears the room name. The new owner does not see earlier readings, unless you turned on Keep their past readings after a transfer.

Revoke and reissue a code ​

Revoke a code when a box is lost or returned.

  1. Select Revoke in the row of a code that is not claimed. For a claimed code, select Transfer and then Revoke instead.
  2. Add a note if you want. It appears next to the code.
  3. Select Revoke code, or Revoke and free the device for a claimed code.

The code on the box stops working. If a customer owned the device, they lose it.

To sell the device again, select Reissue in the row of the revoked code. Sensora makes a new code for the same device in the same batch. Download the labels again to print it.

Ownership rules ​

The Ownership rules card has three switches. A change is saved at once.

RuleDefaultEffect
Customers can pass a device on to someone elseOffThe customer app has no button for this in version 0.1.27. Transfer the device yourself.
Free the device when a customer deletes their accountOnThe devices of a deleted account become unclaimed and their codes work again. When off, they stay held until you transfer or revoke them.
Keep their past readings after a transferOffWhen on, a new owner also sees readings from before the transfer.

Use the API ​

Every action on this page is also a request under /api/claim-codes, with the dashboard session or an admin key. See API. Two things are possible through the API only:

  • DELETE /api/claim-codes/batches/<batch id> deletes a batch and its codes, unless one of them is claimed.
  • POST /api/claim-codes/<code>/transfer with the body {"email": "[email protected]"} also works for a code that is not claimed. It gives the device to that address before the customer opens the box.

Sensora is open source under the Apache 2.0 license.