supersaiyanmode / PyWebOSTV

Python API for controlling LG TVs (Web OS)
MIT License
261 stars 50 forks source link

Unable to connect to mouse exception #57

Closed HanSooloo closed 3 years ago

HanSooloo commented 3 years ago

Trying to do a simple connection where my app will send Enter/Click to the TV. Why can I not get the Enter/Click command to work?

My code is as follows:

from pywebostv.discovery import *    
from pywebostv.connection import *
from pywebostv.controls import *

store = {'client_key', '<_super_secret_key_>'}

client = WebOSClient("lgwebostv")
client.connect()

inp = InputControl(client)
inp.connect_input()

inp.enter()

inp.disconnect_input()

However, when I run this, I get the following output:

Traceback (most recent call last):
  File "lgtv.py", line 39, in <module>
    inp.connect_input()
  File "/Users/user/Developer/LGTV/pywebostv/lib/python3.7/site-packages/pywebostv/controls.py", line 382, in connect_input
    raise IOError("Unable to connect to mouse.")
OSError: Unable to connect to mouse.

The Wireshark capture of this transaction has the following coming back from the TV:

{"type":"error","id":"79db27fd-49e6-47ba-bdeb-41a3e6285708","error":"401 insufficient permissions (not registered)","payload":{}}
supersaiyanmode commented 3 years ago

As the error says, you haven't registered. Please re-read the steps in the readme file. Specifically, you have to iterate over the results of client.register(store).

Gustry commented 3 years ago

Indeed store variable is not used in your script.