mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-29 02:06:21 +02:00
RPi:specify README.md and collect data from EventsResponse
This commit is contained in:
parent
892f554ff5
commit
9a0bee831d
2 changed files with 30 additions and 11 deletions
|
@ -84,9 +84,14 @@ If there are no error messages on the last step, then the NRF24 Wrapper has been
|
||||||
Building RF24 Wrapper for Debian 11 (bullseye) 64 bit operating system
|
Building RF24 Wrapper for 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) 64 bit operating system.
|
||||||
There are 2 possible sollutions to install the RF24 Wrapper.
|
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`
|
||||||
|
|
||||||
* `1. solution:`
|
There are 2 possible solutions to install the RF24 wrapper:
|
||||||
|
|
||||||
|
* `1. Solution:`
|
||||||
```code
|
```code
|
||||||
sudo apt install cmake 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
|
||||||
|
|
||||||
|
@ -101,13 +106,13 @@ cd RF24
|
||||||
rm -rf build Makefile.inc
|
rm -rf build Makefile.inc
|
||||||
./configure --driver=SPIDEV
|
./configure --driver=SPIDEV
|
||||||
```
|
```
|
||||||
* edit `Makefile.inc` with your prefered editor e.g. nano or vi
|
# edit `Makefile.inc` with your prefered editor e.g. nano or vi
|
||||||
old:
|
- old:
|
||||||
```code
|
```code
|
||||||
CPUFLAGS=-marm -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
|
CPUFLAGS=-marm -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
|
||||||
CFLAGS=-marm -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -Ofast -Wall -pthread
|
CFLAGS=-marm -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -Ofast -Wall -pthread
|
||||||
```
|
```
|
||||||
new:
|
- new:
|
||||||
```code
|
```code
|
||||||
CPUFLAGS=
|
CPUFLAGS=
|
||||||
CFLAGS=-Ofast -Wall -pthread
|
CFLAGS=-Ofast -Wall -pthread
|
||||||
|
@ -125,8 +130,7 @@ python3 -m pip list #watch for RF24 module - if its there its installed
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
* `2. Solution:`
|
||||||
* `2. solution:`
|
|
||||||
```code
|
```code
|
||||||
sudo apt install git python3-dev libboost-python-dev python3-pip python3-rpi.gpio
|
sudo apt install git python3-dev libboost-python-dev python3-pip python3-rpi.gpio
|
||||||
|
|
||||||
|
@ -135,6 +139,14 @@ cd pyRF24
|
||||||
python3 -m pip install . -v # this step takes about 5 minutes on my RPI-4 !
|
python3 -m pip install . -v # this step takes about 5 minutes on my RPI-4 !
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you have problems with your radio module from ahoi,
|
||||||
|
e.g.: cannot interpret received data,
|
||||||
|
please try to reduce the speed of the radio module!
|
||||||
|
Add the following line to your ahoy.yml configuration file in "nrf" section:
|
||||||
|
* `spispeed: 600000`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Required python modules
|
Required python modules
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
|
@ -327,9 +327,9 @@ class EventsResponse(UnknownResponse):
|
||||||
#logging.debug(' payload has valid modbus crc')
|
#logging.debug(' payload has valid modbus crc')
|
||||||
self.response = self.response[:-2]
|
self.response = self.response[:-2]
|
||||||
|
|
||||||
status = struct.unpack('>H', self.response[:2])[0]
|
self.status = struct.unpack('>H', self.response[:2])[0]
|
||||||
a_text = self.alarm_codes.get(status, 'N/A')
|
self.a_text = self.alarm_codes.get(self.status, 'N/A')
|
||||||
logging.info (f' Inverter status: {a_text} ({status})')
|
logging.info (f' Inverter status: {self.a_text} ({self.status})')
|
||||||
|
|
||||||
chunk_size = 12
|
chunk_size = 12
|
||||||
for i_chunk in range(2, len(self.response), chunk_size):
|
for i_chunk in range(2, len(self.response), chunk_size):
|
||||||
|
@ -350,6 +350,14 @@ class EventsResponse(UnknownResponse):
|
||||||
dbg += f' {fmt:7}: ' + str(struct.unpack('>' + fmt, chunk))
|
dbg += f' {fmt:7}: ' + str(struct.unpack('>' + fmt, chunk))
|
||||||
logging.debug(dbg)
|
logging.debug(dbg)
|
||||||
|
|
||||||
|
def __dict__(self):
|
||||||
|
""" Base values, availabe in each __dict__ call """
|
||||||
|
|
||||||
|
data = super().__dict__()
|
||||||
|
data['inv_stat_num'] = self.status
|
||||||
|
data['inv_stat_txt'] = self.a_text
|
||||||
|
return data
|
||||||
|
|
||||||
class HardwareInfoResponse(UnknownResponse):
|
class HardwareInfoResponse(UnknownResponse):
|
||||||
def __init__(self, *args, **params):
|
def __init__(self, *args, **params):
|
||||||
super().__init__(*args, **params)
|
super().__init__(*args, **params)
|
||||||
|
@ -371,7 +379,6 @@ class HardwareInfoResponse(UnknownResponse):
|
||||||
""" Base values, availabe in each __dict__ call """
|
""" Base values, availabe in each __dict__ call """
|
||||||
|
|
||||||
data = super().__dict__()
|
data = super().__dict__()
|
||||||
responce_info = self.response
|
|
||||||
|
|
||||||
if (len(self.response) != 16):
|
if (len(self.response) != 16):
|
||||||
logging.error(f'HardwareInfoResponse: data length should be 16 bytes - measured {len(self.response)} bytes')
|
logging.error(f'HardwareInfoResponse: data length should be 16 bytes - measured {len(self.response)} bytes')
|
||||||
|
|
Loading…
Add table
Reference in a new issue