Giter Club home page Giter Club logo

lgtv.js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lgtv.js's Issues

Autodetect TV

instead of using a hostname (eg lgsmarttv.lan), autodetect the TV IP-address through SSDP.

When solved, this makes #1 unnecessary.

Open browser in fullscreen mode

I'm trying to use your package to automatically start the browser on a webpage but I can't get it to show it in fullscreen, do you know if there's a command I could run for that?

Thanks!

http adress?

router.get('/:volume', function (req, res) {
var volume = Number(req.params.volume);

what would be the http adress:

my local host is : 192.168.0.163

so:

http://192.168.0.163:5555/volume=8

doesn to work

also http adresse for mute ?

Thanks :)
Marc.

Bad socket type specified. Valid types are: udp4, udp6

if I run this I got this error

lgtv = require("lgtv");

var retry_timeout = 10; // seconds
lgtv.discover_ip(retry_timeout, function(err, ipaddr) {
  if (err) {
    console.log("Failed to find TV IP address on the LAN. Verify that TV is on, and that you are on the same LAN/Wifi.");
  } else {
    console.log("TV ip addr is: " + ipaddr);
  }
});

error

dgram.js:88
  throw new Error('Bad socket type specified. Valid types are: udp4, udp6');
        ^
Error: Bad socket type specified. Valid types are: udp4, udp6
    at newHandle (dgram.js:88:9)
    at new Socket (dgram.js:113:16)
    at Object.exports.createSocket (dgram.js:130:10)
    at Object.discover_ip (/Users/berkaey/Desktop/remote/node_modules/lgtv/index.js:208:22)
    at Object.<anonymous> (/Users/berkaey/Desktop/remote/test.js:4:6)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Can't get app icons from TV

When you send a "ssap://com.webos.applicationManager/listApps" request to TV, it gives you an array of all apps which contains URLs of icons too. But what is very interesting to me is that none of these links work! They are all dead links.
I tried to sniff into my phone's LG TV Plus traffic to see how it gets app icons from TV, but no luck!
Can someone help me with this?

Thanks.


Edit: Sorry, the solution was to use "listLaunchPoints" instead of "listApps".

Release/Versions

please add release for changes so we can just use "npm update"

Too verbose output

There's too much output on the terminal, the information is in most cases useless unless debugging.

Use eg log4js to set output levels (info, debug, error, etc).

How to turn on the TV

This isn't a question โ€“ I thought I'd put the info here since I looked for it here myself.

It seems you can't turn on the TV using these commands, presumably because it doesn't listen for commands when it's turned off.

What you instead can do is configure the TV to "wake on LAN" (wake when a certain network packet is sent to it), and then have a script send that packet.

You need to enable it on the TV: Under "general" settings, turn on "Mobile TV On".

As for the script, look for a "wake on LAN" script in your language of choice. I patched together this Ruby script, for example: https://gist.github.com/henrik/2824551d69e8e7f35ae61bd35ca08456

SSAP Endpoints

Hi,

I've just come across your repo and would like to use this for a home project but I was just wondering how did you find all the SSAP endpoints? I was wondering if there anymore endpoints that can be used which are not listed, e.g. I would like to get the profile name of the WiFi that the TV is connected to. I found on the LG docs this can be in Luna but was wondering how this would work with ws://

Thanks,

Fix for finding tv on firmware 1.4.0-2507

as you wrote here:

"Update, with the latest firmware as of today, the 1.4.0-2507(afro-ashley), the nmap looks like below. Also, I don't see it advertising itself over SSDP like before, nor answer to the ssdp query as it did before."

that's because in index.js

you have in the ssdp discovery this:
urn:dial-multiscreen-org:service:dial:1

it should be:
urn:lge-com:service:webos-second-screen:1

you can also send messages with a custom icon with a base64 encoded string of an image

{"id":"message","type":"request","uri":"ssap://system.notifications/createToast","payload":{"message": "%@", "iconData": "%@", "iconExtension": "png"}}

Invoke functions without defining callbacks

In many/most/some/a few at least of the functions, a callback is expected. The code looks like this: if (typeof fn === 'function') { which makes it break if no callback is defined. Now one is forced to use empty callbacks which clutters up etc.

Replace the instances of the above code with if (fn && typeof(fn) === 'function') { to allow invoking functions without defining callbacks.

Allow Hostname to be Set

Second, you should enable the TV to broadcast itself as lgsmarttv.lan in the local network. This setting is, IIRC, under Network/LG Connect Apps. This is necessary in order for this module to find the TV on the network.

Any thoughts on allowing users to pass in the hostname of the tv on init?

lgtv.connect('living-room', function(err, response){
  if (!err) {
    lgtv.show_float("It works!", function(err, response){
      if (!err) {
        lgtv.disconnect();
      }
    }); // show float
  }
}); // connect

missing features??

whats going on to set picture mode . , eco mode , possible to set screensaver disable and pointer off ?

how can I next/prev channel ?

like in the title, how can I manage to do that ? is there a function for this or I need to calculate from channel list?

Error on start app

Hey me again :)

I found three issue on this.

first, app names returns with "_default" at the end so before open one we need to remove "_default" from name.

second, some inputs could be listed as apps like "HDMI 1" but their ids is integer like "81273" and these won't open.

and last I got this but events works like I can open live tv or spotify but still get this.

Uncaught Exception:
TypeError: fn is not a function
  at /Users/berkaey/Desktop/remote-app/node_modules/lgtv/index.js:698:9
  at EventEmitter.<anonymous> (/Users/berkaey/Desktop/remote-app/node_modules/lgtv/index.js:269:9)
  at EventEmitter.g (events.js:260:16)
  at emitOne (events.js:77:13)
  at EventEmitter.emit (events.js:169:7)
  at WebSocketConnection.<anonymous> (/Users/berkaey/Desktop/remote-app/node_modules/lgtv/index.js:106:26)
  at emitOne (events.js:77:13)
  at WebSocketConnection.emit (events.js:169:7)
  at WebSocketConnection.processFrame (/Users/berkaey/Desktop/remote-app/node_modules/lgtv/node_modules/websocket/lib/WebSocketConnection.js:547:26)
  at /Users/berkaey/Desktop/remote-app/node_modules/lgtv/node_modules/websocket/lib/WebSocketConnection.js:321:40
  at doNTCallback0 (node.js:419:9)
  at process._tickCallback (node.js:348:13)

unable to connect

I get an error:

Connect Error: Error: getaddrinfo ENOTFOUND lgsmarttv.lan lgsmarttv.lan:3000

Does it matter if the TV is connected through lan or wifi? because my tv is connected trough wifi to my local network

Fork, Suggestion

Hello Marcus,

I published a rewrite of your lib here: https://github.com/hobbyquaker/lgtv2

I removed discovery and command wrappers and made a basic lib that just encapsulates the websocket connection handling, the pairing process and the callback handling. Further Improvements are:

  • exports a constructor, so you can connect to multiple TVs
  • Auto-reconnects to the TV
  • Is an EventEmitter, so you get events for connect/discconect/prompt/error
  • Callback handling without EventEmitter, Callback timeouts

My Intention for doing this rewrite was lgtv2mqtt, a tool I'm using in my MQTT based home automation and that depends on lgtv2.

If you like the changes I made I would suggest to rebuild your lib including your command wrappers that depends on lgtv2 and another lib that handles lg webos auto-discovery, so everything is modular.

Would be glad to hear your opinion on that,
all the best,
Sebastian

other PRs?

you mentioned other 'PR's? are these public repos? I cannot seem to find them.

Error on discover

hey with new version now I got this


/Users/berkaey/Desktop/remote/node_modules/lgtv/index.js:236
    if (message.indexOf("LG Smart TV")) {
                ^
TypeError: Object HTTP/1.1 200 OK
Location: http://192.168.1.38:1221/
Cache-Control: max-age=1800
Server: WebOS/1.5 UPnP/1.0
EXT: 
USN: uuid:495280ac-09a0-1dd8-518b-2927978aae03::urn:dial-multiscreen-org:service:dial:1
ST: urn:dial-multiscreen-org:service:dial:1
Date: Wed, 04 Nov 2015 08:39:23 GMT

 has no method 'indexOf'
    at Socket.<anonymous> (/Users/berkaey/Desktop/remote/node_modules/lgtv/index.js:236:17)
    at Socket.emit (events.js:98:17)
    at UDP.onMessage (dgram.js:441:8)

btw I have node 0.10.36 as global

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.