computenodes / dragino

LoRaWAN implementation in python
GNU Affero General Public License v3.0
27 stars 11 forks source link

OTTA implementation #4

Closed Technickfreak closed 3 years ago

Technickfreak commented 3 years ago

will the OTTA functions still be implemented?

pjb304 commented 3 years ago

Do you mean OTAA (over the air activation) which is already implemented in the code base? Or something else, in which case feel free to implement and submit a pull request.

ossonts commented 3 years ago

what are you needing? got an example

BNNorman commented 3 years ago

I find this conversation strange. As pjb304 said, OTAA is already supported and that is what I am using. You simply need to edit the lines at the end of the dragino.ini file:-

##Valid auth modes are ABP or OTAA
##All values are hex arrays eg devaddr = 0x01, 0x02, 0x03, 0x04
#auth_mode = "abp"
#devaddr = 
#nwskey = 
#appskey =

auth_mode = "otaa"

deveui =[insert your own]
appeui =[insert your own]
appkey =[insert your own]

This works for me.

Technickfreak commented 3 years ago

yes I mean OTAA, I copied it incorrectly from the script. https://github.com/computenodes/dragino/blob/55b56af5a6cbf227a0636cb5e9cdb5be927acbf3/dragino/dragino.py#L36-L37

Die send_bytes-Methode ist nur für ABP optimiert und ich habe keine andere für OTAA gefunden. https://github.com/computenodes/dragino/blob/55b56af5a6cbf227a0636cb5e9cdb5be927acbf3/dragino/dragino.py#L195-L201

Technickfreak commented 3 years ago

Valid auth modes are ABP or OTAA

All values are hex arrays eg devaddr = 0x01, 0x02, 0x03, 0x04

auth_mode = "abp"

devaddr =

nwskey =

appskey =

auth_mode = "otaa"

deveui =[insert your own] appeui =[insert your own] appkey =[insert your own]

I did that. https://github.com/computenodes/dragino/blob/55b56af5a6cbf227a0636cb5e9cdb5be927acbf3/dragino/dragino.py#L200-L201 only if appskey is empty then sending is aborted at the point. (the appskey from abp)

BNNorman commented 3 years ago

Looks like your JOIN_REQUEST may have failed. Any chance of us seeing your log file? Be aware though, in DEBUG mode the logfile will include your devui, appeui and appkey - so edit those lines before posting.

In my app I use a loop to wait for a join before trying to send anything.

DRAGINO = Dragino(DRAGINO_INI,logging_level=logging.DEBUG)
logger.info("Waiting for JOIN to TTN")
DRAGINO.join()
while not DRAGINO.registered():
    pass
logger.info("JOINED to TTN")

Have you made any changes to the dragino.py code? The standard code works fine if you don't need downlinks. (I modified rx_done() to pass those on to my code).

ossonts commented 3 years ago

@BNNorman yes same -- this is key

while not DRAGINO.registered():
    pass

Also: you may want to slow the loop down a bit :-)

Technickfreak commented 3 years ago

I've now tested it with the loop and now works.

my script was probably too impatient beforehand.

many thanks for your help.

RaghavRao commented 3 years ago

Hey, dumb question, but do I copy all the values as big-endian? I remember raspi-lmic needed some little-endian

BNNorman commented 3 years ago

Just copy paste from ttn is all i did.

pjb304 commented 3 years ago

I just copy and paste from ttn console well - having changed the mode to output the correct array format