Nice app. Thanks for uploading it. It works just fine except for the mute button. Is code correct?
If you don't mind me asking, perhaps you have changed some of the audio modes for the TV speaker in the settings screen? Using other features of the TV may alternatively give the side effect of disabling the mute key.
This application was tested to work with a (UK) LW550T-ZE model TV with firmware version 4.00.18. For that TV and firmware combination, the mute button maps to keycode 9. Here is an alternative (more verbose) listing of all the key mappings found. The valid range is from 1 up to value 255.
As far as i am aware, these mappings should be consistently the same across all LG models. However you are welcome to try sending to the TV any of the unknown key codes, for which no response was found. Be warned however, the effect of those key codes is not known and I can't warrant for their effect(s).
Thanks for pointing that out. It seems to have been a typo in the official script. Fixed.
LG did provide a mechanism to change the channel using 1 single command. However its pretty much useless because it requires all three of the channel parameters unless the TV will fail to perform the action and error out:
def change_channel assigned_no, real_no, uhf_no
We may assumed that the TV auto-tuner normally sets the first 2 parameter assigned number == real number (by default). However even so, our remote control device (in this case our script) has no mechanism to know what this 3rd parameter should be (traditionally understood as the UHF channel frequency) - which may change between local regions within the same country, or be moved by the broadcasters whenever the Freeview / DVB channels are updated.
This is an inherent limitation set by LG's Wifi interface and API methods. The correct solution is to contact LG and to ask LG themselves to improve their HandleChannelChange API call. Either make it so that only one of the channel parameters is required, leaving other parameters as optional. Or for the TV to accept invalid channel information by discarding everything except for assigned_no variable. Currently, these Smart TV will not accept such invalid / partial command data and will only ever returns an error. Failing to change the channel. I really cannot do anything about this problem. If it bothers you then please contact LG and raise awareness to LG Smart TV engineers.
Otherwise, as you have already found: Sending a short sequence of 1-3 individual numbers pressed - its not ideal but at the moment the only possible solution. You can send individual keypress events by either HTTP GET/RESP or by UDP packet. By default, the script sends keypress events over TCP protocol. However that can be changed. Perhaps its worthwhile to try and switch over to using the UDP packet method.
Please see the following code:
However that solution will always incur a longer delay than the correct API method because the TV will always wait for further numerical input. This is inherently part of the direct-input channel-changing mechanism inside the TV. We cannot change this from the outside either. Therefore its still recommended to contact LG as per. to make some correction for the first solution regarding HandleChannelChange API call.
Issue #1 Crashes for me