Experiences I have used to get EnviroPlusWeb working properly at last.
Yet again, I completely, rebuilt EnviroPlus with PM5003 from scratch on a new 32GB microSDHC from SanDisk.
I installed Rasbian Buster (full) on 10 May 2020 from RasPi website.
I also immediately updated it with sudo apt update
I ensured that enabled were SSH and i2c.
I did all the steps (as before) that were written in MagPi 92 (Apr 2020), pp 66-69.
I then ran activities:
EnviroPlus Activities
enviroplus-python
cd examples
python all-in-one.py
Worked. Could run all applications in enviroplus-python/examples. Very Good.
EnviroPlusWeb activities
Then I installed EnviroPlusWeb
cd
git clone https://github.com/nophead/EnviroPlusWeb.git
Tried to run
cd EnviroPlusWeb
sudo python3 app.py
the last line gave this error about BM280 not able to access i2cdevice. “No module i2cdevice”
Here is a screen capture of what that said:
Table 1
Notice as well in Table 1, that after the failure, I typed in i2cdetect –y 1
It shows all of the i2c items: 23, 49 and 76.
I, then, looked at the files as follows:
Python 2 is using i2cdevice and the only place where it is located on the Raspbian from a search is:
Table 2
That is, i2cdevice is inside the python2.7 directory
/usr/local/lib/python2.7/dist-packages/i2cdevice-0.0.6-py2.7.egg/ i2cdevice
It is not inside the python3.7 directory.
This is why in Table 1 above, using python3 leads to it not being able to find i2cdevice.
Here is the structure of the /usr/local/lib/python3.7:
/usr/local/lib/python3.7/dist-packages/pimoroni_bme280-0.0.2-py3.7.egg/bme280/init.py
So I, fundamentally, changed to running EnviroPlusWeb using python2 instead of python3
i.e.
cd EnviroPlusWeb
sudo python2 app.py
Initially, it flagged as often discussed before in this discussion group that was solved on April 2 2020 by nophead in EnviroPlus Assistance:
(EnviroPlus Assistance section 44/56.)
Here is what he said:
“It seems Pimoroni have removed the font.
Try
from PIL import ImageFont
from fonts.ttf import RobotoMedium as UserFont
and change the smallfont line to:
smallfont = ImageFont.truetype(UserFont, 10)”
I inserted that and now it’s working perfectly with python2 instead of python3. Hurrah!
Even adding the standard crontab –e entry works properly after reboots.
I just added this line to crontab –e
@reboot sudo python2 /home/pi/EnviroPlusWeb/app.py &
(from Magpi 92 article Section 08 pp 68-69)
Every time, I link from my laptop using putty, to log into the Raspberry Pi that is running Enviro+ software, I can then issue a sudo reboot to the Raspberry Pi. After reboot the Enviro+ display is always visible at any time from a laptop that simply uses Internet Explorer to issue Raspberry Pi’s IP address (e.g. . 192.168.n.m )
Summary questions
1: Why is the i2cdevice not in the correct place for running python3?
2: Why has the file EnviroPlusWeb/app.py not yet been corrected to solve what that expert nophead found a month ago?
Could Pimoroni /Raspi staff update a solution to these issues? This would influence ongoing sales of Enviro+ kits I believe.
Overall, I totally support advice and comments from alphanumeric and nophead that have quickly advised solutions to me and others.
Geoff