Closed FxAtGitHub closed 6 years ago
I had the same issue on osx. Finally i got it running like this (no changes to the sourcecode are requiered!):
bash-3.2$ virtualenv venv
New python executable in /Users/christian/git/amazon-alexa-lg-tv/venv/bin/python2.7
Also creating executable in /Users/christian/git/amazon-alexa-lg-tv/venv/bin/python
Installing setuptools, pip, wheel...done.
bash-3.2$ source venv/bin/activate
(venv) bash-3.2$ pip install -r requirements.txt
Collecting wakeonlan==0.2.2 (from -r requirements.txt (line 1))
Collecting ws4py from git+https://github.com/klattimer/WebSocket-for-Python.git#egg=ws4py (from -r requirements.txt (line 2))
Cloning https://github.com/klattimer/WebSocket-for-Python.git to /private/var/folders/pg/wpn9wpkn5mqcwsc3cw9q89nh0000gn/T/pip-build-uTtDnt/ws4py
Installing collected packages: wakeonlan, ws4py
Running setup.py install for ws4py ... done
Successfully installed wakeonlan-0.2.2 ws4py-0.4.3.dev0
(venv) bash-3.2$ python
.git/ README.md alexa-tv.py debounce_handler.pyc fauxmo.pyc requirements.txt
.gitignore __pycache__/ debounce_handler.py fauxmo.py lgtv.py venv/
(venv) bash-3.2$ python lgtv.py off
{"type": "response", "id": "0", "payload": {"returnValue": true}}
{"closing": {"reason": "", "code": 1000}}
(venv) bash-3.2$ python lgtv.py on
Update: lgtv.py
is working like i said above. But alexa-tv.py
gives this error:
File "/Users/christian/git/amazon-alexa-lg-tv/fauxmo.py", line 31, in <module>
import requests
ImportError: No module named requests
That can be solved by this
source venv/bin/activate
echo requests >> requirements.txt
pip install -r requirements.txt
Now it works like charm :)
(venv) bash-3.2$ python alexa-tv.py
DEBUG:root:Listening for UPnP broadcasts
DEBUG:root:got local address of 192.168.0.213
DEBUG:root:UPnP broadcast listener: new device registered
DEBUG:root:FauxMo device 'tv' ready on 192.168.0.213:52000
DEBUG:root:UPnP broadcast listener: new device registered
DEBUG:root:FauxMo device 'volume' ready on 192.168.0.213:52002
DEBUG:root:UPnP broadcast listener: new device registered
DEBUG:root:FauxMo device 'netflix' ready on 192.168.0.213:52003
DEBUG:root:UPnP broadcast listener: new device registered
DEBUG:root:FauxMo device 'playback' ready on 192.168.0.213:52004
DEBUG:root:UPnP broadcast listener: new device registered
DEBUG:root:FauxMo device 'plex' ready on 192.168.0.213:52001
DEBUG:root:Entering fauxmo polling loop
DEBUG:root:Responding to ON for tv
State True on tv from client @ 192.168.0.221
Magic packet sent to turn on TV!
DEBUG:root:Responding to OFF for tv
State False on tv from client @ 192.168.0.221
{"type": "response", "id": "0", "payload": {"returnValue": true}}
{"closing": {"reason": "", "code": 1000}}
TV turned off!
Closing this as it's not related to lgtv
I get the an import error "no module named ws4py". Tried on Python 2. Also converted to Python 3, same result. Any idea ? Running on Rapian Jessie