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

Can't execute command #109

Open
advokatb opened this issue Jan 20, 2019 · 9 comments
Open

Can't execute command #109

advokatb opened this issue Jan 20, 2019 · 9 comments

Comments

@advokatb
Copy link

Hi.
I'm trying to execute command samsungctl --host 192.168.1.110 --port 8001 --method legacy KEY_CONTENTS but got an error

PS C:\WINDOWS\system32> samsungctl --host 192.168.1.110 --port 8001 --method legacy KEY_CONTENTS
Traceback (most recent call last):
  File "d:\program\python\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\program\python\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "d:\Program\Python\Python36\Scripts\samsungctl.exe\__main__.py", line 9, in <module>
  File "d:\program\python\python36\lib\site-packages\samsungctl\__main__.py", line 102, in main
    config = _read_config()
  File "d:\program\python\python36\lib\site-packages\samsungctl\__main__.py", line 32, in _read_config
    directories.append(os.path.join(os.getenv("HOME"), ".config"))
  File "d:\program\python\python36\lib\ntpath.py", line 75, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

UE-32EH5300

P.S. Also I can't turn on TV when it's off :(

@raydog153
Copy link

Have you validated you have port 8001 open on your TV? Also I think legacy method uses port 55000, so I would check that port too. Your model is very close to mine, so hopefully you have old firmware else you may have one of the TVs that we have not gotten fully working yet. Mine model is UN40H5203.

@advokatb
Copy link
Author

You were right

Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-20 18:41 Oeieyiaey (ceia)
Nmap scan report for Samsung-TV (192.168.1.110)
Host is up (0.024s latency).
Not shown: 65527 closed ports
PORT      STATE SERVICE
80/tcp    open  http
443/tcp   open  https
3697/tcp  open  nw-license
6000/tcp  open  X11
7676/tcp  open  imqbrokerd
9090/tcp  open  zeus-admin
55000/tcp open  unknown
55001/tcp open  unknown

But I still can't execute command

PS C:\WINDOWS\system32> samsungctl --host 192.168.1.110 --port 55000 --method legacy KEY_CONTENTS
Traceback (most recent call last):
  File "d:\program\python\python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\program\python\python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "d:\Program\Python\Python36\Scripts\samsungctl.exe\__main__.py", line 9, in <module>
  File "d:\program\python\python36\lib\site-packages\samsungctl\__main__.py", line 102, in main
    config = _read_config()
  File "d:\program\python\python36\lib\site-packages\samsungctl\__main__.py", line 32, in _read_config
    directories.append(os.path.join(os.getenv("HOME"), ".config"))
  File "d:\program\python\python36\lib\ntpath.py", line 75, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Maybe I should do some settings on my TV?

@raydog153
Copy link

raydog153 commented Jan 22, 2019

No, looks like your TV should support this, but you may have to wait till bugs are worked out more. I would also try port 55001.

Actually looking at the stack trace it looks like issue with trying to find config file and around this line of code:

directories.append(os.path.join(os.getenv("HOME"), ".config"))

What OS you using and is environment variable 'HOME' exist?

And whatever you do....DO NOT update your TV firmware. What firmware version do you have?

@advokatb
Copy link
Author

advokatb commented Jan 22, 2019

I use Windows (and trying to add my TV to HomeAssistant) and there is no HOME environment variable in Windows settings. Should I create it? What folder should I specify?

TV firmware version is 002007 (didn't update it for a long time or even never).

@advokatb
Copy link
Author

I've created HOME environment variable and .config file inside and now
samsungctl --host 192.168.1.110 --port 55000 --method legacy KEY_CONTENTS
works!
Your code mainly supports UNIX systems I think.
Thats why I couldn't use it out of the box.

So now I can send commands. Is there any way to power on TV from command line?

@raydog153
Copy link

This isn't my code...just trying to help. I would try the forked library https://github.com/kdschlosser/samsungctl which has added some wake on lan functionality which does work for my tv model.

@advokatb
Copy link
Author

This isn't my code...just trying to help. I would try the forked library https://github.com/kdschlosser/samsungctl which has added some wake on lan functionality which does work for my tv model.

What command do you use for WOL?
I've tried kdschlosser#47

@raydog153
Copy link

raydog153 commented Jan 22, 2019

Oh, I was using python script to WOL thru mac, not thru sending TV commands since most likely that will not work with my TV...

rboutotte@MacBook-Pro-2:~/samsungtv/samsungctl/samsungctl$ python wake_on_lan.py
Enter IP address:172.16.16.55
Found MAC: 38:01:95:54:53:13
Send WOL packet (Y/N)?Y

@advokatb
Copy link
Author

Oh, I was using python script to WOL thru mac, not thru sending TV commands since most likely that will not work with my TV...

rboutotte@MacBook-Pro-2:~/samsungtv/samsungctl/samsungctl$ python wake_on_lan.py
Enter IP address:172.16.16.55
Found MAC: 38:01:95:54:53:13
Send WOL packet (Y/N)?Y

Problems are still here.
This script asks only for IP adress, then shows an error abou get_macadress function and nothing happens.
Nevermind. Thanks for your help!

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