# Sending remote press via the command line

**URL:** <https://forum.webostv.developer.lge.com/t/sending-remote-press-via-the-command-line/19147>\
**Category:** Web App Development\
**Created:** [January 21, 2025, 11:42am UTC](https://forum.webostv.developer.lge.com/t/sending-remote-press-via-the-command-line/19147 "2025-01-21T11:42:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sameast1982](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@sameast1982](https://forum.webostv.developer.lge.com/u/sameast1982)\
**Post date:** [January 21, 2025, 11:42am UTC](https://forum.webostv.developer.lge.com/t/sending-remote-press-via-the-command-line/19147/1 "2025-01-21T11:42:15Z")

</div>

Hi,

I have been reading the docs here - [CLI Developer Guide | webOS TV Developer](https://webostv.developer.lge.com/develop/tools/cli-dev-guide#ares-server)

And i see you can use

```auto
ares-novacom --device tv --run "ps aux"

```

Ive tried

```auto
ares-novacom --device tv --run "luna://com.webos.service.audio/volumeUp"

```

To run cmds on the TV.

What I am trying to do it is be able to control the TV from the cmd line without the remote.

I have also tried websockets

```auto
const WebSocket = require('ws');
const fs = require('fs');

const TV_IP = '192.168.8.xxx';
const KEY_FILE = 'lgtv_key.json';

function connectToTV() {
    return new Promise((resolve, reject) => {
        const ws = new WebSocket(`ws://${TV_IP}:3000`, { perMessageDeflate: false });

        let clientKey = null;
        if (fs.existsSync(KEY_FILE)) {
            clientKey = JSON.parse(fs.readFileSync(KEY_FILE)).clientKey;
        }

        ws.on('open', () => {
            console.log('✅ Connected to LG TV. Requesting authentication...');

            const authPayload = {
                type: 'register',
                id: 'register_0',
                payload: {
                    forcePairing: false,
                    manifest: {
                        appVersion: '1.0',
                        manifestVersion: 1,
                        permissions: [
                            'ssap://api/getServiceList',
                            'ssap://com.webos.service.networkinput/getPointerInputSocket',
                            'ssap://com.webos.service.ime/sendEnterKey'
                        ],
                        signatures: [{
                            signature: 'dummy_signature',
                            signatureVersion: 1
                        }]
                    }
                }
            };

            if (clientKey) {
                console.log('🔑 Using existing clientKey:', clientKey);
                authPayload.payload['client-key'] = clientKey;
            }

            ws.send(JSON.stringify(authPayload));
        });

        ws.on('message', (data) => {
            const message = JSON.parse(data);
            console.log('📩 Received message:', message);

            if (message.type === 'registered') {
                const newClientKey = message.payload['client-key'];
                if (newClientKey) {
                    fs.writeFileSync(KEY_FILE, JSON.stringify({ clientKey: newClientKey }));
                    console.log('✅ Authentication successful! Key saved:', newClientKey);
                } else {
                    console.log('⚠️ Authentication failed: No client key received.');
                }

                ws.close();
                resolve();
            }
        });

        ws.on('error', (err) => {
            console.error('❌ WebSocket error:', err);
            reject(err);
        });

        ws.on('close', () => {
            console.log('🔌 Connection closed.');
        });
    });
}

async function start() {
    console.log('🔑 Running LG TV Authentication...');
    try {
        await connectToTV();
        console.log('✅ Done! You can now control the TV.');
    } catch (err) {
        console.error('❌ Error during authentication:', err);
    }
}

start();

```

And send like this.

```auto
const WebSocket = require('ws');
const fs = require('fs');

const TV_IP = '192.168.8.xxx';
const KEY_FILE = 'lgtv_key.json';

let clientKey = null;
if (fs.existsSync(KEY_FILE)) {
    clientKey = JSON.parse(fs.readFileSync(KEY_FILE)).clientKey;
}

if (!clientKey) {
    console.error('❌ No client key found. Run auth_store.js first.');
    process.exit(1);
}

async function sendKeyCommand(key) {
    return new Promise((resolve, reject) => {
        const ws = new WebSocket(`ws://${TV_IP}:3000`, { perMessageDeflate: false });

        ws.on('open', () => {
            console.log('✅ Connected to LG TV. Sending key:', key);

            ws.send(JSON.stringify({
                id: 'send_key',
                type: 'request',
                uri: 'ssap://com.webos.service.ime/sendEnterKey',
                payload: {},
                clientKey: clientKey // ✅ Include the clientKey in the request
            }));
        });

        ws.on('message', (data) => {
            console.log('📩 Response:', data.toString());
            ws.close();
            resolve();
        });

        ws.on('error', (err) => {
            console.error('❌ WebSocket error:', err);
            reject(err);
        });

        ws.on('close', () => {
            console.log('🔌 Connection closed.');
        });
    });
}

// 🕹️ Send the "ENTER" key command
sendKeyCommand('ENTER');

```

But this doesn’t seem to work for arrows etc.

Can someone suggest the best way to do this without an IR blaster like the RM Mini? I would appreciate any suggestions on the right setup to use.

---

<div class="post-metadata">

**Author:** ![jaredcat](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@jaredcat](https://forum.webostv.developer.lge.com/u/jaredcat)\
**Post date:** [February 5, 2026, 12:27am UTC](https://forum.webostv.developer.lge.com/t/sending-remote-press-via-the-command-line/19147/2 "2026-02-05T00:27:51Z")

</div>

You need to send commands over a web socket connection to `getPointerInputSocket`. And volume and some other commands are sent not over this websocket, for example: `ssap://audio/volumeUp`

> <https://github.com/hobbyquaker/lgtv2/blob/d58f87092ab2d60b39a2d83d5729d524495cc096/index.js#L16-L28>

[https://forum.webostv.developer.lge.com/t/cursor-socket-help/3769/5](https://forum.webostv.developer.lge.com/t/cursor-socket-help/3769/5)
