Exemplo n.º 1
0
from libLGTV_serial import LGTV

model = '32LW300C-ZA'  # Change this to your TV's model

# Change this to the serial port you're using
# On Linux it might look like '/dev/ttyS0'
# On a Mac it might look like '/dev/tty.usbmodemfa2321'
serial_port = "/dev/ttyUSB0"

# Verify passed command
if len(sys.argv) != 2:
    print('Usage: {0} <command>'.format(sys.argv[0]))
    print('Example: {0} --togglepower'.format(sys.argv[0]))
    sys.exit(1)

tv = LGTV(model, serial_port)

# Example of adding a custom toggle command. Passing in '--toggleinput'
# will toggle between 'inputrgbpc' and 'inputdigitalcable'
tv.add_toggle('input', 'inputrgbpc', 'inputdigitalcable')
tv.add_toggle('lock', 'lockon', 'lockoff')

# Sometimes a single remote button press is detected as many. By debouncing a
# command, we make sure its only called once per button press.
tv.debounce('togglepower')
tv.debounce('togglelock')

# Finally, send the command
# .send() Returns nothing on failure, 2-digit bytecode for status commands,
# and True for other commands
print(tv.send(sys.argv[1].lstrip("--")))
Exemplo n.º 2
0
# Shows all available commands for your TV 
#
from libLGTV_serial import LGTV

# Change this to your TV's model
model = '42LW650s'

tv = LGTV(model, 'dont_care')

# Example of adding a custom toggle command. Passing in '--toggleinput'
# will toggle between 'inputrgbpc' and 'inputdigitalcable'
tv.add_toggle('input', 'inputrgbpc', 'inputdigitalcable')

tv.available_commands()
# Shows all available commands for your TV
#
from libLGTV_serial import LGTV

model = '42LK450'  # Change this to your TV's model
tv = LGTV(model, 'dont_care')

# Example of adding a custom toggle command. Passing in '--toggleinput'
# will toggle between 'inputrgbpc' and 'inputdigitalcable'
tv.add_toggle('input', 'inputrgbpc', 'inputdigitalcable')

tv.available_commands()
input("Press Enter to continue...")
Exemplo n.º 4
0
# Can be called, for example by doing "python LGTV.py --poweroff"
#
import sys
from libLGTV_serial import LGTV

model = '42LK450'                    # Change this to your TV's model

# Change this to the serial port you're using
# On a Mac it might look like '/dev/tty.usbmodemfa2321'
import os
if os.name=="nt":
    serial_port = "\\.\COM4"
else:
	serial_port = "/dev/ttyS0"

tv = LGTV(model, serial_port)

# Verify passed command
if len(sys.argv) != 2: 
    print('Usage: {0} <command>'.format(sys.argv[0]))
    print('Example: {0} --togglepower'.format(sys.argv[0]))
    print(tv.available_commands());
    sys.exit(1)

# Example of adding a custom toggle command. Passing in '--toggleinput'
# will toggle between 'inputrgbpc' and 'inputdigitalcable'
tv.add_toggle('input', 'inputrgbpc', 'inputdigitalcable')

# Sometimes a single remote button press is detected as many. By debouncing a
# command, we make sure its only called once per button press.
tv.debounce('togglepower')
Exemplo n.º 5
0
# Can be called, for example by doing "python LGTV.py --poweroff"
#
import sys
from libLGTV_serial import LGTV

model = '42LK450'                    # Change this to your TV's model

# Change this to the serial port you're using
# On Linux it might look like '/dev/ttyS0'
# On a Mac it might look like '/dev/tty.usbmodemfa2321'
serial_port = "\\.\COM4"

# Verify passed command
if len(sys.argv) != 2: 
    print('Usage: {0} <command>'.format(sys.argv[0]))
    print('Example: {0} --togglepower'.format(sys.argv[0]))
    sys.exit(1)

tv = LGTV(model, serial_port)

# Example of adding a custom toggle command. Passing in '--toggleinput'
# will toggle between 'inputrgbpc' and 'inputdigitalcable'
tv.add_toggle('input', 'inputrgbpc', 'inputdigitalcable')

# Sometimes a single remote button press is detected as many. By debouncing a
# command, we make sure its only called once per button press.
tv.debounce('togglepower')

# Finally, send the command
tv.send(sys.argv[1].lstrip("--"))
Exemplo n.º 6
0
from libLGTV_serial import LGTV

model = '42LK450'                    # Change this to your TV's model

# Change this to the serial port you're using
# On Linux it might look like '/dev/ttyS0'
# On a Mac it might look like '/dev/tty.usbmodemfa2321'
serial_port = "\\.\COM4"

# Verify passed command
if len(sys.argv) != 2:
    print('Usage: {0} <command>'.format(sys.argv[0]))
    print('Example: {0} --togglepower'.format(sys.argv[0]))
    sys.exit(1)

tv = LGTV(model, serial_port)

# Example of adding a custom toggle command. Passing in '--toggleinput'
# will toggle between 'inputhdmi1' and 'inputhdmi2'
tv.add_toggle('input', 'inputhdmi1', 'inputhdmi2')
tv.add_toggle('screenoff', 'ecooff', 'ecoscreenoff')

# Sometimes a single remote button press is detected as many. By debouncing a
# command, we make sure its only called once per button press.
tv.debounce('togglepower')

# Finally, send the command
# .send() Returns nothing on failure, 2-digit bytecode for status commands,
# and True for other commands
print(tv.send(sys.argv[1].lstrip("--")))
Exemplo n.º 7
0
from libLGTV_serial import LGTV

# Change this to your TV's model
model = '42LW650s'

# Change this to the serial port you're using
# On Linux it might look like '/dev/ttyS0'
# On a Mac it might look like '/dev/tty.usbmodemfa2321'
serial_port = "/dev/ttyS0"

# Verify passed command
if len(sys.argv) != 2: 
    print('Usage: {0} <command>'.format(sys.argv[0]))
    print('Example: {0} --togglepower'.format(sys.argv[0]))
    sys.exit(1)

tv = LGTV(model, serial_port)

# Example of adding a custom toggle command. Passing in '--toggleinput'
# will toggle between 'inputrgbpc' and 'inputdigitalcable'
tv.add_toggle('input', 'inputrgbpc', 'inputhdmi1')

# Sometimes a single remote button press is detected as many. By debouncing a
# command, we make sure its only called once per button press.
tv.debounce('togglepower')

# Finally, send the command
# .send() Returns nothing on failure, 2-digit bytecode for status commands,
# and True for other commands
print(tv.send(sys.argv[1].lstrip("--")))