supersaiyanmode/PyWebOSTV

InputControll issues

aschavez opened this issue · 4 comments

I'm trying to create a Alexa Smart Home skill with a arduino, and when use your library for change channels with the InputControll, its only works if before I pressed one button in my physical tv remote controll, if I not press the button, the InputControll command doesn't work. My code is like this:

inp = InputControl(lg_client) inp.connect_input() if appl_action > 0: inp.channel_up() else: inp.channel_down() inp.disconnect_input()

Can you try blocking mode? inp.channel_up(block=True) and see if throws any exceptions? Also, I am unable to reproduce this on my TV -- LG CX 55 OLED (2020 model), WebOS 5.0, v03.23.15.

This section of the README might has a sample code if you'd like callbacks.

465 / 5000
Resultados de traducción
I have tried to use the callback in the connect_input function, but apparently it does not allow that parameter. I also tried to go a little deeper, placing the callback here: https://github.com/supersaiyanmode/PyWebOSTV/blob/master/pywebostv/controls.py#L437, but I have not been successful either. In addition to this, all the code is handling exceptions, but I don't see any errors. It just doesn't work if I haven't pressed a button or moved the remote controll before.

A couple things:

  1. connect_input(..) doesn't do anything more than get a separate WebSocket URL for streaming input from the primary WebSocket connect and then connect to it. If you don't see this method raising an exception, then you're good here.
  2. There are two channel_up(..)s. One is within the class TvControl and uses the primary WebSocket connection. The other is within InputControl and uses the secondary WebSocket connection that is dedicated for inputs like mouse pointer. Can you try the former and check to see if it works?
  3. There's a chance that the TV doesn't process the payload within the secondary websocket connection. Can you set up some sort of debug logs for the traffic [1] and post the payload here?
  4. Lastly, I was sort of wrong -- It is channel_up(..) within TvControl that takes block= or callback= as kwargs and not the one within InputControl. In any case, connect_input(..) does not take those params.

[1]: Put a debug log statement here: https://github.com/supersaiyanmode/PyWebOSTV/blob/master/pywebostv/controls.py#L452 and https://github.com/supersaiyanmode/PyWebOSTV/blob/master/pywebostv/controls.py#L58

Closing this issue. Please re-open if you still need help.