From 296a7a41c4af9c983d96c78d7d1a48df286d3849 Mon Sep 17 00:00:00 2001 From: Knuti_in_Paese Date: Fri, 26 Jan 2024 21:23:25 +0100 Subject: [PATCH] RPI:Migrate to Debian-Bookworm - Update README.md Update README.md delete dupplicate file ahoy.service update python info, when using pyRF24 --- tools/rpi/README.md | 53 +++++++++++++++++++++++++++------- tools/rpi/ahoy.service | 35 ---------------------- tools/rpi/hoymiles/__init__.py | 6 ++-- 3 files changed, 45 insertions(+), 49 deletions(-) delete mode 100644 tools/rpi/ahoy.service diff --git a/tools/rpi/README.md b/tools/rpi/README.md index 79bc5cbb..c5818a3a 100644 --- a/tools/rpi/README.md +++ b/tools/rpi/README.md @@ -89,17 +89,16 @@ python3 getting_started.py # to test and see whether RF24 class can be loaded as If there are no error messages on the last step, then the NRF24 Wrapper has been installed successfully. -Building RF24 Wrapper for Debian 11 (bullseye) 64 bit operating system +Building RF24 Wrapper on Debian 11 (bullseye) 64 bit operating system ---------------------------------------------------------------------- -The description above does not work on Debian 11 (bullseye) 64 bit operating system. +The description above does not work on Debian 11 (bullseye) 32 bit operating system. Please check first, if you have Debian 11 (bullseye) 64 bit operating system installed: - `uname -a` search for aarch64 - `lsb_release -d` - `cat /etc/debian_version` -There are 2 possible solutions to install the RF24 wrapper: +To install RF24 wrapper follow the instrauction: -**__1. Solution:__** ```code sudo apt install cmake git python3-dev libboost-python-dev python3-pip python3-rpi.gpio @@ -139,29 +138,55 @@ python3 -m pip list #watch for RF24 module - if its there its installed ``` -**__2. Solution:__** +Alternative install pyRF24 library on Debian 11 (bullseye) 64 bit operating system +----------------------------------------------------------------------------------- +The description above does not work on Debian 11 (bullseye) 32 bit operating system. +Please check first, if you have Debian 11 (bullseye) 64 bit operating system installed: + - `uname -a` search for aarch64 + - `lsb_release -d` + - `cat /etc/debian_version` + ```code -sudo apt install git python3-dev libboost-python-dev python3-pip python3-rpi.gpio +sudo apt install cmake git python3-dev libboost-python-dev python3-pip python3-rpi.gpio git clone --recurse-submodules https://github.com/nRF24/pyRF24.git cd pyRF24 python3 -m pip install . -v # this step takes about 5 minutes on my RPI-4 ! +cd ``` -If you have problems with your radio module from ahoi, e.g.: cannot interpret received data, -please try to reduce the speed of your radio module! -Add the following parameter to your ahoy.yml configuration file in "nrf" section: -`spispeed: 600000` (0.6 MHz) +Install pyRF24 library on Debian 12 (bookworm) 64 bit operating system +----------------------------------------------------------------------------------- +The description above does not work on Debian 11 (bullseye) 32 bit operating system. +Please check first, if you have Debian 11 (bullseye) 64 bit operating system installed: + - `uname -a` search for aarch64 + - `lsb_release -d` + - `cat /etc/debian_version` +Attension (PYTHON error ?): Debian 12 follows the recommendation of `PEP 668` +see: `https://peps.python.org/pep-0668/` - now PYTHON is configured as +"externally-managed-environment" ! + +```code +sudo apt install cmake git python3-dev libboost-python-dev python3-pip python3-rpi.gpio + +git clone --recurse-submodules https://github.com/nRF24/pyRF24.git +cd pyRF24 + python3 -m venv ahoyenv + source ahoyenv/bin/activate + python3 -m pip install . -v +cd +``` + Required python modules ----------------------- Some modules are not installed by default on a RaspberryPi, therefore add them manually: ```code -pip install crcmod pyyaml paho-mqtt SunTimes +python3 -m pip install crcmod pyyaml paho-mqtt SunTimes ``` Configuration @@ -170,6 +195,12 @@ Configuration Local settings are read from ahoy.yml An example is provided as ahoy.yml.example +If you have problems with your radio module from ahoi, +e.g.: cannot interpret received data, +please try to reduce the speed of your radio module! +Add the following parameter to your ahoy.yml configuration file in "nrf" section: +`spispeed: 600000` (0.6 MHz) + Example Run ----------- diff --git a/tools/rpi/ahoy.service b/tools/rpi/ahoy.service deleted file mode 100644 index c7be5bb2..00000000 --- a/tools/rpi/ahoy.service +++ /dev/null @@ -1,35 +0,0 @@ -###################################################################### -# systemd.service configuration for ahoy (lumapu) -# users can modify the lines: -# Description -# ExecStart (example: name of config file) -# WorkingDirectory (absolute path to your private ahoy dir) -# To change other config parameter, please consult systemd documentation -# -# To activate this service, enable and start ahoy.service -# $ systemctl --user enable $(pwd)/ahoy/tools/rpi/ahoy.service -# $ systemctl --user status ahoy -# $ systemctl --user start ahoy -# $ systemctl --user status ahoy -# -# 2023.01 -###################################################################### - -[Unit] - -Description=ahoy (lumapu) as Service -After=network.target local-fs.target time-sync.target - -[Service] -ExecStart=/usr/bin/env python3 -um hoymiles --log-transactions --verbose --config ahoy.yml -RestartSec=10 -Restart=on-failure -Type=simple - -# WorkingDirectory must be an absolute path - not relative path -WorkingDirectory=/home/pi/ahoy/tools/rpi -EnvironmentFile=/etc/environment - -[Install] -WantedBy=default.target - diff --git a/tools/rpi/hoymiles/__init__.py b/tools/rpi/hoymiles/__init__.py index 46a9275c..74a959eb 100644 --- a/tools/rpi/hoymiles/__init__.py +++ b/tools/rpi/hoymiles/__init__.py @@ -19,16 +19,16 @@ try: # https://github.com/nRF24/RF24.git from RF24 import RF24, RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_250KBPS, RF24_CRC_DISABLED, RF24_CRC_8, RF24_CRC_16 if environ.get('TERM') is not None: - print('Using python Module: RF24') + print('Using python Module: "RF24"') except ModuleNotFoundError as e: if environ.get('TERM') is not None: - print(f'{e} - try to use module: RF24') + print(f'{e} - module not found, try to use "pyRF24"') try: # Repo for pyRF24 package # https://github.com/nRF24/pyRF24.git from pyrf24 import RF24, RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_250KBPS, RF24_CRC_DISABLED, RF24_CRC_8, RF24_CRC_16 if environ.get('TERM') is not None: - print(f'{e} - Using python Module: pyrf24') + print(f'"pyrf24" found and used') except ModuleNotFoundError as e: if environ.get('TERM') is not None: print(f'{e} - exit')