Giter VIP home page Giter VIP logo

Comments (15)

ubaransel avatar ubaransel commented on July 23, 2024

When I wrote the script I assumed there would be only one LGtv. It may not function properly if more thant one LGtvs are active.

from lgcommander.

ypid avatar ypid commented on July 23, 2024

Try my fork of lgcommander and give it the parameters --host and --pairing-key.

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

Hi ubaransel, I can confirm that is the case. I've just been testing this quite intensively from the windows command line - sending the same command repeatedly and noting what happens.
Sure enough, now and again the command will hit the right screen and then I don't get prompted for the pairing key. Dissappointingly though, I do still get prompted for the command number despite including -c 20 at the end of the command.

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

Something else I noticed is that if I wait for the pairing key on the TV screen to time out and then OK the blank prompt on the PC, it will still let me send a command to the screen that the pairing key appeared on (if you follow). This got me to thinking that perhaps the pairing key is superfluous if communicating over the LAN. Perhaps the screens could be targeted more directly using the ip address?

from lgcommander.

ubaransel avatar ubaransel commented on July 23, 2024

My version doesn't have command line options. Are you using ypid fork?
https://github.com/ypid/lgcommander
read his comment above I think he is online.

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

I'm running python from the Windows command line and telling it run the lg_2012_commander script like so...

C:>python c:\lgtv_IB1.pyw -c 20

...where lgtv_IB1.pyw is a copy of lg_2012_commander.py containing the pairingkey of screen 1 in the office.

from lgcommander.

ypid avatar ypid commented on July 23, 2024

Try this https://github.com/ypid/lgcommander/archive/master.zip
and then use python c:\lgcommander.py --host %ip_of_your_tv% --pairing-key %key_of_your_tv%.

from lgcommander.

ubaransel avatar ubaransel commented on July 23, 2024

Kuhal can you see Robin Schneider (ypid) comments? you are using his version. Talk to him.
--------> https://github.com/ypid/lgcommander

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

Hi ypid,

Ah! are those %% significant?

from lgcommander.

ypid avatar ypid commented on July 23, 2024

No, this is a variable for cmd as far as I know. So for example use python c:\lgcommander.py --host 192.168.2.8 --pairing-key DDGWAF

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

Okay thanks - just fetching your script now - will let you know how I get on.

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

No dice - same problem. The DEBUG message says "No valid pairing key from user. Asking user \u2026". Our IT guy's gone home but I get the impression the splitter that sits between the PC and the TV screens polls the screens one after the other and the python script command only gets sent randomly to one screen. I either need to work out a way to tell the splitter which TV to send the command to or I need the script to loop until it gets a positive response.

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

DOH!!
I do apologise ypid - it DOES work - I managed to miskey the IP address in my command line test. I just need to create the vbscript now and get Windows scheduler to do the rest. :)

from lgcommander.

KuhalEarthShaker avatar KuhalEarthShaker commented on July 23, 2024

Thanks guys, for your help with this otherwise intractable problem.
I'm not sure if this is the right place or the right way to post this but I thought I'd make my VBscript available, since I know others have had the same issue as me, with their LG screens turning off 2 hours after automatic turn on...

' Author Nick Hewett - 14/11/2014
' This VBscipt is designed to send a remote command to multiple LG TVs connected to the same LAN
' It uses this Python script-> https://github.com/ypid/lgcommander

Dim arrTV(5,1)

PATH = "C:\Display\"
APP = "python"
SCRPT = "lgcommander.py"

' These IP addresses must be static...
IP1 = "10.44.18.15" 'IT
KEY1 = "158905"

IP2 = "10.44.18.16" 'Operations
KEY2 = "928905"

IP3 = "10.44.18.17" 'Sales
KEY3 = "728905"

IP4 = "10.44.18.18" 'Underwriting
KEY4 = "398905"

IP5 = "10.44.18.19" 'Real Estate
KEY5 = "998905"

IP6 = "10.44.18.20" 'Finance
KEY6 = "668905"

arrTV(0,0) = IP1
arrTV(0,1) = KEY1
arrTV(1,0) = IP2
arrTV(1,1) = KEY2
arrTV(2,0) = IP3
arrTV(2,1) = KEY3
arrTV(3,0) = IP4
arrTV(3,1) = KEY4
arrTV(4,0) = IP5
arrTV(4,1) = KEY5
arrTV(5,0) = IP6
arrTV(5,1) = KEY6

KEY_IDX_3D=400
KEY_IDX_ARROW_DOWN=2
KEY_IDX_ARROW_LEFT=3
KEY_IDX_ARROW_RIGHT=4
KEY_IDX_ARROW_UP=1
KEY_IDX_BACK=23
KEY_IDX_BLUE=29
KEY_IDX_BTN_1=5
KEY_IDX_BTN_2=6
KEY_IDX_BTN_3=7
KEY_IDX_BTN_4=8
KEY_IDX_CH_DOWN=28
KEY_IDX_CH_UP=27
KEY_IDX_ENTER=20
KEY_IDX_EXIT=412
KEY_IDX_EXTERNAL_INPUT=47
KEY_IDX_GREEN=30
KEY_IDX_HOME=21
KEY_IDX_MUTE=26
KEY_IDX_MYAPPS=417
KEY_IDX_NETCAST=408
KEY_IDX_PAUSE=34
KEY_IDX_PLAY=33
KEY_IDX_POWER_OFF=1
KEY_IDX_PREV_CHANNEL=403
KEY_IDX_RED=31
KEY_IDX_STOP=35
KEY_IDX_VOL_DOWN=25
KEY_IDX_VOL_UP=24
KEY_IDX_YELLOW=32

' Change the next line to suit your purposes, in my case I just want to send an 'ENTER' command 
' to stop the screens turning off 2 hours after an automatic turn on...
CMD = "-c " & KEY_IDX_ENTER

' Change 'roap' to 'hdcp' for pre-2012 TVs or omit Protocol command if unsure...
PROTO = "-P roap"

Call Send_Enter(PATH & SCRPT, CMD)

Sub Send_Enter(ByVal aFile, ByVal aCmd)
  Dim oShell
  Dim myKey
  Dim myHost
  Dim Instruction

  For i = 0 to 5
    myHost = "--host " & arrTV(i,0)
    myKey = "-k " & arrTV(i,1)
    Instruction = APP & " " & aFile & " " & PROTO & " " & aCmd & " " & myHost & " " & myKey

```
Set oShell = CreateObject("Wscript.Shell")

'Wscript.Echo Instruction

oShell.Run Instruction
```

  Next

  Set oShell = Nothing
End Sub

'Windows Command Prompt manual Command line Test (this can help you find the pairing key and protocol)...
'You need to enter the %path% command first (once every session) if the python.exe path it isn't in the registry
'C:>path %path%;C:\Program Files\Python_34 ' The path containing Python.exe
'C:>python c:\display\lgcmd.py --host 10.44.18.15
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<VBScript Ends>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

from lgcommander.

ypid avatar ypid commented on July 23, 2024

Nice that it works for you. You can open a pull request against my fork with this script an I will include it. I don’t know VBscript myself. Maybe you can remove the redundant definition of IP1 and so on and instead use comments for arrTV(0,0) =. Can you make it more generic by using the array length in For i = 0 to 5 instead of using a fixed value?

from lgcommander.

Related Issues (11)

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.