Description
thsq-device-flasher
is an interactive command line tool for automated flashing of hardware running the Thingsquare system.
Principle of operation
This tool creates a set of device identities on the Thingsquare backend, produces binary flash images that corresponds to those device identities, and flashes those binary images to the devices. Before flashing each device, the tool reads out the EUI of the device and associates it with the device identity on the backend.
Installation
npm install thsq-device-flasher
Requirements
Software installation requirements:
- This script is intended to be run on Cygwin under Windows, with the TI
srfprog.exe
tool installed in the path. The srfprog.exe
tool is used for the device flashing. - NodeJS
- Cygwin tools:
md5sim
, dd
Thingsquare configuration requirements:
- A product configuration on a suitable Thingsquare backend
- A valid product frontend
- A user account with a valid API token
- A valid firmware binary (
.bin
) for the devices to be flashed
Usage
node thsq-device-flasher.js <options> <binfile>
Required options:
-u <token>
: API access token
Optional options:
-b <backend>
: backend stack address (defaults to developer.thingsquare.com
)-f <frontend>
: product frontend ID (defaults to 0ac48bf3-9fab-4bad-8455-e394808eda6b
)-s <email addresses>
: comma separated list of users to automatically share new devices with-p <platform>
: platform name of newly created devices (defaults to thsq-device-flasher
)
When run, the tool asks how to flash the new device. Type a letter and press return. The possible options are:
[number]
: pre-invite device to an existing network designated by the number typedu
: flash the device as unbonded, ready to be invited into a networkn
: generate a new network ID for the new device (useful for access points)
Example usage
$ node thsq-device-flasher -u 1234abcd1234abcd1234abcd tjo.bin
OK: binfile tjo.bin, md5: d41d8cd98f00b204e9800998ecf8427e
OK: located srfprog utility in path
Logging in...
OK: logged in as user tjo@thingsquare.com
-----------------------------------------------
Found 2 networks:
* 1: xid cf7b44cb6faf7e45 with 2 devices e.g. Elis gw
* 2: xid b6e24a2675b543b3 with 101 devices e.g. t904
Menu options:
1-2 : generate and flash devices in given network
n: generate and flash device in new network
s: erase and read MAC of connected device
l: list existing devices
h: show this message
q: quit