# lgtv-2012

> Network remote for LG 2012 Series TV's

Latest version **0.2.0** (published 2017-04-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install lgtv-2012
pnpm add lgtv-2012
yarn add lgtv-2012
bun add lgtv-2012
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-04-11 |
| First published | 2017-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+16 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | i0null |
| Keywords | lgtv, lgtv-2012 |

## Links

- npm: https://www.npmjs.com/package/lgtv-2012
- Repository: https://github.com/i0null/node-lgtv-2012
- Homepage: https://github.com/i0null/node-lgtv-2012#readme
- Issues: https://github.com/i0null/node-lgtv-2012/issues
- npm.io page: https://npm.io/package/lgtv-2012

## Dependencies (2)

- [xpath](https://npm.io/package/xpath.md) ^0.0.24
- [xmldom](https://npm.io/package/xmldom.md) ^0.1.27

## Recent versions

- 0.2.0 (latest) — 2017-04-11
- 0.1.9 — 2017-04-11
- 0.1.8 — 2017-04-11
- 0.1.7 — 2017-04-11
- 0.1.6 — 2017-04-09
- 0.1.5 — 2017-04-08
- 0.1.3 — 2017-04-07
- 0.1.2 — 2017-04-07
- 0.1.1 — 2017-04-07
- 0.1.0 — 2017-04-07

## README

# LG TV 2012 Series Remote

NodeJS module to control LG 2012 Series TV's.

Built specifically to support the homebridge-lgtv-2012 plugin.

## Features
* Power on/off
* Mute on/off
* Change volume
* Get/Set Channel 

## Install
```npm install -g lgtv-2012```

## Get TV Pairing key

```bash 
TV_IP=172.16.0.10 node -e "lg = require('lgtv-2012').lgtv; tv = new lg({host: '$TV_IP'}); tv.pair_request()"
```

## Usage Examples

- Get/Set Volume:
```js
    this.connect((tv) => {
        tv.get_volume( (volume) => {
            console.log('Channel: ' + volume.level + ' and Mute is ' + volume.mute? 'On':'Off')

            if(volume.mute || volume.level != 10) {
                tv.set_volume(10, null)
            }
        })
    })
```

- Get/Set Channel
```js
    this.connect((tv) => {
        tv.get_channel( (channel) => {
            console.log(`Channel: #${channel.number} ${channel.title}`);
            console.log(`Program: ${channel.program}`);
        })
        tv.set_channel(107, null)
    })
```

- Turn Off
```js
    this.connect((tv) => {
        tv.turn_off(null)
    })
```

---
_Source: https://npm.io/package/lgtv-2012 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
