supersaiyanmode / PyWebOSTV

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

How do I avoid registering with the API? #35

Closed Juanipis closed 3 years ago

Juanipis commented 4 years ago

I'm trying to put data into the "store" dictionary but it doesn't work. Any guide or example to do it?

supersaiyanmode commented 4 years ago

Please explain "it doesn't work"? What happens exactly? Can you please attach your full source code? At the moment, implementation of a "store" object is outside the scope of this library.

It is really up to do, all the object needs to do is behave like a dictionary. I might have an example, I'll attach it soon.

Juanipis commented 4 years ago

I write ` store = {'key' : '12345678'}

client = WebOSClient.discover()[0] client.connect() for status in client.register(store): if status == WebOSClient.PROMPTED: print("Please accept the connect on the TV!") elif status == WebOSClient.REGISTERED: print("Registration successful!") ` But always the tv ask me if i want acces

supersaiyanmode commented 4 years ago
  1. Use an empty store dictionary in the first line
  2. Go through the rest of the code
  3. The library will populate the store dictionary for you, when you reach "Registration successful" stage.
  4. Once the registration is complete, save the dictionary to the file/DB/etc. Next time your app opens, read this DB and populate the store with the value you previously stored. If you do it correctly, you won't have to go through authorization process on the TV the second time.

Also, I think this is broadly explained in the README. Feel free to send me a PR to update the README if you feel the instructions aren't super clear.

Gustry commented 4 years ago

I just updated the a little bit the example, please have a look again https://github.com/supersaiyanmode/PyWebOSTV/blob/master/README.md#establishing-the-connection

Juanipis commented 4 years ago

Ah ok, now is super clear, thanks

Gustry commented 4 years ago

Let's close this ticket