computenodes / dragino

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

Downlink Messages #3

Closed BNNorman closed 3 years ago

BNNorman commented 3 years ago

I am using your code (with minor modifications) to trigger a callback to my own code when a downlink message is received. Your code just accepts a JOIN_ACCEPT - which is fine if all it does it transmit GPS or other stuff but I need to send downlink commands to request data to be transmitted and I'm having trouble finding anyone who has done this. (maybe no looking in the correct places)

I am successfully receiving the payloads as MDHR.UNCONF_DATA_DOWN. I can pass the payloads to my routines but I'm uncertain what methods to call to decode the payload and recover my downlink message (normally only 1 to 5 bytes long) before it is sent to my code.

I have trawled through your code and can see decrypt exists in one of the modules but I'm unsure how to use it.

Could you point me in the right direction please?

Many thanks

pjb304 commented 3 years ago

I'm afraid that's not something I've had to look at. The encryption and decryption bit is forked from https://github.com/jeroennijhof/LoRaWAN so someone there might have more information about how to use it.

BNNorman commented 3 years ago

Thanks. I tried lorawan.decrypt(self.apps_key,self.device_addr) but I got

'PhyPayload' object has no attribute 'decrypt'

Thank you for the link. I'll take a look.