README
- Nureva® Console's CLI nu
Part of the Nureva Developer Toolkit.
🔑 Get OAuth2 access tokens for Nureva's APIs
🧪 Create and manage mock HDL200 and HDL300 devices
💻 Basic device management from the command line
Installation
Before getting started, you'll need to have Nureva Console client installed.
To install the CLI globally, run:
npm install --global @nureva/nu-console-cli
Node.js 12.0+ is required and Windows 10 is our only supported OS at this time.
Usage
Run nu help
for a list of available commands and their options and aliases. For help on a specific
command, pass the full command name (no aliases) to the help command (e.g. nu help mocks create
).
Accounts
Some nu
commands require a Nureva Console account to work. Don't have one? Create an
account.
To login as an OAuth User, run the nu account login
command, and enter your Nureva Console
credentials in the browser window that opens. To view the currently active user, run nu account show
.
To login as an OAuth Service App, run the nu account login --client-id <id> --client-secret <secret>
command. You can retrieve a client id and secret by registering a new OAuth Service
App. To view the currently active service
app, run nu account show
.
If the access token expires, nu
will automatically clear the active user and you will need to
re-run nu account login
. You can also run nu account logout
to clear the active user.
To get an access token which can be used to authenticate to Nureva's
APIs, run the nu account get-token
command. To
automatically copy the token to your clipboard, pass the --copy
option.
Mock devices
To assist in developing with Nureva's APIs, nu
provides access to mock HDL200, HDL300, and dual
HDL300 devices. These mock devices behave similarly to real devices so that you can test your code
without needing a real device.
Use the nu mocks create
command to create a mock device. You can view all your available mocks
with nu mocks list
. This command will also indicate which mock is active (only one mock can be
active at a time). To activate a mock, run nu mocks use <name>
.
When a mock device is active, it will be recognized by Nureva Console client as if it were a real device. From Nureva Console client, you can modify device settings and enroll the device in your Nureva Console account for remote device management and access to APIs in the same way you would enroll a real device. See How to generate an enrollment code with Nureva Console client for more details.
To view a mock device's current configuration, you can run nu mocks show
. This will print the raw
configuration object used by Nureva Console client. You can modify the mock's configuration using
the nu mocks config
command. The config command supports generic modification of the mock's
state
object via nu mocks config key1=value1 key2=value2
. It also provides shorthands for common
changes like setting the firmware version to latest (nu mocks config --latest-firmware
). Run nu help mocks config
to view the full documentation.
Limitations
Mock devices are helpful for development but they do have some limitations:
- Maximum of one active mock device per computer.
- There is no validation of properties based on device type. This means you can set, for example, HDL300-specific properties on an HDL200 mock device. Therefore please be careful to read the API docs carefully to ensure your code will work with real devices.
- The "Play sound test" feature of Nureva Console client does nothing for mock devices.
- The "Recalibrate" feature of Nureva Console client does nothing for mock devices.
- Changing the speaker volume is difficult to test with mock devices because it does not actually change the volume in any noticeable way.
We recommend testing your code on real devices before finishing your implementation.
Troubleshooting
There are a couple of issues which can be fixed by restarting the Nureva Console Daemon:
- If Nureva Console client stops recognizing your mock device or changes made to its configuration
- If Nureva Console client gets stuck at 100% after updating a mock device's firmware
To restart the daemon, open Windows Task Manager as administrator, navigate to the Services tab, locate the NurevaConsoleDaemon in the list, right-click on it and select Restart.
Real HDL200 or HDL300 devices connected to your computer take precedence over mock devices. Therefore, to use mock devices you must first unplug all HDL200 and HDL300 devices from your computer.
HDL300 mocks will only be recognized by Nureva Console client if the version of Nureva Console client is equal to or higher than 1.2.155193. Please update Nureva Console client if it does not recognize your mock.
Devices
Once you have mock or real devices enrolled in your Nureva Console account, you can use nu
to
retrieve some basic information about those devices. Run nu devices list
to see the full list of
devices enrolled in your account, or run nu devices show
to see more details for a specific
device. The show
command lets you search by ID, room name, or tags (e.g. nu devices show --room-name "my room"
).
Trademarks
- npm is a registered trademark of npm, Inc.
- Node.js is a trademark of Joyent, Inc. and is used with its permission. We are not endorsed by or affiliated with Joyent.