kdschlosser / samsungctl

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

Can't Wake Up TV #47

Open advokatb opened 5 years ago

advokatb commented 5 years ago

Hi. Trying to turn on my TV, but this command doesn't help samsungctl --host 192.168.1.110 --port 55000 --method legacy --key KEY_POWERON

I've got

PS D:\User\.homeassistant\new\samsungctl> samsungctl --host 192.168.1.110 --port 55000 --method legacy --name remoteCmd  --key KEY_POWERON
Available keys
====================================================

Note: Key support depends on TV model.

    Power Keys
    ------------------------------------------------
        KEY_POWERON:                        Power On

How can I wake it up? Using Windows 10.

TV Model - UE-32EH53001 TV firmware version - 002007

kdschlosser commented 5 years ago

some TV's support WOL (Wake On Lan) some do not.

mikelitka commented 5 years ago

@advokatb you can test this using the wake_on_lan.py:

python wake_on_lan.py Enter IP address:10.99.1.139 Found MAC: 28:39:5e:4a:a5:14 Send WOL packet (Y/N)?y

My TV powers on when the magic WOL packet is sent using this module.

I have a UN50MU6300

kdschlosser commented 5 years ago

ty @mikelitka for mentioning that. I forgot to.

That is correct. if you run the wake_on_lan script file directly it will test the WOL functionality. to make sure there is not an issue somewhere else that is causing it to not work.

be sure to have the TV on when you start the script. when the question comes up to send the packet. then manually turn off the TV wait a minute. then say Y to send the packet.

There are some mechanics in place to obtain the MAC address of the TV that require the TV to be on initially.. this is how the library will work.

and with explaining that I believe I may have located the bug in the program code. But I need you to let me know if your TV does power on using the script directly.

kdschlosser commented 5 years ago

I found a problem with the WOL portion of the library. give it a try and see if it works now.

raydog153 commented 5 years ago

@kdschlosser Would it be better to modify the WOL to allow one to input the MAC address? You cannot use the file wake_on_lan.py to test out WOL if the TV has been off for a while. If I already have the MAC address it would be nice to just input that to trigger WOL.

kdschlosser commented 5 years ago

I was thinking about that. I am going to modify the pairing portion of the script. because the TV needs to be on in order to pair. I will obtain the MAC address and store it in the config file. this way it never has to be entered anywhere,

I also want to take a look at the api/v2 returned JSON again. I know there is a mac address stored in there for the WiFi card ini the TV. I do not know if there is one stored in there for the Ethernet card. I have to check.

kdschlosser commented 5 years ago

OK the script has been updated. the MAC address is stored in the config file now. and can also be entered manually into the config when the config is initialized samsungctl.Config(mac=''). while I was at it I said to myself. let me add a little more work for me to do LOL, so I added detection of the method as well as the connection port. this process will only work if the TV is powered on when you initialize the Config class. so now the only needed thing to be passed is going to be the host (IP address) of the TV. This is going to be the best mechanism to use if you are going to save the config data. the call to loading the config data will bypass the detection process. the detection process will cause the library to take a few seconds longer to startup.

I am trying to come up with a better load process for the config class. one that is not going to require 2 different chunks of code to be written to start samsungctl.