Breakout

@alphanumeric
Now I hope it is so ok.

You didn’t need to start another thread? Just post into the other one.
Anyway, I hope things are now working correctly.

hello,
I done so (load the fonts),but i got a new error:
pi@raspberrypi:~ $ python3 test3.py
Traceback (most recent call last):
File “test3.py”, line 15, in
from ltr559 import LTR559
ModuleNotFoundError: No module named 'ltr559
greetings
rolfrd

The Enviro has an LTR-559 Light & Proximity Sensor, but your setup doesn’t. You’ll have to disable or strip out that code. I think I mentioned that in the other thread.
What example file are you running?
weather-and-light.py is the one I used, but I have the LTR-599 breakout garden breakout.
In python, if you put a # at the start of a line that line is then ignored.

EDIT: Try this, change the
from ltr559 import LTR559
to
#from ltr559 import LTR559
and
light = ltr559.get_lux()
to
light = 1000

The light= line is line 393.

Hello, Kerry,
I command out the ltr559 and loaded pytz and astral. I became a new info:
pi@raspberrypi:~ $ sudo python3 test3.py
Traceback (most recent call last):
File “test3.py”, line 379, in
temp_icon = Image.open(f"{path}/icons/temperature.png")
File “/usr/lib/python3/dist-packages/PIL/Image.py”, line 2634, in open
fp = builtins.open(filename, “rb”)
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/pi/icons/temperature.png’

Greetings
rolfrd

I’ll hook up a monitor and keyboard to my breakout garden setup and see what I did and get back to you.

In the mean time you could go here,
enviroplus-python/examples at master · pimoroni/enviroplus-python · GitHub
and copy the icons folder to your /home/pi folder. I’m thinking that’s what I probably did.

EDIT: You may already have that folder, if you ran the enviro installer, it will be in enviroplus-python/examples
If you don’t have those folders run git clone https://github.com/pimoroni/enviroplus-python
That will get you the examples folder and the icons folder. Then just copy it to home/pi.

Just had a look at my breakout garden setup. There is an icons folder in the examples folder. And if you run the examples from the default location they can find that folder and run without any icon error message.
If you do like we did and create a new file in the home/pi folder, you will need to copy the icons folder to the home/pi folder so the new file can find them. I have that same icons folder in home/pi.

Hello. Kerry,
I copied the icons-folder, but i got a message:
pi@raspberrypi:~ ls Adafruit_Python_SSD1306 bme280-python breakout-garden-master Documents enviroplus-python lib_oled96 master.zip.1 OLEDdisplayTemp.py Pimoroni Python_ST7735 rv3028test.py test1.py test3.py Videos ArduiPi_SSD1306 Bookshelf Desktop Downloads icons master.zip Music Pictures Public rv3028-python Templates test2.py test.py pi@raspberrypi:~ python3 test3.py
Traceback (most recent call last):
File “test3.py”, line 379, in
temp_icon = Image.open(f"{path}/icons/temperature.png")
File “/home/pi/.local/lib/python3.7/site-packages/PIL/Image.py”, line 2944, in open
“cannot identify image file %r” % (filename if filename else fp)
PIL.UnidentifiedImageError: cannot identify image file ‘/home/pi/icons/temperature.png’
Greetings
rolfrd

How did you copy the folder and from where?

Just to recap how I set mine all up.
I didn’t run the Enviro+ installer, I only downloaded the software from github.
git clone https://github.com/pimoroni/enviroplus-python
I did that to get the examples folder and icons folder. The rest I just deleted.
Next I installed the software for each of the breakouts.
sudo pip3 install rv3028 << And did the setup I detailed in the other post.
sudo pip3 install pimoroni-bme280 smbus
sudo pip3 install ltr559 << You don’t have this breakout so skip this.
sudo pip3 install st7735
I also did the following to make sure the LCD would be fully functional.
sudo apt-get update
sudo apt-get install python3-rpi.gpio python3-spidev python3-pip python3-pil python3-numpy
Then this to get everything else needed to run the example.
sudo pip3 install fonts
sudo pip3 install font-roboto
sudo pip3 install pytz
sudo pip3 install astral

The one big edit to the weather_and_light.py is for the LCD, it uses different pins.

 # Initialise the LCD
disp = ST7735.ST7735(
    port=0,
    cs=1,
    dc=9,
    backlight=19,
    rotation=90,
    spi_speed_hz=10000000
)

That is for the 0.96 160x80 LCD, the one used on the enviro and enviro+.
If you are using the 1.3 inch 240x240 LCD you will have a lot of edits too do to get a good image on the screen.

And as you don’t have the LTR-559, there are other edits to bypass any attempt by the python example to read from that sensor. I had one on hand so I plugged it in, it made things easier for me.
All the other sensors use i2c so no edits required to the python example are needed for them.
Depending on where you live you may have to edit the timezone etc. I had to change mine to the following to get the correct time to be displayed.

# The city and timezone that you want to display.
city_name = "Halifax"
time_zone = "Canada/Atlantic"

I made a few other changes to get what I wanted. I swapped the Date and time displays around, and changed the format of what is displayed.

# Time.
    time_elapsed = time.time() - start_time
    date_string = local_dt.strftime("%B %-d")
    time_string = local_dt.strftime("%-I:%M %p")
    img = overlay_text(background, (0 + margin, 0 + margin), date_string, font_lg)
    img = overlay_text(img, (WIDTH - margin, 0 + margin), time_string, font_lg, align_right=True)


Hello, Kerry,
I canot copy this with ssh.
Therefore I contacted a seperate hdmi-monitor on my pi-zero.
With the filemanager I copied icons from home/pi/enviroplus-python/examples to home/pi.
It were shown there.
Greetings
rolfrd

Hello, Kerry,
I will setup new.
I will copy the newest pi-os with 32bit and start a new try.
Then I will go the steps you scribe on your post!
Greetings and a good christmas
rolfrd

I don’t know why your getting that error?
I don’t think this will make any difference, but try the following anyway.
sudo apt-get update
sudo apt-get install python3-rpi.gpio python3-spidev python3-pip python3-pil

I have in the past, resorted to just starting over with a fresh install.
Especially if it feels like I’m chasing my own tail. ;)