Setup webOS command line interface and connect to a device
Here I go again, new machine, and I need the webOS command line tools installed and I forgot how to do it.
webOS CLI (Command Line Interface) provides a collection of commands used for creating, packaging, installing, and launching web apps in the command line environment. The CLI allows you to develop and test your app without using a specific IDE.
webOS CLI introduction
Install
To install on a mac run the following command. For other operating systems see the CLI installation documentation.
$ npm install -g @webos-tools/cli
Verify the installation. Note the command is ares
not webos
. That is it, installed and ready to go.
$ ares -V
Version: 3.2.1
ares
Just a note on the name ares
, I had no idea why that name is used instead of webos
but apparently it is an historical ‘nod’ tracing back to Palm’s development of webOS before it was acquired by HP and later LG. When LG took over webOS, they retained many of the Palm-originated tools and names, especially ares-*
commands, which were later extended for TV development. At least that is what AI told me.
Connecting to a device
To connect to a device you first need to install and setup the Developer Mode app on your TV. You can then use the CLI tools to connect to the device.
1. Install Developer Mode app on device
See the documentation for detailed instructions on how to install and set up Developer Mode on your device.
2. Connect to device via CLI
You can find details on how to connect to a device in the documentation but lets step through it here.
$ ares-setup-device
This command outputs the following.
name deviceinfo connection profile passphrase
------------------ ------------------------ ---------- ------- ----------
emulator (default) [email protected]:6622 ssh tv
** You can modify the device info in the above list, or add new device.
? Select (Use arrow keys)
❯ add
modify
set default
Select add
and follow the prompts.
Note the important prompts are Device Name and Device IP address.
- Device Name: this can be anything you like, use what makes sense for you. It might be prudent to keep the name short as it will be used in the CLI commands later. For example, I will use
lg32
to denote my 32 inch device. Additional devices might belg55
and so on - Device IP address: you get this via the Developer Mode app on the device which displays the IP Address
For Device Port and ssh user just press enter to accept the defaults.
? Enter Device Name: lg32
? Enter Device IP address: 192.168.0.19
? Enter Device Port: 9922
? Enter ssh user: prisoner
? Enter description: new device description
? Set default ? Yes
? Save ? Yes
After the above prompts are completed you should see the following for example.
name deviceinfo connection profile passphrase
-------------- -------------------------- ---------- ------- ----------
lg32 (default) [email protected]:9922 ssh tv
emulator [email protected]:6622 ssh tv
** After adding your device, you'll need to get the key file from your webOS TV.
Follow these steps:
1. Ensure that the key server button in the Developer Mode app on your webOS TV is enabled.
2. Run the command "ares-novacom --device lg32 --getkey" to retrieve the key file from your webOS TV.
3. Enter the passphrase displayed in the Developer Mode app into the prompt.
For more details, refer to the https://webostv.developer.lge.com/develop/getting-started/developer-mode-app
Note the next steps to get the key file from the device are logged to the console - this is a nice new feature of the CLI tools, I always used to forget this step and have to look it up.
As the instructions state, you need to get the key file from the device. Lets repeat the steps here for clarity.
- Key server: Ensure that the key server button in the Developer Mode app on your webOS TV is enabled
ares-novacom
: Run the commandares-novacom --device lg32 --getkey
to retrieve the key file from your webOS TV- Enter the passphrase displayed in the Developer Mode app into the prompt. Note this is labeled Passphrase in the Developer Mode app and will be something like AEBC72
For example, running the command looks like this.
$ ares-novacom --device lg32 --getkey
SSH Private Key: /Users/<name>/.ssh/lg32_webos
input passphrase:
Once you have input the passphrase you can then check that you have a connection to the TV as follows. Make sure to use the name you used when adding the device, in this case I am using lg32
.
$ ares-device --system-info --device lg32
If the connection is successful you should see output similar to the following.
[Info] Set target device : lg32
modelName : 32LQ631C0ZA
sdkVersion : 7.5.0
firmwareVersion : 04.51.05
boardType : K8AP_DVB_EU
otaId : HE_DTV_W22L_AFAAATAA
You can also list the devices you have setup with ares-setup-device --list
.
$ ares-setup-device --list
name deviceinfo connection profile passphrase
-------------- -------------------------- ---------- ------- ----------
lg32 (default) [email protected]:9922 ssh tv AEBC82
emulator [email protected]:6622 ssh tv
What next?
Package a webOS application and deploy it to a device for testing. If you don’t already have an application to test see the documentation on how to create a sample application and deploy it to a device.