philipparndt/mqtt-analyzer

Connecting to AWS IoT / MQTT issue

Closed this issue · 14 comments

Hello,

I've tried, without success, to connect to AWS IoT.
I enter my endpoint "xxxxxxx-ats.iot.us-east-1.amazonaws.com"
then created a .p12 certificate by first combining the rootCA + certificate + private and then use the openssl command to convert the combined file into user.p12

Uploaded the file to the app via Finder

When I try to connect it timeout after 10 trials.

Hi there,

in my test setup I've created the .p12 file by using:
openssl pkcs12 -export -in user.crt -inkey user.key -out user.p12

The listener configuration is:

# Secured Listener
listener 8883
cafile /mosquitto/config/ca.crt
keyfile /mosquitto/config/server.key
certfile /mosquitto/config/server.crt
require_certificate true
use_identity_as_username true
allow_anonymous false

I've tried some different configuration mistakes but always get an error message so I guess I do not have found exactly your configuration. Can you give me some demo configuration I can start with docker?

@AndreCouture what port number are you trying to use?
I was now able to reproduce this but not with a different port number (tried 8882 an it still worked) but by switching to Moscapsule in More settings.

Do you still have your old setting, so that you can check whether CocoaMQTT or Moscapsule is selected?

Hi @AndreCouture thanks for letting me know.
I've expected Moscapsule not to work with this. This will get be deprecated soon CocoaMQTT supports better error handling and better SSL support.

I've created a AWS IoT instance today to test this and now I see why you struggled with the port setting. It is was pretty unclear to me on the AWS page what settings they expect.

I think a good solution for this would be to add some kind of preset template for AWS in order to assist during creation of this setting or maybe initialize the default values for AWS when entering/pasting the *.amazonaws.com url. What do you (and you @RoSchmi) think? Would this help?

Hi @philipparndt and thanks for the reply.

I think either way would work, maybe both.
In case the user already overwritten the port, maybe do not overwrite??

yes, that would be bad. I've now added a suggestion button which the user has to press in order to apply the preset.
aws-iot

Another enhancement would be to graph values……..
Do you mean something like this

https://apps.apple.com/de/app/charts4azure/id1442910354

Hi again The aws detection works great !

Thanks a lot for testing and helping with this feature!

Is there a way you could allow to browse the device for the certificate? Many apps allow this and it is very handy and easier compare to have to use iTunes or Finder to place the certificate in the app folder. Could also allow to copy/paste the content into variable...

I've opened a ticket for this #52

Another enhancement would be to graph values when drilling down the messages For example when I drop down to see temperatures..

This is a great idea, I already had this implemented in a first alpha version of the app but the canceled the development on this topic as I currently do not have a good idea on how to handle with app cancellation by the operating system. iOS cancels the app shortly after it is send to background and there seems to be no way around (for battery reasons). The only solution I currently see would be to introduce a server side component but with that the user could also just use grafana or something similar. I'm open to any suggestion how we could implement this :)

This is a great idea, I already had this implemented in a first alpha version of the app but the canceled the development on this topic as I currently do not have a good idea on how to handle with app cancellation by the operating system. iOS cancels the app shortly after it is send to background and there seems to be no way around (for battery reasons).

There are many aspects that have to be considered, so here are my two cents:
The most important aspect is what you want to achieve. As I don’t know what you want, I can first tell what I would like to have:
In the list of topics I would like to have the option to tap on this subscribed topic and have the option to get to a graphical view of the sampled values over a time interval.
The sensor values will have to be stored in some database and as there may be many data it seems not advisable to store those data on the mobile device but this should be done with a database in the cloud.
As you told, the App will stop action when it is sent to the background. So writing to the cloud database cannot be done by the App but has to be done either by the sensor-mcu itself (as I do it in my setup) or by e.g. a mqtt-broker (seems to be the better solution). When using the mqtt-broker the action to store incoming data in a database has to be configured on the Web-UI of the broker service (as I think on AWS and Azure this should be feasible, I don’t know enough about the features on other platforms). At the moment I don’t see a way how this configuration could be done by the MQTT-Analyzer App.
The MQTT-Analyzer App could have the table name (e.g. sensor-name) of the cloud-database and so could read the sensor-values from the cloud.
Unfortunately the steps of the configuration of the App and the mqtt-broker seem to be so complicated that a user with no IT-skills will hardly get it managed.
As for users with IT-skills there will be the following problems: Will they find the App and will they be convinced that the App is what they are searching for.