Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTTs to AWS IoT / Use MTCAP with AWS IoT #4

Open
masbaehr opened this issue Sep 22, 2022 · 9 comments
Open

MQTTs to AWS IoT / Use MTCAP with AWS IoT #4

masbaehr opened this issue Sep 22, 2022 · 9 comments

Comments

@masbaehr
Copy link

Hi, i'm trying to figure out how to get the MTCAP-868-001A to send messages to AWS IoT.
I have configured the "Default App" with the certificates and Hostname in the format:
mqtts://xxxxxxxxxxx-ats.iot.eu-central-1.amazonaws.com:8883
It does actually work as i can see the following message appearing on the topic. I have truncated some values just for privacy.

Topic: lorawan/00-************-32/8BA1########################2179/init
{"gateways_euis": ["00-00-00-00-00-0?-??-??"], "time": "2022-09-22T18:52:14.892532Z"}

After this however nothing happens anymore. Am i using it wrong or what else do i need to do to get some sensor data appear on the mqtt server?

Log

2022-09-22T16:08:47.110315+02:00 mtcap lora-app-connect: Set log level 20
2022-09-22T16:08:47.518113+02:00 mtcap lora-app-connect: Call setup MQTT App
2022-09-22T16:08:47.526137+02:00 mtcap lora-app-connect: Setup MQTT App
2022-09-22T16:08:47.628371+02:00 mtcap lora-app-connect: MQTT connect mqtts://xxxxxxxxxxx-ats.iot.eu-central-1.amazonaws.com:8883
2022-09-22T16:08:48.131284+02:00 mtcap lora-app-connect: MQTT Disconnect reason  1
2022-09-22T16:08:48.949236+02:00 mtcap lora-app-connect: Start client
2022-09-22T16:08:48.971148+02:00 mtcap lora-app-connect: Connected with result code 0

After this its only message is a repeated:

     mtcap lora-app-connect: Check for app updates

Thanks for any help / hints!

Note that it would be also very helpful if the default MQTT settings would allow TLS / Certification authentication and not just username/password.

@reissjason
Copy link
Contributor

The connection to the server looks good since you see the init topic.

Do you have devices configured with the same AppEUI used in the Default App config?

@masbaehr
Copy link
Author

Thanks - Ah this is something i did not entirely understand. So i should set the "App EUI" of each device to the same used in the Default App config ?

@reissjason
Copy link
Contributor

Are you using the Local End-Device Credentials under Key Management?
Then set the App EUI to a value that matches the Default App for the end-devices you want to connect to your back-end.

If you are using Local Network Settings then the Network ID will be used in the Default App AppEUI.

@masbaehr
Copy link
Author

masbaehr commented Sep 23, 2022

Good (probably early for you :D) morning, i've tried to set the Same "Local Network Settings" EUI, which in my case is "A000000000000102" to the "Default App" EUI. However not much changed, just getting the "init" message.

Those are the other settings:

Local Network Settings "Enabled"
Default Device Profile: empty
Network ID (AppEUI): EUI
EUI: A000000000000102
Default Network Profile: DEFAULT-CLASS-A
Network Key (AppKey): "Key"
Key: The Key

@reissjason
Copy link
Contributor

Did you perform a new join with your device?
Maybe have a look at the settings in the device session page?
What is the Join EUI and App EUI of the session?

@masbaehr
Copy link
Author

Hm. The join EUI and App EUI is the same for each device, however each device has a different one.
Is something published only when "last seen" is triggered?

JoinEUI
00-18-xxxxxx-53-32
AppEUI
00-18-xxxxxx-53-32

@reissjason
Copy link
Contributor

Are all end-devices using the same key that is configured as Network Key?
I would expect the Session AppEUI to match the NetworkID (A000000000000102)

Do you have Keys configured for both Local Network Settings and Local End-Device Credentials?

If you are using End-Device Credentials the AppEUI for each device should be set to the Default App : AppEUI, this setting does not need to match what the end-device has configured as Join EUI. Only the DevEUI is used to lookup the AppKey used to join the network.

There are two paths the Join Request can follow but only one can be successful. First the network looks up the DevEUI in the end-device credentials to find an AppKey and check the Join Request. If the device was not found it will check the Join EUI against the NetworkID and use the NetworkKey to check the Join Request.

It looks to me that you have both setup but the Local End-Device Credentials are being used. I this case since the Join EUI is different from each device you must use the Local End-Device credentials to Join but should change the AppEUI to assign the device to the correct application that will then forward messages through the Default App.

I will be adding additional details to the documentation based on this discussion, thanks so much for your questions and feedback.

@masbaehr
Copy link
Author

masbaehr commented Sep 26, 2022

Should i see a join request here ?

image

Still trying to figure out whats wrong, i set the App EUI for all devices to the same as the Default App EUI, but that didnt change.

Also i noticed that data is coming in very slowly (2 hour rate), so maybe its a bad device configuration after all
image

Im still trying to understand your last post and im looking forward to the details you will add to the documentation :) Thanks again for the speedy responses!

Another strange one:

image

@masbaehr
Copy link
Author

Hi again, to exclude a device misconfiguration i tried out the default mqtt broker which uses username-password authentication and here i can see much more data, which in my understanding shows that in theory it should work. Now the question is: Does the "Default App" actually send data like this, which i received via the regular MQTT ?

lora/70-b3-d5-8f-f1-02-6c-f9/mac_recv

lora/70-b3-d5-8f-f1-02-6c-f9/up

lora/00-80-00-00-00-01-d6-32/70-b3-d5-8f-f1-02-6c-f9/packet_recv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants