Inp.Click() doesn't seem to care about Focus
kilian579 opened this issue · 20 comments
I'm using this module to create a simple remote for a WebOS-TV.
However, whenever I focus an object (menu item...) via inp.left() (up, right, down) and try to call it via inp.click() - it will not call the selected item, but execute a click at the latest position of the mouse.
Is this intended?
Is there another function to call a focused button?
That is a good question. Unfortunately, I would not have access to an LG TV until mid December. My best guess is inp.click()
should work both in mouse mode and non-mouse mode. Can you post some code -- a compact reproducible one please? I can try SSHing by the end of the week to test this :)
Example:
I started Netflix via
app = ApplicationControl(client) apps = app.list_apps() launch_info = app.launch(apps[NetflixId])
After that I connected the input:
inp = InputControl(client) inp.connect_input()
When I am at the select user screen I can switch the focus between users via inp.left()
or inp.right()
. But when I execute an input.click()
after these commands, usually Netflix will load the profile in the center. I am guessing the center is the latest mouse position by default.
Also when I'm in the Netflix home menu, I should be able to get back to the USER Select Screen via:
inp.back() inp.left() inp.up() inp.up() inp.up() inp.click()
Although the USERS-Tab will get the focus, Netflix will switch back to the home menu, because again it registered a click in the middle of the screen.
Thanks :)
I am codeveloping the project with Kilian. If you like we can arrange a remote session with my latest gen LG TV to trace down the issue... Willing to provide as much help as possible to get things going! Don't hesitate to contact us!
That is great; I'm sort of held up over the next 3 days, but we can surely connect over the weekend. I am in the pacific timezone.
In the meanwhile, can you please check if this behavior is Netflix only or TV-wide? In order words, does inp.click()
work on system settings page, app selection dock etc?
Offtopic comment: I am not sure if NetflixId
is a constant. But if you fixed it based on the output you're getting -- please don't do it. Don't rely on the order of Applications in the list. I was thinking of writing a dedicated ApplicationList
class that comes with a query-by-application-id but never got around to it.
I'm afraid, but the behavior of the inp.click() command seems to be faulty in the global system as well as all other applications.
An ApplicationList class would be very welcome. However, I think the inp.click() issue is by far more serious than an convenient way to select different apps. For the meantime we can limit our development on a few very selected apps we can hardwire for now.
We are in the CET timezone which mean we should find a time before noon on your side so it wouldn't get to late in the evening over here. The best would be if we can find a schedule on a Thursday but we can be flexible on this as long as it's not getting too late over here!
Thanks a lot for all your efforts and to support us!
This definitely is weird. Because WebOS doesn't give people any kind of API reference, I had to closely follow what Connect SDK does (may be you can try to use that library? It's in the README) and it seems like it too sends a mouse click when the center "OK" button is pressed (click() implementation here).
I'll may be SSH into my network in back at home and have my folks tell me what happens. If that doesn't work, I can may be help you over the weekend? (Sorry, Thursday/Friday might not work for me)
Today we've tried using the ConnectSDK via Android, but this try came to an end since we are unable to import the library due to some gradle errors. We are not sure which version to use. Therefore we couldn't check if this is a general issue.
Anyhow we've looked at all your given controls again and they all work well. The inp.click()
however, does something very interesting. By hovering above (with the hardware remote) & executing inp.click()
any button can be called. But - after executing the click, the mouse flicks to the center of the screen until it is moved again via the remote.
Also we've tried using the inp.enter()
control to start apps etc., which also didn't work.
PS: In case you are willing to do a remote session, what would you need from us?
Hi, I just tried doing an inp.click()
on my dad's TV. It actually works. It works as both mouse-click and a regular non-mouse button click. The model he has is LG-49UH850T, with s/w version 05.30.30. What model/version do you have? My gut feeling is that LG has changed some implementation in the newer models (and as usual, they don't have any APIs/reference for us to work with).
Also, I found a bug with SystemControl.info(), and have a new commit on master. Can you please tell me what your major_ver
and minor_ver
fields are within the object returned by SystemControl.info()?
I am out of town at the moment and won't return before Thursday. I am using a current gen OLED model with version 4.10.05. I will check the specific versions on Thursday!
Thanks again for all your support!
SystemControl.info() seems to always return null on my TV.
Got it! SystemControl.Info():
{'product_name': 'webOSTV 4.0', 'model_name': 'HE_DTV_W18O_AFABABAA', 'sw_type': 'FIRMWARE', 'major_ver': '04', 'minor_ver': '10.05', 'country': 'DE', 'country_group': 'EU', 'device_id': '78:5d:c8:5e:4a:5c', 'auth_flag': 'N', 'ignore_disable': 'N', 'eco_info': '01', 'config_key': '00', 'language_code': 'de-DE'}
Did this information help you in any way?
Sorry, I was out traveling and couldn't respond sooner. It seems like the only answer I could perhaps provide is that your TV has a newer version and WebOS chose not to be backward compatible and ignore the click messages. It certainly works with my TV and a few other TVs that don't have the latest update. Can you please try other libraries (in the readme) and tell me if that works for you? If it does -- it should be straightforward to incorporate here.
I will check with the Connect SDK in a few days. Is there any other way to debug the problem with my current gen TV? Or do you know someone with a current gen TV who is using your library?
Thanks, and please let me know if it works with ConnectSDK. As for other ways, I am sorry. I am not sure.
<rant>I wrote this library by closely following what other libraries did. Things would have been a whole lot easier if LG provided some sort of documentation, but they chose not to..</rant>
I took a look at your implemenatation and had the feeling, that the 'real' OK Button would probably be called as a button. (Click is called as type - click) So i guessed the name and..
Solved it:
Add this to controls.py
"ok": {
"command": [["type", "button"], ["name", "ENTER"]]
},
It seems like inp.click() really has its own function (maybe only on latest models). As I said, it seems to be a real click with the Magic remote's mouse. Maybe add this to your module + documentation.
Thx for your responses & effort
@supersaiyanmode Could you implement this differentiation?
@kilian579 Thanks so much for debugging this problem, really appreciate your efforts! :-)
Can you please checkout the latest develop branch and test it out? Thanks!