Open grrosminet opened 3 years ago
❯ lgtv stue setTVChannel 3_9_17_17_4_7227_70
DEBUG:root:{'id': '0', 'type': 'request', 'uri': 'ssap://tv/openChannel', 'payload': '{"channelId": 3917174722770}'}
From the log it looks like the client is stripping out the underscores before sending it to the TV.
A workaround that seems to work is to change one of the underscores to a dash:
❯ lgtv stue setTVChannel 3-9_17_17_4_7227_70
DEBUG:root:{'id': '0', 'type': 'request', 'uri': 'ssap://tv/openChannel', 'payload': '{"channelId": "3-9_17_17_4_7227_70"}'}
Thanks for this bug report, I honestly have the opinion (and I've looked it through about a dozen times), that this is entirely LG's fault. In API terms, having a value intended to be sent back in a different form that it was provided is just absurd. I imagine they have a "reason" and I suspect it's laziness.
That's not to say I won't accept a pull request - if someone wants to make one - it should be as simple as modifying the set channel method to strip the - characters out. str.replace('-', '')
It looks like the underscores are being stripped out by parseargs
in __init__.py
. It calls int
on the argument to see if it's a number, but Python's int
is quite permissive:
>>> int('1_2_3')
123
It looks like the underscores are being stripped out by
parseargs
in__init__.py
. It callsint
on the argument to see if it's a number, but Python'sint
is quite permissive:>>> int('1_2_3') 123
Thanks for your workaround, it worked for me for me long time, but now I had to new install the program and the fix seems to be no longer working. Do you have an idea what could be the issue now?
Hi, I just faced the same issue. The underscores are still being stripped, so you need to fake the string to make it a more evident string, like concatenating some of its elements with separate string. E.g.:
lgtv myTv setTVChannel "1"+"_22_2_0_1016_578_8916"
That worked for me!
My solution works, if the command is setTVChannel skip the changing to int type
if command == "setTVChannel":
# ILB
else:
f = int(argv[i])
argv[i] = f
file: lib64/python3.10/site-packages/LGTV/init.py function: parseargs() line: ~45
Can you make this a PR?
I don't know what that is. I have had a sheltered career of working on projects with myself or a crack team that handled GIT.
If you tell me what to do I'll be happy to do it.
Meh, it's easy.
Hit the fork button - then you'll have a copy of the repository in your repositories.
Change the file or files you want to merge into the project.
Commit, push, then a create pull request button will appear for you, press it, fill out the form and you're good. Then I'll check it here, press the merge button, and you earn a merit badge from GitHub :)
I'll do it. As soon as I'm able to get all the other functions to work. Can't have regression tests yet. I can use pause/play/stop but can't send buttons like ENTER or LEFT.
I can start Youtube videos. Lot's of functionality left to verify.
I can add a little bash testing script as well if you'd like
Done :)
Hi
I've a LG TV model :
getTVChannel returns this data :
I have tried several channelId with setTVChannel
But I still have the same error :
Any idea what's wrong ?