Hi carlowan,
thank you for your reply. I have the following:
- Python 3.7.3
- pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
- RPi Zero W - Buster
I think one of the problems was coming from line 2 from rak811 import Mode, Rak811
. I have changed this line with from rak811.rak811 import Mode, Rak811
and added some debug function. Now, the python script looks like this:
#!/usr/bin/env python3
import logging
import sys
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)
from rak811.rak811 import Mode, Rak811
lora = Rak811()
lora.hard_reset()
lora.mode = Mode.LoRaWan
lora.band = 'EU868'
lora.set_config(app_eui='1234567890',
app_key='1234567890xxxxxxxxxxxxxxxxxxxxxx')
lora.join_otaa()
lora.dr = 5
lora.send('Hello world')
lora.close()
And this is the output:
2021-08-06 07:34:21,614 - rak811.serial - DEBUG - Serial initialized
2021-08-06 07:34:21,660 - rak811.serial - DEBUG - Ignoring untagged: >Welcome to RAK811<
2021-08-06 07:34:21,764 - rak811.serial - DEBUG - Ignoring untagged: ><
2021-08-06 07:34:21,880 - rak811.serial - DEBUG - Ignoring untagged: >Selected LoraWAN 1.0.2 Region: EU868 <
2021-08-06 07:34:21,984 - rak811.serial - DEBUG - Ignoring untagged: ><
2021-08-06 07:34:23,646 - rak811.serial - DEBUG - Sending: >at+mode=0\r\n<
2021-08-06 07:34:24,843 - rak811.serial - DEBUG - Ignoring untagged: ><
2021-08-06 07:34:24,963 - rak811.serial - DEBUG - Ignoring untagged: >Selected LoraWAN 1.0.2 Region: EU868 <
2021-08-06 07:34:25,068 - rak811.serial - DEBUG - Ignoring untagged: ><
2021-08-06 07:34:25,173 - rak811.serial - DEBUG - Received: >OK<
2021-08-06 07:34:25,277 - rak811.serial - DEBUG - Sending: >at+band=EU868\r\n<
2021-08-06 07:34:25,286 - rak811.serial - DEBUG - Received: >OK<
2021-08-06 07:34:25,391 - rak811.serial - DEBUG - Sending: >at+set_config=app_eui:1234567890&app_key:1234567890xxxxxxxxxxxxxxxxxxxxxx\r\n<
2021-08-06 07:34:26,594 - rak811.serial - DEBUG - Received: >OK<
2021-08-06 07:34:26,699 - rak811.serial - DEBUG - Sending: >at+join=otaa\r\n<
2021-08-06 07:34:26,747 - rak811.serial - DEBUG - Received: >OK<
Traceback (most recent call last):
File "lora_node-2.py", line 22, in <module>
lora.join_otaa()
File "/usr/local/lib/python3.7/dist-packages/rak811/rak811.py", line 413, in join_otaa
for event in self._get_events():
File "/usr/local/lib/python3.7/dist-packages/rak811/rak811.py", line 262, in _get_events
self._serial.receive(single=False, timeout=timeout)]
File "/usr/local/lib/python3.7/dist-packages/rak811/serial.py", line 156, in receive
raise Rak811TimeoutError('Timeout while waiting for data')
rak811.serial.Rak811TimeoutError: Timeout while waiting for data
That looks a bit better, but I still cannot send the message to the Gateway which is one meter next to the node.
Any idea how to make this right?