d-bieber / pi_statusdisplay

Small Python status script, which displays informations on a 2.7" OLED
MIT License
8 stars 2 forks source link

pi_statusdisplay to work with OLED SH1106? #2

Closed Timppa71 closed 4 years ago

Timppa71 commented 4 years ago

Hi.

I have try to have my pi_statusdisplay to work in my Raspberry Pi Zero with SH1106 OLED display but I have managed to only partial... It would be great if you have time to help me to have it work and maybe other people also :)

So, if I try to run main.py, I have only clock display which is working fine. The PiHole display is totally black, and in the PiStatus display there is only bar but no text at all. Same in Weather display, it is black, no text.

Pihole API sent correct data and it is "Enabled". Also I have correct API key and CITY ID from OpenWeatherMap... Obviously I have missed something but what? Can you help me, please? I think that one of the issue is my display SH1106 but I have not managed to get any of OLED displays with driver SSD1306.

d-bieber commented 4 years ago

Hi,

first you should check if the crash.log is showing something. If none is there, create an empty file named "crash.log" and run again.

Because you say the clock is working, I think there is some problem with my text printing methods. You probably didn't download the required fonts. Just download the fonts from the luma.examples repo here and put them in a folder "fonts" in the program folder.

Timppa71 commented 4 years ago

Thanks for the reply.

I have copied font-folder into pi_statusdisplay folder. After this I got following "error":

**' Version: luma.oled 3.5.0 (luma.core 1.14.1) Display: sh1106 Interface: i2c Dimensions: 128 x 64

Traceback (most recent call last): File "main.py", line 459, in start() File "main.py", line 41, in start brands_font = oled.make_font("fa-brands.ttf", device.height - 30) File "/home/pi/pi_statusdisplay/oled_control.py", line 41, in make_font return ImageFont.truetype(font_path, size) File "/usr/local/lib/python3.7/dist-packages/PIL/ImageFont.py", line 655, in truetype return freetype(font) File "/usr/local/lib/python3.7/dist-packages/PIL/ImageFont.py", line 652, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "/usr/local/lib/python3.7/dist-packages/PIL/ImageFont.py", line 194, in init font, size, index, encoding, layout_engine=layout_engine OSError: cannot open resource **'

And after this I changed in "main.py", in line 41, fa-brands.ttf to FreePixel.ttf (because under fonts-folder there is no font named fa-brands.ttf). After his display start to show some information... In first there is all the "fancy characters", in second there is clock (which is displayed fine) and after this some "bar" which show some info from Pi-Hole, I guess? And that's it, nothing more.

Listing in Terminal is as follows:

**' Version: luma.oled 3.5.0 (luma.core 1.14.1) Display: sh1106 Interface: i2c Dimensions: 128 x 64

Clock

[Weather - 29 Jul 20 13:32:36] cannot open resource Storm piHole Status Timetable PiStatus Clock

[Weather - 29 Jul 20 13:35:39] cannot open resource Storm piHole Status Timetable ... **'

Inside the file "crash.log" there is only:

**' [Weather - 29 Jul 20 13:32:36] cannot open resource [Weather - 29 Jul 20 13:35:39] cannot open resource [Weather - 29 Jul 20 13:39:02] cannot open resource **'

Any guesses what is wrong with my setup?

d-bieber commented 4 years ago

I just updated my README.md but I think there are still some bits missing. I'm using FontAwesome for a few icons: In start() I display the raspberry Pi Icon which is in FontAwesome Brands and for the weather I'm using the solid version. So if you download both and put fa-brands.ttf and fa-solid.ttf in your fonts folder it should work.

Timppa71 commented 4 years ago

I just found ttf-fonts named fa-brands-400.ttf, fa-solid-900.ttf and fa-regular-400.ttf, not just fa-brands.ttf and fa-solid.ttf..? Are those correct ones?

d-bieber commented 4 years ago

I think so. Either they changed the naming or I renamed them on my machine.