npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-netcast-tv

v2.0.2

Published

Homebridge plugin to interact with LG Netcast TVs

Downloads

8

Readme

homebridge-netcast-tv

Homebridge plugin for interacting with LG Netcast-based TVs (2012, 2013)

Warning: This is very much a proof of concept to get my TV working. It might work for you, and it might also not.

Installation

npm install -g homebridge-netcast-tv

TVs are exposed as separate accessories that you need to pair. This is a restriction of the HomeKit API, so after adding this accessory check your log files for the pairing code:

[11/24/2020, 8:29:52 PM] LG TV is running on port 60335.
[11/24/2020, 8:29:52 PM] Please add [LG TV] manually in Home app. Setup Code: 618-65-640

Setup

To pair with the TV, you need to get it to display a valid access token.

This repository also comes with a netcast-cli helper tool that you can use to query the TV:

netcast-cli --command access_token --host 192.168.1.6

Note: The default port is :8080. Not specifying a port will use the default.

Configuration

Add the platform to your config.json:

  • name: Name of the accessory
  • host: IP of your TV
  • mac: Mac address of the TV
  • accessToken: Pair code of the TV
  • keyInputDelay: Delay in ms to wait before issuing repeated key presses (such as switching input source)
  • offPauseDuration: Delay in ms to pause polling for TV status after turning off. This is needed because the TV still responds to channel query requests when it has been turned off
  • channels: List of channels that are available

Regarding channels

To identify the current channel, use the netcast-cli helper tool:

❯ netcast-cli --host 192.168.1.14:8080 --access_token xxxxx
Querying current channel
{
  chtype: 'terrestrial',
  sourceIndex: '1',
  physicalNum: '21',
  major: '81',
  displayMajor: '81',
  minor: '65535',
  displayMinor: '-1',
  chname: 'フジテレビ',
  progName: 'ザ・ノンフィクション たたかれても たたかれても… 〜山根明と妻のその 後〜',
  audioCh: '0',
  inputSourceName: 'TV',
  inputSourceType: '0',
  labelName: {},
  inputSourceIdx: '0'
}

Important notes here are:

For HDMI devices: Specify only inputSourceType and inputSourceIdx. Set type to "hdmi", this is very important!

For channels: Specify type = "tv" and the following keys:

"sourceIndex": "1",
"physicalNum": "25",
"major": "41",
"minor": "65535",
"inputSourceType": "0",
"inputSourceIdx": "0"

Example config

 "platforms": [
        {
            "platform": "LgNetcast",
            "name": "LGPlatform",
            "accessories": [
                {
                    "accessory": "LgNetcastTV",
                    "name": "TestTV",
                    "host": "192.168.1.14",
                    "mac": "cc:2d:8c:a4:4a:d6",
                    "accessToken": "xxxxx",
                    "keyInputDelay": 600,
                    "offPauseDuration": 600000,
                    "channels": [
                        {
                            "name": "AppleTV",
                            "type": "external",
                            "channel": {
                                "inputSourceType": "6",
                                "inputSourceIdx": "3"
                            }
                        },
                        {
                            "name": "Chromecast",
                            "type": "external",
                            "channel": {
                                "inputSourceType": "6",
                                "inputSourceIdx": "4"
                            }
                        },
                        {
                            "name": "Nihon TV",
                            "type": "tv",
                            "channel": {
                                "sourceIndex": "1",
                                "physicalNum": "25",
                                "major": "41",
                                "minor": "65535",
                                "inputSourceType": "0",
                                "inputSourceIdx": "0"
                            }
                        },
                    }
                }
            ]
        }

Caveats

Turning on the TV

This is not supported. It's just not possible through the Netcast API nor wakeonlan, so as a workaround, use automations and HDMI CEC through LG Simplink. Turning the TV on itself won't do anything except setting the TV state to "on".

For example, use an AppleTV or Chromecast, and turn it on when the TV state turns to "on". (I personally use homebridge-apple-tv-remote and turn the ATV on when my TV turns on.)

Switching between HDMI and TV

This is also not supported through the Netcast API. The workaround that this plugin uses is to manually open the input source menu, then physically clicking LEFT/RIGHT, then hitting "OK". That's also why the inputSourceIdx key is needed for everything.

To change the interval in which keys are being issued, change the keyInputDelay config key. For my TV the UI loads really slow, so I had to set it between 600 - 1000ms.

What is working

  • Turning the TV off
  • Switching channels
  • Displaying current channel
  • Switching between HDMI/TV through the workaround above
  • Controlling the TV through the remote API
  • Changing volume

ETC

Powered by https://github.com/dvcrn/lg-netcast