ronoth / LoStik

LoRaWAN compatible USB test device
MIT License
133 stars 39 forks source link

Appkey invalid in lorawan_sender.py #24

Closed gudsi closed 4 years ago

gudsi commented 4 years ago

Hi!

I am trying to connect my LoStik to The Things network. I tried to run lorawa_sender.py (https://github.com/ronoth/LoStik/blob/4b109759486caca33381d06ae525d0ba2a6854f1/examples/lorawan_sender.py)

I always get the error message error: argument --appkey/-a: invalid value

Can someone help me to solve that?

Thanks a lot

lolsborn commented 4 years ago

Can you share what you are running via the command line?

There is also a script called configure.py which will read the settings in ttn-us.conf or ttn-eu.conf and configure the channels/credentials on your device for The Things Network. All you have to do is edit the conf file to suit your needs and run the configure.py script.

On Tue, Dec 31, 2019, at 1:03 AM, gudsi wrote:

Hi!

I am trying to connect my LoStik to The Things network. I tried to run lorawa_sender.py (https://github.com/ronoth/LoStik/blob/4b109759486caca33381d06ae525d0ba2a6854f1/examples/lorawan_sender.py)

I always get the error message error: argument --appkey/-a: invalid value

Can someone help me to solve that?

Thanks a lot

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ronoth/LoStik/issues/24?email_source=notifications&email_token=AAAOZBBAZDLYRJQCHGKGHA3Q3MDGDA5CNFSM4KBT3W32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IDOZ5SQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOZBHAHHGVKCQ4XW4P6FTQ3MDGDANCNFSM4KBT3W3Q.

gudsi commented 4 years ago

Thanks a lot for your quick answer!

I am trying to run it via Pycharm with this Run Parameters: --payload 1234 --appkey XXXXXXXX --deveui XXXXXX --appeui XXXXX COM3

I also tried to run the configuration first. After adapting the appkey, deveui and appeui in ttn-eu.conf, running configure.py raises an exception configparser.NoOptionError: No option 'appeui' in section: 'otaa'

lolsborn commented 4 years ago

The ttn-eu.conf looks like it's not as complete as the US version. If you look at the US conf you can copy and paste the bits you need for OTAA into the eu config and update them with your credentials.

On Wed, Jan 1, 2020, at 1:54 AM, gudsi wrote:

Thanks a lot for your quick answer!

I am trying to run it via Pycharm with this Run Parameters: --payload 1234 --appkey 10DE087B0D8E71B28CD7409B372A2606 --deveui 0004A30B002374AB --appeui 70B3D57ED0027B03 COM3

I also tried to run the configuration first. After adapting the appkey, deveui and appeui in ttn-eu.conf, running configure.py raises an exception configparser.NoOptionError: No option 'appeui' in section: 'otaa'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ronoth/LoStik/issues/24?email_source=notifications&email_token=AAAOZBF6TOENR3TZXCB3IELQ3RR5JA5CNFSM4KBT3W32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH5BUEA#issuecomment-570038800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOZBAVDKYILIBP7GHRVITQ3RR5JANCNFSM4KBT3W3Q.

lolsborn commented 4 years ago

I'm not sure why running the lorawan_sender script you linked would return invalid appkey unless you had the wrong credential. Is there any reason you are using that script instead of the one in master https://github.com/ronoth/LoStik/blob/master/examples/lorawan.py ? I know that script worked in the past, but the one in master has been tested far more.

gudsi commented 4 years ago

I added the other channels to my .conf like that ch16 = , off ch17 = , off ch18 = , off .... ch71 = , off

But still there is the error configparser.NoOptionError: No option 'appeui' in section: 'otaa'

I also tried to run the lorawan.py which gives following output Connection to LoStik established mac set appeui XXX mac set appkey XXX mac set deveui XXX mac join otaa STATUS: ok STATUS: ok STATUS: ok STATUS: ok STATUS: denied

I am sorry, but I really do not know, what is going wrong here.

The ttn-eu.conf looks like it's not as complete as the US version. If you look at the US conf you can copy and paste the bits you need for OTAA into the eu config and update them with your credentials.

lolsborn commented 4 years ago

What gateway are you using?

On Thu, Jan 2, 2020, at 10:27 PM, gudsi wrote:

I added the other channels to my .conf like that ch16 = , off ch17 = , off ch18 = , off .... ch71 = , off

But still there is the error configparser.NoOptionError: No option 'appeui' in section: 'otaa'

I also tried to run the lorawan.py which gives following output Connection to LoStik established mac set appeui XXX mac set appkey XXX mac set deveui XXX mac join otaa STATUS: ok STATUS: ok STATUS: ok STATUS: ok STATUS: denied

I am sorry, but I really do not know, what is going wrong here.

The ttn-eu.conf looks like it's not as complete as the US version. If you look at the US conf you can copy and paste the bits you need for OTAA into the eu config and update them with your credentials. … https://www.fastmail.com/mail/compose?u=3f61409c#

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ronoth/LoStik/issues/24?email_source=notifications&email_token=AAAOZBF2DSOUVLFWFDJ7KYTQ33LFZA5CNFSM4KBT3W32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIAMXUY#issuecomment-570477523, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOZBFMPY5SBQGM6H5IYTDQ33LFZANCNFSM4KBT3W3Q.

gudsi commented 4 years ago

Sorry for the stupid answer, but I don´t know. How can I configure that?

lolsborn commented 4 years ago

LoRaWAN is an authentication, addressing, and management layer on top of LoRa radio that requires a gateway to manage. If you don't have something that resembles a router to receive your LoRa messages you probably don't need LoRaWAN.

You can still use LoRa radios to form simple single channel, point-to-point networks. The other send and receive examples included do that.

On Thu, Jan 2, 2020, at 11:30 PM, gudsi wrote:

Sorry for the stupid answer, but I don´t know. How can I configure that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ronoth/LoStik/issues/24?email_source=notifications&email_token=AAAOZBHNZHL7UKTLINLPAB3Q33SQFA5CNFSM4KBT3W32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIAPVRA#issuecomment-570489540, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOZBBGFLUQCBYB23QSP2TQ33SQFANCNFSM4KBT3W3Q.

gudsi commented 4 years ago

Thanks for your help! I think, I am a bit confused. I want to build a moisture sensor application with RaspberryPi and using the LoStik to send the data. I thought I can use TTN to send data there. Did I get it wrong?

lolsborn commented 4 years ago

So you are connecting LoStik to RPI and the moisture sensor speaks LoRa and relays it back?

On Fri, Jan 3, 2020, at 9:18 AM, gudsi wrote:

Thanks for your answer. I think, I am a bit confused. I want to build a moisture sensor application with RaspberryPi and using the LoStik to send the data. I thought I can use TTN to send data there. Did I get it wrong?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ronoth/LoStik/issues/24?email_source=notifications&email_token=AAAOZBE57XEBPZM6PGQGESLQ35XO7A5CNFSM4KBT3W32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIBTZBY#issuecomment-570637447, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOZBEOJ53AURD2YMTBX5LQ35XO7ANCNFSM4KBT3W3Q.

gudsi commented 4 years ago

Yes. The sensor collects data and sends it via LoRa payload to TTN.

lolsborn commented 4 years ago

could you share what sensor you are using?

On Fri, Jan 3, 2020, at 9:29 AM, gudsi wrote:

Yes. The sensor collects data and sends it via LoRa payload to TTN.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ronoth/LoStik/issues/24?email_source=notifications&email_token=AAAOZBGYROYG3JN56UB3JBDQ35YWHA5CNFSM4KBT3W32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIBUPXA#issuecomment-570640348, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOZBBOAAMMP7UYS5IX4A3Q35YWHANCNFSM4KBT3W3Q.

gudsi commented 4 years ago

I will use this one https://www.tindie.com/products/miceuz/modbus-rs485-soil-moisture-sensor-2/

But it is not delivered yet. That is why I wanted to start with configuring and testing Lostik

gudsi commented 4 years ago

An update from my side I finally was able to connect with gateway via Termite and lorawan.py via my pc. But I use LoStik on Raspberry, I get denied or no_channel_free. Any ideas what I am doing wrong?

lolsborn commented 4 years ago

This is usually a channel configuration issue. You have to configure the channel list on your LoStik to match your gateways frequency plan. There is a configure.py script I created to make this easier. You pass it one of the .conf files (after editing it to match your needs). The example ttn.conf files should configure your channels to the ttn frequency plans.

On Mon, Mar 30, 2020, at 4:17 AM, gudsi wrote:

An update from my side I finally was able to connect with gateway via Termite and lorawan.py via my pc. But I use LoStik on Raspberry, I get denied or no_channel_free. Any ideas what I am doing wrong?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ronoth/LoStik/issues/24#issuecomment-605939502, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOZBHNYDDSLVUQFLHOZ23RKB5TZANCNFSM4KBT3W3Q.

gudsi commented 4 years ago

Thanks a lot for your help, lolsborn! I did a big mistake. I did not send a new join after powering the stick again. Now everything is working fine. Thanks!