Closed kdschlosser closed 12 months ago
Tested this on my KS8090. In Ape:master the following works
pipenv run python -m samsungctl --host 192.168.178.24 --method websocket KEY_HDMI
whereas in this branch it does not, but somehow works when sent from interactive mode.
KEY_HDMI1
does not work at all (single command or interactive).
Ok, changing _key_interval
in remote_websocket.py
from 0.5
to 1.0
solved the problem (alternatively, put a sleep
before close
to not slow down successive keys too much).
Apparently my TV is not that fast and __exit__
closed the connection before it was done sending.
Is there no option such that connection.send
blocks until it's done? I assumed --timeout 1
means block max. 1s, but it seems like send
is just fire-and-forget. Relying on time.sleep
is pretty fragile.
It looks like my TV just doesn't accept KEY_HDMI1
. I also found no key to change back to TV apart from KEY_CHUP/CHDOWN
.
It would be nice to have a table of which models accept which keys or an option to filter --key-help
by what the connected TV accepts.
I'm now using the following workaround to reliably change to HDMI1 no matter which source is active:
pipenv run python -m samsungctl -vv --host 192.168.178.24 --method websocket KEY_SOURCE KEY_DOWN KEY_RIGHT KEY_RIGHT KEY_ENTER
Adds more remote keys. support for different keys depends on the TV. I also extended the interactive mode to include discrete inputs the mappings are as follows.
I added the command line arg --key-help to the argument parser. I supplied a default value to the positional key arguments. This is done so that if --key-help is used and no positional arguments are passed it will print off a full list of available keys. if keys are passed it will print off a help for that key
basically the key help for a single key is to show the description of that key. because there are keys that do not map out to what they actually do. In the event someone forgets what a specific key command is for.
Because I am running on Windows I added support for config file saving and loading. as this threw an error when i ran the script. I also did a little reorganization of the config file loading. this way done when i was trying to track down the problem mentioned above. I also added __future__.print_function for python 2 compatibility when printing the help for the keys. The printing of the keys gets done before a config file gets loaded. this is so that in the event the user has not set up a config file yet the --key-help will still run.
I also added .idea to gitignore .idea is to exclude the project files from pycharm