Open AidasK opened 5 years ago
some TV's respond to KEY_POWEROFF and not KEY_POWER and others are vice versa
Agree with @AidasK on this one. Would be nice to have the option as this makes power off really slow.
I do not think that a TV would turn on at all if i flip flop the commands. but at the very least I would be able to get the timing a whole lot smaller. I do not know how long it takes for the TV to power off. so i just stuck a number in there.
you can change the wait time of you want it is in the remote_websocket.py file
look for this line.
self._power_event.wait(5.0)
there are 2 lines like that. change the 5.0 to a lower number.
I think it would be cleaner just to delete these lines: https://github.com/kdschlosser/samsungctl/blob/master/samsungctl/remote_websocket.py#L112-L128
And change https://github.com/kdschlosser/samsungctl/blob/master/samsungctl/remote_websocket.py#L109
self.control('KEY_POWEROFF')
to
params = dict(
Cmd='Click',
DataOfCmd=self.config['key_poweroff'] if 'key_poweroff' in self.config else 'KEY_POWEROFF',
Option="false",
TypeOfRemote="SendRemoteKey"
)
logger.info("Sending control command: " + str(params))
self.send("ms.remote.control", **params)
It would be a breaking change for someone, but since we are rewriting and renaming this lib, we could release this change as 1.0.0 tag and nobody would be hurt.
p.s. I have edited code above, due to some magick in control
command
I will hammer out a better mechanism to power off the TV for ya. I think the Legacy TV's use TV_POWER_OFF and thee websocket ones use TV_POWER. I have to double check this.
That would be fabulous
I believe this should be working better now after some changes I made. let me know if it is up to snuff. if it is close the issue please.
Why do we need to send two events to power off the tv? https://github.com/kdschlosser/samsungctl/blob/master/samsungctl/remote_websocket.py#L114 e.g. KEY_POWEROFF and then KEY_POWER.
I would like to skip KEY_POWEROFF event, and to send KEY_POWER only. That would be a lot cleaner and faster response time.
I know it is done for compatibility reasons, but it would be nice to have an option.