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

TypeError: list indices must be integers or slices, not NoneType #120

Open
henriz opened this issue Aug 19, 2019 · 9 comments
Open

TypeError: list indices must be integers or slices, not NoneType #120

henriz opened this issue Aug 19, 2019 · 9 comments

Comments

@henriz
Copy link

henriz commented Aug 19, 2019

Hello,

I have been trying to get my Samsung TV to work with home assistant. This is a maddening experience. Makes you want to burn stuff.

Anyway, I have figured out the issue is with samsungctl. So I got to this repo.

I have installed the development branch, now trying to use it:

samsungctl` --config-file samsungctl.conf KEY_MENU --name myremote

get_logger_name: samsungctl
get_logger_name: samsungctl.upnp.UPNP_Device
get_logger_name: samsungctl.upnp.UPNP_Device.adapter_addresses
get_logger_name: samsungctl.upnp.UPNP_Device.discover
get_logger_name: samsungctl.upnp.UPNP_Device.action
get_logger_name: samsungctl.upnp.UPNP_Device.icon
get_logger_name: samsungctl.upnp.UPNP_Device.service
get_logger_name: samsungctl.upnp.UPNP_Device.embedded_device
get_logger_name: samsungctl.upnp.UPNP_Device.upnp_class
get_logger_name: samsungctl.upnp.discover
get_logger_name: samsungctl.upnp
get_logger_name: samsungctl.wake_on_lan
get_logger_name: samsungctl.remote_legacy
get_logger_name: samsungctl.websocket_base
get_logger_name: samsungctl.art_mode
get_logger_name: samsungctl.application
get_logger_name: samsungctl.remote_websocket
get_logger_name: samsungctl.remote_encrypted.crypto
get_logger_name: samsungctl.remote_encrypted
Traceback (most recent call last):
File "/home/henri/python/bin/samsungctl", line 11, in
load_entry_point('samsungctl==0.8.65b0', 'console_scripts', 'samsungctl')()
File "/home/henri/python/lib/python3.7/site-packages/samsungctl-0.8.65b0-py3.7.egg/samsungctl/main.py", line 237, in main
logger.setLevel(log_levels[args.verbose])

I tried the master branch as well. This simply hangs without ever returning, multiple CTRL-C's are needed to get it to quit.

The TV is a Samsung (duh) UE48H6240AWXXN

@henriz
Copy link
Author

henriz commented Aug 19, 2019

The error is on a line configuring the logger. If I comment out the line, the tool produces:

Unable to discover any TV's

@henriz
Copy link
Author

henriz commented Aug 19, 2019

Oh, to be clear, If i do:

http://192.168.1.26:8080/ws/app/Netflix

the TV starts netflix.

@henriz
Copy link
Author

henriz commented Aug 19, 2019

Addendum, this does work:
https://github.com/eclair4151/SmartCrypto

So basically it should be able to control this TV..

@gbrissey
Copy link

@henriz
I altered the utils.py directly, the way it was formatting the log message (to add a timestamp) was throwing a Key exception. Now there are no exceptions but, it discovers NO TV as you mentioned.
The log shows it trying to discover via upnp at most of the IPs on the subnet.
Not sure why it's doing this since I gave it the IP of the TV.
And strange enough the log never shows an attempt to access the IP I gave it.
Wish I could turn off upnp discover (must be a way).

I did write a simple python script using websocket-client accessing the TV on port 8002 , the TV requests permission for the device (it's consistent through) and I get the token from the TV.
So I know the TV will respond.

Very frustrating.

@gbrissey
Copy link

Don't know about other TVs but my Q8FN has blocked port 1900, which UPNP uses.
samsungctl use UPNP to discover the TVs, this is why my TV is never found.
Too bad all that UPNP work is now blocked, no doubt due to security concerns by Samsung.
A lot of work here, but I seem to just keep going down the rabbit hole trying to figure out how to get this to work. I may just write my own stripped down version of samsungctl for controlling my TV from my Home Assitant on a RPi base on the code here.

@jkempson
Copy link

Having exactly this issue. @henriz can you post the code you changed in utils.py?

There are obviously other issues here. Would probably help to post model numbers.

I'm trying to run on Samsung NU7000

@gbrissey
Copy link

gbrissey commented Sep 29, 2019

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

Hope this helps.

@xchwarze
Copy link

xchwarze commented Oct 12, 2019

discover.py seems broken in develop branch.
Never populate self._devices...

@v0d0r
Copy link

v0d0r commented Nov 6, 2019

I seem to have a similar issue on a Samsung N5300 model.
Checked out latest development branch.
Am I missing something?

samsungctl --config-file samsungctl.conf KEY_MENU --name myremote
get_logger_name: samsungctl
get_logger_name: samsungctl.upnp.UPNP_Device
get_logger_name: samsungctl.upnp.UPNP_Device.adapter_addresses
get_logger_name: samsungctl.upnp.UPNP_Device.discover
get_logger_name: samsungctl.upnp.UPNP_Device.action
get_logger_name: samsungctl.upnp.UPNP_Device.icon
get_logger_name: samsungctl.upnp.UPNP_Device.service
get_logger_name: samsungctl.upnp.UPNP_Device.embedded_device
get_logger_name: samsungctl.upnp.UPNP_Device.upnp_class
get_logger_name: samsungctl.wake_on_lan
get_logger_name: samsungctl.upnp.discover
get_logger_name: samsungctl.upnp
get_logger_name: samsungctl.remote_legacy
get_logger_name: samsungctl.websocket_base
get_logger_name: samsungctl.art_mode
get_logger_name: samsungctl.application
get_logger_name: samsungctl.remote_websocket
get_logger_name: samsungctl.remote_encrypted.crypto
get_logger_name: samsungctl.remote_encrypted
Traceback (most recent call last):
File "/usr/local/bin/samsungctl", line 11, in
load_entry_point('samsungctl==0.8.65b0', 'console_scripts', 'samsungctl')()
File "/usr/local/lib/python2.7/dist-packages/samsungctl-0.8.65b0-py2.7.egg/samsungctl/main.py", line 237, in main
logger.setLevel(log_levels[args.verbose])
TypeError: list indices must be integers, not NoneType

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

5 participants