sunfounder / nas-kit

SunFounder NAS Kit for Raspberry Pi
15 stars 16 forks source link

Error with DietPi #4

Open ILPlais opened 4 years ago

ILPlais commented 4 years ago

Hello,

I tried to install the NAS Kit on a DietPi distribution on my SunFounder Kit. But I have this error:

root@DietPi:~/git/nas-kit/main# python3 raspi_omv_main.py &
[1] 933root@DietPi:~/git/nas-kit/main# python3 raspi_omv_main.py &
[1] 933
root@DietPi:~/git/nas-kit/main# Traceback (most recent call last):
  File "raspi_omv_main.py", line 11, in <module>
    from page import *
  File "/root/git/nas-kit/main/page.py", line 16, in <module>
    from epd_lib import epd2in13_V2 
  File "/root/git/nas-kit/lib/epd_lib/epd2in13_V2.py", line 2, in <module>
    from . import epdconfig
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 146, in <module>
    implementation = RaspberryPi()
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 50, in __init__
    self.SPI = spidev.SpiDev(0, 0)
FileNotFoundError: [Errno 2] No such file or directory

[1]+  Exit 1                  python3 raspi_omv_main.py
root@DietPi:~/git/nas-kit/main# Traceback (most recent call last):
  File "raspi_omv_main.py", line 11, in <module>
    from page import *
  File "/root/git/nas-kit/main/page.py", line 16, in <module>
    from epd_lib import epd2in13_V2 
  File "/root/git/nas-kit/lib/epd_lib/epd2in13_V2.py", line 2, in <module>
    from . import epdconfig
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 146, in <module>
    implementation = RaspberryPi()
  File "/root/git/nas-kit/lib/epd_lib/epdconfig.py", line 50, in __init__
    self.SPI = spidev.SpiDev(0, 0)
FileNotFoundError: [Errno 2] No such file or directory

[1]+  Exit 1                  python3 raspi_omv_main.py

Here the line on bug: https://github.com/sunfounder/nas-kit/blob/bc9bebcdc0120914d5c7409b1a9121d8f11fc235/lib/epd_lib/epdconfig.py#L50

Good luck!

ILPlais commented 4 years ago

With the help of @sunfounder I installed the dependencies: apt install python3-rpi.gpio python3-spidev And after via pip3:

pip3 install spidev
pip3 install rpi.gpio
pip3 install RPi.GPIO2

But now I have the error:

root@DietPi:/opt/vc/bin/nas-kit# python3 /opt/vc/bin/nas-kit/main/raspi_omv_main.py &
[1] 4557
root@DietPi:/opt/vc/bin/nas-kit# Traceback (most recent call last):
  File "/opt/vc/bin/nas-kit/main/raspi_omv_main.py", line 3, in <module>
    import RPi.GPIO as GPIO
  File "/usr/local/lib/python3.7/dist-packages/RPi/GPIO/__init__.py", line 8, in <module>
    from RPi.core import\
  File "/usr/local/lib/python3.7/dist-packages/RPi/core.py", line 59, in <module>
    LOW  = gpiod.Line.ACTIVE_LOW
AttributeError: module 'gpiod' has no attribute 'Line'
^C
[1]+  Exit 1                  python3 /opt/vc/bin/nas-kit/main/raspi_omv_main.py
root@DietPi:/opt/vc/bin/nas-kit#

Someone help?

ghost commented 3 years ago

I'm currently stuck at the same point while trying to install on Debian.

I also had to install the following :

pip3 install gpiod

thomasdom commented 3 years ago

I managed to make it work today on my NAS Kit.

Dependencies

The only required Python dependencies are the following:

:warning: You must NOT use Rpi.GPIO2 nor gpiod. The script provided by SunFounder does not use these dependencies at all, only the ones listed above. If they are installed on your system, remove them:

Prerequisites

Make sure SPI is enabled on your Raspberry Pi:

  1. ssh pi@your-ip-address
  2. sudo raspi-config
  3. Navigate to 5 Interfacing Options and press Enter
  4. Navigate to P4 SPI and Press Enter
  5. Answer Yes to the question
  6. Quit raspi-config (Ctrl-C or navigate to exit menu)
  7. Reboot your Raspberry Pi: sudo reboot now

Setup

Clone this repo:

Go to nas-kit root folder and execute setup:

  1. cd ~/nas-kit
  2. sudo python3 setup.py (sudo is important, since this script is meant to run at startup later)

That's all! You can now run the script.

Run

Launch at startup

Note: To start omv-epd at NAS startup:

  1. ln -s /home/pi/nas-kit/bin/omv-epd /etc/init.d/omv-epd
  2. sudo systemctl daemon-reload
  3. sudo systemctl enable omv-epd
  4. sudo systemctl start omv-epd

It should now start the NAS Kit EPD screen display at startup! :tada:


PS: This should be in a README in this repo, so it could help people.

PPS: I have opened #5, do not hesitate to comment/improve the documentation! :+1:

ghost commented 3 years ago

@thomasdom This is clearly an improvement on the problem, as I get the fans to work this way.

I'm still having an issue with the screen that is briefly blinking, then stays white. I get an error from the command python3 main.raspi_omv_main.py

pi@raspberrypi:~nas-kit $ python3 main/raspi_omv_main.py
Exception in thread Thread-1
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _boostrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "main/raspi_omv_main.py", line 312, in main
    page(current_page)
  File "/home/pi/nas-kit/main/page.py", line 76, in __call__
    eval(cmd)
  File "<string>", line 1, in <module>
  File "/home/pi/nas-kit/main/page.py", line 99, in page_1_update
    pi_msg = pi_read()
  File "/home/pi/nas-kit/main/page.py", line 150, in pi_read
    "cpu_usage": cpu_usage(),
  File "/home/pi/nas-kit/main/page.py", line 106, in cpu_usage
    result = round(100 - float(result), 2)
ValueError: could not convert string to float: '80,35'

This seems to be an error with the locale number format, as the number use a , as a decimal and not a ..

ghost commented 3 years ago

Using raspi-config to revert back to en_US locale is a workaround. The screen now works.

Still, there is room for improvement here.

thomasdom commented 3 years ago

Using raspi-config to revert back to en_US locale is a workaround. The screen now works. Still, there is room for improvement here.

Agree! This should be addressed in a separate issue to facilitate tracking of bugs/improvements :+1:

ghost commented 3 years ago

I created a new issue for that locale problem.

I'm still having an issue with the launch at startup (on a fresh install of raspbian). If I follow your guide:

  1. ln -s /home/pi/nas-kit/bin/omv-epd /etc/init.d/omv-epd
  2. sudo systemctl daemon-reload
  3. sudo systemctl enable omv-epd
  4. sudo systemctl start omv-epd

I cannot make the link (1.) without sudo (but it works with sudo). The second command works fine (without any message). The third command is giving me a message:

bleu@raspberrypi:~/nas-kit $ sudo systemctl enable omv-epd
omv-epd.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable omv-epd

The fourth command gives me an error:

bleu@raspberrypi:~/nas-kit $ sudo systemctl start omv-epd
Failed to start omv-epd.service: Unit omv-epd.service not found.

Any idea about this one ?

nostromo1st commented 3 years ago

Hi, for this:

bleu@raspberrypi:~/nas-kit $ sudo systemctl start omv-epd Failed to start omv-epd.service: Unit omv-epd.service not found.

I do this: Chmod u+x /to_the_path/omv-epd

Now start service by:

sudo /to_the_path/omv-epd start

And reboot your raspberry and it's working.

ghost commented 3 years ago

@nostromo1st you are right, I forgot to make the file executable, which was the cause of my problem.