supersaiyanmode / PyWebOSTV

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

I'm trying to learn from this library to implement webOS controls in SWIFT, would appreciate the help #51

Closed msonnino closed 3 years ago

msonnino commented 3 years ago

Hi! I'm implementing WebOS control in my iOS app, and this library is very useful in order to figure this process out. Unfortunately some stuff I can't figure out cause I don't really know python.

I'm having difficulty sending "input control" commands (a.k.a "mouse commands"). I've managed to get the input socket path from the TV via the normal socket, but I'm not able to send any commands to the TV (like UP, DOWN, LEFT, RIGHT, etc.) Any chance someone can give me an example of the String that's being sent to the mouse socket? (for example the "HOME" command) I'll try to figure it out from there.

Also, I would appreciate it if anyone could explain what's the difference between the normal TV socket and the mouse socket. Going through the code here it seems like they're not the same.

Thanks for the help!

supersaiyanmode commented 3 years ago

If you're able to read Python, this particular test case has what you're looking for.

Or this particular line in the library.

In any case, the payload looks like:

key1:value1\n
key2:value2\n
\n

Note that "\n" above is a newline character. So, to move your mouse pointer 3 steps to the right and 5 steps up, you would send a payload like: type:move\ndx:3\ndy:5\ndown:0\n\n. With this understanding, please look here for a self-explanatory payload definition for various action.