kdschlosser / samsungctl

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

fixed error: AttributeError: 'NoneType' object has no attribute 'host' #53

Closed tya closed 5 years ago

tya commented 5 years ago

When executing Config.load(), the config class object (self) was being constructed with new () but not being initialized with init (**config) and was not being returned from the Config.load() class method. I added these two missing steps to address the error in issue #51

[root@homeassistant samsungctl]# /common/apps/homeassistant/bin/samsungctl --method=websocket --host=10.99.1.252 --config-file ~/.config/samsungctl.conf KEY_MENU
Traceback (most recent call last):
File "/common/apps/homeassistant/bin/samsungctl", line 11, in 
load_entry_point('samsungctl==0.8.0b0', 'console_scripts', 'samsungctl')()
File "/common/apps/homeassistant/lib/python3.6/site-packages/samsungctl-0.8.0b0-py3.6.egg/samsungctl/main.py", line 269, in main
if not config.host:
AttributeError: 'NoneType' object has no attribute 'host'

Hope this helps. Let me know if you need help testing out your upnp addition to samsungctl.

-Ty

tya commented 5 years ago

not sure why this "init()" isn't being called by return of call of "new()"

tya commented 5 years ago

key commands appear to be working for me

$  samsungctl --verbose --config-file ~/.samsungctl/office.tv KEY_MUTE
Sending control command: {'Cmd': 'Click', 'DataOfCmd': 'KEY_MUTE', 'Option': 'false', 'TypeOfRemote': 'SendRemoteKey'}
Websocket closed
kdschlosser commented 5 years ago

I am going to attack this problem a little bit differently.

tya commented 5 years ago

cool...I agree the approach you ended up using is the better.

kdschlosser commented 5 years ago

TY for making the PR and don't stop here. if you find other issues please by all means shoot me another.