efpe / amazon-alexa-lg-tv

Control your LG TV (webOS 3) with Amazon Alexa
71 stars 45 forks source link

Doesn't work #2

Open k-bharadwaj opened 7 years ago

k-bharadwaj commented 7 years ago

amazon-alexa-lg-tv submitter$ python alexa-tv.py Traceback (most recent call last): File "alexa-tv.py", line 49, in u.init_socket() File "/Users/submitter/amazon-alexa-lg-tv/fauxmo.py", line 300, in init_socket dbg("Failed to initialize UPnP sockets:",e) TypeError: dbg() takes exactly 1 argument (2 given)

frekel commented 7 years ago

Can you tell me which version of python you are using? Maybe I can help you a bit!

efpe commented 7 years ago

That line is clearly wrong, you can try to replace it (and all the similar dbg lines) to: dbg("Failed to initialize UPnP sockets: {}".format(e))

I will push the code when I have the time. Your problem is not coming from this line but at least you will see the error message.

andrewdudex commented 7 years ago

I'm having the same issues:

Traceback (most recent call last):

File "alexa-tv.py", line 49, in u.init_socket() File "/usr/bin/amazon-alexa-lg-tv/fauxmo.py", line 300, in init_socket dbg("Failed to initialize UPnP sockets:",e) TypeError: dbg() takes exactly 1 argument (2 given)

I tried changing that line of code you suggested, efpe, and it seemed to move forward but my echo could never mind the server...

andrewdudex commented 7 years ago

If it makes any difference I'm using a mac with python version 2.7

edupin2 commented 6 years ago

I receive too this error, anyone knows how to solve it?

Traceback (most recent call last): File "/alexa-tv2/alexa-tv.py", line 69, in u.init_socket() File "/alexa-tv2/fauxmo.py", line 300, in init_socket dbg("Failed to initialize UPnP sockets:",e) TypeError: dbg() takes exactly 1 argument (2 given)

edugc310 commented 6 years ago

dbg("Failed to initialize UPnP sockets:",e) TypeError: dbg() takes exactly 1 argument (2 given)

Same error over here. It was working before. Now it is not. What happened?

edugc310 commented 6 years ago

I use this line instead: dbg("Failed to initialize UPnP sockets: {}".format(e))

I get this DEBUG:root:Failed to initialize UPnP sockets: dbg() takes exactly 1 argument (2 given)

But all the others running.

stevena9475 commented 6 years ago

i got the same, did you ever work out what was wrong

stevena9475 commented 6 years ago

DEBUG:root:Failed to initialize UPnP sockets: dbg() takes exactly 1 argument (2 given) DEBUG:root:got local address of 192.168.0.52 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'tv' ready on 192.168.0.52:52000 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'volume' ready on 192.168.0.52:52002 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'netflix' ready on 192.168.0.52:52003 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'playback' ready on 192.168.0.52:52004 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'plex' ready on 192.168.0.52:52001 DEBUG:root:Entering fauxmo polling loop

paulojhsousa commented 6 years ago

Hi efpe, Thanks for the code!

I got this running but it just enters in the loop but does not listen to any request. You said that i shall grant access to the TV while running the script but i'm afraid that it is not happening. Can you please brief me on what should be expected on that stage? Thanks and keed on with good work.

DEBUG:root:Listening for UPnP broadcasts DEBUG:root:got local address of 192.168.0.64 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'Television' ready on 192.168.0.64:52000 DEBUG:root:Entering fauxmo polling loop

edugc310 commented 6 years ago

I remember the code was running normally and suddenly stopped working. Let me know if anyone figures it out.

Linweishengla commented 6 years ago

bringing this old thread up again.

I have the script running but after DEBUG:root:Entering fauxmo polling loop nothing happens. I am using an Echo Plus btw. It is not finding the TV but if I use the lgtv.py command in the terminal I can control the TV.

Also, the script pulls my laptops IP. shouldnt it be pulling the echos IP?

phrogg commented 5 years ago

Same error here. Did you get it fixed?

w4qed commented 3 years ago

Hello anyone ever find a way I changed to dbg("Failed to initialize UPnP sockets: {}".format(e))" and it does allow polling, but does not recognize the items:

DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'lights' ready on 127.0.0.1:52215 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'mike' ready on 127.0.0.1:53009 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'mesh' ready on 127.0.0.1:53013 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'power' ready on 127.0.0.1:53101 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'flex' ready on 127.0.0.1:52315 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'modem' ready on 127.0.0.1:53103 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'icom' ready on 127.0.0.1:53001 DEBUG:root:UPnP broadcast listener: new device registered DEBUG:root:FauxMo device 'software' ready on 127.0.0.1:53015 DEBUG:root:Entering fauxmo polling loop DEBUG:root:Responding to search for lights DEBUG:root:Responding to search for mike DEBUG:root:Responding to search for mesh DEBUG:root:Responding to search for power DEBUG:root:Responding to search for flex DEBUG:root:Responding to search for modem DEBUG:root:Responding to search for icom DEBUG:root:Responding to search for software

part of my code that calls scripts:

224 if data.find('1') != -1: 225 # on 226 dbg("Responding to ON for %s" % self.name) 227 228 if (self.name == "lights"): 229 print "Command: screen -dm bash /home/w4qed/insteon/L141$ 230 os.system("screen -dm bash /home/w4qed/insteon/L1416.on") 231 232 elif (self.name == "icom"):

I have tried on several different trigger words: lights, icom, flex, modem etc.

Alexa response: lights isn't responding, please check its network connection and power supply.

Maybe not finding self name? is it any longer passed? As the python code does seem to poll right past my requests.

Python 2.7.13 may have upgraded to this version on apt update, unsure, but most likely. On a: cpuinfo: a020d3 3B Plus 1.3 1GB Raspbian GNU/Linux 9.13 (stretch)