kdschlosser / samsungctl

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

How to install/run the develop branch? #116

Open pat160 opened 5 years ago

pat160 commented 5 years ago

Hi,

I'm trying to get the develop branch installed on a Raspberry Pi in order to run the RUN_ME.py program. I'm not a very experienced Python programmer, so I might have overlooked some obvious things.

So I copied the samsungctl-develop to the /home folder I ran sudo python3 setup.py install form within the /home/samsungctl-develop folder After that I moved to the samsungctl folder and I ran the RUN_ME.py from within that folder.

I did that using Python 2 and Python 3. These are the screen output results:

Python 2 Output : _root@raspbx:/home/samsungctl-develop/samsungctl# python RUNME.py

This is going to test the functionality of the TV.
It will log all tests to the screen as well as to a series of files.
..... (left out some part of the comments)

do you want to continue? (y/n)y
The test directory
/tests
does not exist..
Would you like to create it? (y/n):y
get_logger_name: samsungctl
Traceback (most recent call last):
  File "RUN_ME.py", line 321, in <module>
    import samsungctl # NOQA
  File "/home/samsungctl-develop/samsungctl/__init__.py", line 15, in <module>
    from .remote import Remote  # NOQA
  File "/home/samsungctl-develop/samsungctl/remote.py", line 6, in <module>
    from .remote_legacy import RemoteLegacy
  File "/home/samsungctl-develop/samsungctl/remote_legacy.py", line 11, in <module>
    from . import upnp
  File "/home/samsungctl-develop/samsungctl/upnp/__init__.py", line 2, in <module>
    import requests
ImportError: No module named requests

Python 3 Output : _root@raspbx:/home/samsungctl-develop/samsungctl# python3 RUNME.py

This is going to test the functionality of the TV.
It will log all tests to the screen as well as to a series of files.
..... (left out some part of the comments)

do you want to continue? (y/n)y
get_logger_name: samsungctl
get_logger_name: samsungctl.UPNP
TESTING DISCOVER
REGISTERING DISCOVER CALLBACK
DISCOVERING TV's
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/home/samsungctl-develop/samsungctl/upnp/discover.py", line 266, in run
    json.dumps(packet, indent=4)
  File "/home/samsungctl-develop/samsungctl/utils.py", line 112, in __call__
    msg = time.strftime(msg.format('%%x  %%X'), time.localtime(time.time()))
KeyError: '\\n    "CACHE-CONTROL"'

..........
tests ran on the following TV's:
tests skipped on the following TV's:
STOPPING DISCOVER
CLOSING LOG FILES
FINISHED

root@raspbx:/home/samsungctl-develop/samsungctl#

Any idea what I might be doing wrong here? Thanks, Patrick.

Xitro01 commented 5 years ago

I got the exact same output. When you install all the required dependencies in python 2 as well, then it will also output the same error as with python 3. Trying to get samsungctl to work for ages now. With the master and develop branch in combination with a H-series TV. Nothing worked so far.

Xitro01 commented 4 years ago

I actually fixed this script by changing the following line:

in utils.py in the class DebugLogger(object): approx. Line 111

   if msg.startswith('DEBUG*;*'):
        tstamp = time.strftime(r'%x  %X   ',time.localtime(time.time()))
        # this was the original line below
        # msg = time.strftime(msg.format('%%x  %%X'), time.localtime(time.time())) 
        msg = tstamp + msg

Thx to @gbrissey

It all runs fine afterwards, but still the whole CLI for samsungctl isn't working yet. Hope kdschlosser has some time to fix this, would love to control my TV through Domoticz.