Closed tarneeb closed 5 years ago
Update: pip3 problem was just that my package uses pip
instead of pip3
The rest is still the same
Hello, as soon as I can, I will watch the script, but as far as I can see, the configuration of a system LED is failing to see if the service is running and the name of the json file is different, I have entered a correction attempt at main repository
Thank you. Yes, I eventually realized the naming issue with the json file.
Please excuse my ignorance, but how do I test your correction attempt?
@tarneeb I have entered a functional correction to the main repository, try the following:
wget --no-check-certificate https://raw.githubusercontent.com/juanesf/diyHue/master/BridgeEmulator/easy_openwrt.sh && sh easy_openwrt.sh
Thank you, it installed now. (btw I had to run the python commands in python 2.7 because I can't get pip to work with python 3 for some reason, but that shouldn't matter, right?).
Still, the service is not running properly. I don't get any error messages with /etc/init.d/hueemulatorWrt-service start
or reload
or restart
, but when I do python3 /opt/hue-emulator/HueEmulator3.py
I get:
Traceback (most recent call last): File "HueEmulator3.py", line 11, in <module> import requests ModuleNotFoundError: No module named 'requests'
edit: when starting the service I get the OpenWRT screenfetch and then Starting HueEmulator3.py
and that's it.
edit2: oh I think the problem is that requests
is only installed for python2.7, so I have to figure out how to get pip to work for python3 and get it.
edit3: ah, I get it now.. I already had a copy of easy_openwrt.sh to edit, so yours downloaded as easy_openwrt.sh1 but the command said sh easy_openwrt.sh
so it was running the old script. The python3 -m pip install --upgrade pip
worked to get pip for python 3. As you can tell, I'm not very experienced with this stuff...
It installed fine now, but I got an error that I ran out of memory even though openwrt reports 53148 kB / 124008 kB (42%).
Installing collected packages: idna, chardet, certifi, urllib3, requests, pytz, astral, ws4py ERROR: Error [Errno 12] Out of memory while executing command /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g4rqc4bk/ws4py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g4rqc4bk/ws4py/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wab2napk/install-record.txt --single-version-externally-managed --compile Running setup.py install for ws4py ... error ERROR: Could not install packages due to an EnvironmentError: [Errno 12] Out of memory
The emulator was migrated from python2.7 to python3, so the openwrt installation of python3 is in the installation script itself. I recommend you to reformat the external memory and make /overlay clean and then run the installer
It installed fine after a reboot. But I noticed that in HueEmulator3.py the server_address line is set to host ip (which I guess would be x.x.x.x:82 since that's what we changed uhttpd and lighthttpd to?) so I changed it to 80, but I still get some errors when running HueEmulator3.py:
# python3 /opt/hue-emulator/HueEmulator3.py
Exception in thread Thread-6:
Traceback (most recent call last):
File "/threading.py", line 916, in _bootstrap_inner
File "/threading.py", line 864, in run
File "/opt/hue-emulator/functions/entertainment.py", line 9, in entertainmentService
serverSocket.bind(('127.0.0.1', 2101))
OSError: [Errno 125] Address in use
Exception in thread Thread-8:
Traceback (most recent call last):
File "/threading.py", line 916, in _bootstrap_inner
File "/threading.py", line 864, in run
File "/opt/hue-emulator/HueEmulator3.py", line 1704, in run
httpd = server_class(server_address, handler_class)
File "/socketserver.py", line 456, in __init__
File "/server.py", line 136, in server_bind
File "/socketserver.py", line 470, in server_bind
OSError: [Errno 125] Address in use
Exception in thread Thread-7:
Traceback (most recent call last):
File "/threading.py", line 916, in _bootstrap_inner
File "/threading.py", line 864, in run
File "/opt/hue-emulator/HueEmulator3.py", line 1717, in run
httpd = server_class(server_address, handler_class)
File "/socketserver.py", line 456, in __init__
File "/server.py", line 136, in server_bind
File "/socketserver.py", line 470, in server_bind
OSError: [Errno 125] Address in use
similar error to the one that made me change the port to 80, but I'm not sure what to do with this one? Thanks for your patience.
Edit: should I just start from scratch?
I tell you, diyhue needs to use port 80 otherwise it would not be detectable by the other services, the change to port 80 to 82 is to access the OpenWrt configuration (192.168.x.1:82/cgi-bin/luci) since when accessing 192.168.x.1 the emulator page appears where the linkbutton is among others, once you leave port 80 on uhttpd and lighthttp you just have to restart, the service runs diyhue when you turn on the router
that error occurs because HueEmulator is already running
To manually run HueEmulator, the service must be disabled (/etc/init.d/hueemulatorWrt-service disable) and restart, once it is switched on it can be executed: python3 /opt/hue-emulator/HueEmulator3.py
I tell you, diyhue needs to use port 80 otherwise it would not be detectable by the other services, the change to port 80 to 82 is to access the OpenWrt configuration
Yes I know, I thought that since in HueEmulator.py it said host ip that it might use whatever the router is using (82) because that's what we specified for the 'host'. My misunderstanding. I didn't mean to change the port for diyhue, in fact I changed it to 80 because I thought it might have been accidentally set to 82.
that error occurs because HueEmulator is already running
I see. However it is still not working. I re-ran the install script, it installed fine, checked correct config for lighthttpd and uhttpd, can connect fine to luci web interface on port 82, but no diyhue when I go to 192.168.1.1 (on port 80 ofc) - see this pic for what happens: it downloads luci.bin from the router... so no web server.
After this I did what you said, stopped and disabled the service, restarted it, and ran Hueemulator3.py - this is the output, same error msg as before:
# python3 /opt/hue-emulator/HueEmulator3.py
Exception in thread Thread-6:
Traceback (most recent call last):
File "/threading.py", line 916, in _bootstrap_inner
File "/threading.py", line 864, in run
File "/opt/hue-emulator/functions/entertainment.py", line 9, in entertainmentService
serverSocket.bind(('127.0.0.1', 2101))
OSError: [Errno 125] Address in use
Exception in thread Thread-7:
Traceback (most recent call last):
File "/threading.py", line 916, in _bootstrap_inner
File "/threading.py", line 864, in run
File "/opt/hue-emulator/HueEmulator3.py", line 1717, in run
httpd = server_class(server_address, handler_class)
File "/socketserver.py", line 456, in __init__
File "/server.py", line 136, in server_bind
File "/socketserver.py", line 470, in server_bind
OSError: [Errno 125] Address in use
Exception in thread Thread-8:
Traceback (most recent call last):
File "/threading.py", line 916, in _bootstrap_inner
File "/threading.py", line 864, in run
File "/opt/hue-emulator/HueEmulator3.py", line 1704, in run
httpd = server_class(server_address, handler_class)
File "/socketserver.py", line 456, in __init__
File "/server.py", line 136, in server_bind
File "/socketserver.py", line 470, in server_bind
OSError: [Errno 125] Address in use
Sorry for all the trouble and thanks again for your patience.
Is port 2101 being used by another service?
Is port 2101 being used by another service?
Oh that's a good question. On the router itself, no, because I did a clean install recently and haven't grabbed any packages really. How can I check?
But I have some other devices on my network that might be using it I guess? I'm not exactly a networking wiz as you can see, but that shouldn't interfere, right? e.g have tested diyhue on a raspi (in docker and I set it up with non-default ports (8080 and 4433, and there is no 2101, only 2100) to see if it would work and it does) and on a laptop server and they are both running, I didn't think that would interfere.. I am also running things like a nextcloud instance and other stuff. Should any of this make a difference? There's an IKEA trådfri hub as well.
You can confirm these two lines at: /etc/config/uhttpd
list listen_http 0.0.0.0:82 list listen_http [::]: 82
And: /etc/lighttpd/lighttpd.conf
server.port = 82
taking a look at some forum nextcloud uses port 80 and 443, I have not tried to use different ports in openwrt, you can try to run only the emulator
I forgot to mention that apparently Chrome saves the cache or some data from the Luci page, but when entering from a private tab it works
............. I am an idiot, for lighttpd.conf server.port = 82 was commented out all along, I didn't even notice or think about it because I could reach the router on port 82 but that was due to uhttpd I guess. It works.
Thanks so much for your help - I'm going to go kill myself now
Oh snap, it's still not all good... I'm not getting the luci web interface at 192.168.1.1:82 - it's downloading luci.bin again. tried in incognito in chromium and firefox, and from another device. it's working, just took a minute.
I do get the diyhue web interface on 80 though, but when I go to import lights from tradfri the page fails to load
edit: also the dyihue bridge is not discoverable, I have to manually input the ip in e.g. hue essentials to connect. Doesn't work in the official app and others. Could it be a firewall thing?
At the moment I am on my way home, but I think you should try a clean installation to avoid other inconvenience, now it will be easier to install
Yeah I think I'm going to just reflash my router and start everything from scratch, as the web interface is back to not loading after reboot and downloading the luci lua script.. Thanks for all your help, I'll drop an update as soon as I get around to doing it
Hello, I seem to have a problema also with the start of the script hueemulatorWrt-service and it won't start even from luci returning Failed to execute "/etc/init.d/hueemulatorWrt-service enable" action: Command failed. Someone please help me.
Describe the bug OpenWrt 18.06.4 r7808-ef686b7292 on Netgear R6220 with 16GB of storage added to overlay
uhttpd and lighthttp configured to use port 82, can access router interface fine
easy_openwrt.sh errors:
To Reproduce Steps to reproduce the behavior:
ssh into router
all packages & dependencies install fine
see error
Expected behavior The service would start
Additional context package python3-pip is installed, but I don't know about pip3.