Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing one key is ignored #4

Open
SteveAyre opened this issue Jul 28, 2017 · 1 comment
Open

Pressing one key is ignored #4

SteveAyre opened this issue Jul 28, 2017 · 1 comment

Comments

@SteveAyre
Copy link

It seems that if only one keycode is given it gets ignored. Debugging this time.sleep(delay) doesn't get called so the websocket disconnects as soon as it has sent the command, which seems to mean my TV ignores the request. Making the time.sleep run on every key solves this for me.

@WiseSage17
Copy link

WiseSage17 commented Jan 11, 2018

While True:
message = yield from websocket.recv()
parsed = json.loads(message)
if (parsed['event'] == 'ms.channel.connect'):
k = 0
for key in _keys:
k = k + 1
cmd = '{"method":"ms.remote.control","params":{"Cmd":"Click","DataOfCmd":"%s","Option":"false","TypeOfRemote":"SendRemoteKey"}}' % key
yield from websocket.send(cmd)
if k != len(_keys):
time.sleep(delay)
break
time.sleep(delay)
finally:
yield from websocket.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants