Ape / samsungctl

Remote control Samsung televisions via a TCP/IP connection
MIT License
713 stars 191 forks source link

Second digit is not sent #40

Open StancuFlorin opened 7 years ago

StancuFlorin commented 7 years ago

I have something like this

with samsungctl.Remote(configremote) as remote: for digit in channel: remote.control("KEY" + digit) remote.control("KEY_ENTER") print 'The channel was changed to ', channel

but the problem is that each time the second command is not sent

If channel is "123" on my TV i get only 13.

StancuFlorin commented 7 years ago

Sometimes i get 123. I didn't was able to find why. I run the same test again and again.

StancuFlorin commented 7 years ago

$ samsungctl --host 192.168.100.4 KEY_1 KEY_2 KEY_3 KEY_ENTER

have the same behavior

Tested on Samsung UE49K5502

pedrinho commented 7 years ago

Try to add a small sleep between sending the keys... 0.1 or 0.2 seconds should be enough

Ape commented 7 years ago

Samsungctl already waits a bit between the keys, but the current time might not be long enough in some cases. Try to tweak one of these values (depending on if you use legacy or websocket):

https://github.com/Ape/samsungctl/blob/master/samsungctl/remote_legacy.py#L59 https://github.com/Ape/samsungctl/blob/master/samsungctl/remote_websocket.py#L59

We can commit the correct value for everybody if it helped. Or we can make this parameter configurable if there is any need for that.

StancuFlorin commented 7 years ago

I have created the pull request: https://github.com/Ape/samsungctl/pull/43

Ape commented 7 years ago

Are you saying that it actually helps to reduce the value? Does this fix your problem consistently? What is the lowest value that works for you?

StancuFlorin commented 7 years ago

Yes. It is weird, but this configuration is working.

jfrux commented 5 years ago

Is there not a way to do like an async / await type of logic on the requests? Is it the TV that is not fulfilling the remote requests?