universam1 / iSpindel

electronic Hydrometer
http://www.ispindel.de
Other
827 stars 322 forks source link

Commit to provide secureMQTT with X.509 certs as an option in sender class #451

Closed camsaway closed 3 years ago

camsaway commented 3 years ago

This is pre-cursor work to AWS IoT Core integration option that requires secure connection.

The main features here are: 1) Creation of a method, SenderClass::SendSecureMQTT which is a copy of SendMQTT class with parameters for secure connections 2) Modification of SenderClass::MQTTConnect to select WifiClient or WifiClientSecure object based on input parameters 3) Due to memory constraint I had to reduce JSON buffer to 256 from 1024 in sender.h. This seems to be sufficient from checks I did on ArduinoJSON test site for the standard messages we send.

I chose this approach to avoid changes to other areas of the code.

I will submit a seperate pull request with changes to Globals, iSpindel.cpp and WifiManager to enable AWS as a connection option

NB: This is my first github contribution and I'm not a developer so please excuse (and explain) any process mistakes I've made.

camsaway commented 3 years ago

Hi @universam1 - I have resolved the UI issue as requested. Can you please review again

gdolling commented 3 years ago

I was initially confused by the box with "<<<< >>>>" in it and thought the thingname was to go in there. I would recommend changing the text to "name above must be thingname". It's only a minor point though.

After that I got it to work with no problems.

I like this code and this solution. AWS IOT is not for the inexperienced though and considering the level of competency required with policies, certificates, etc to get data to appear in AWS at all. Then consider even at that point you won't get any graphs or even have the data stored until you configure a whole host of other AWS services. I think this code should be in master, but as it is such that your average user is pushed towards ubidots or blynk solutions. Given the competence required to use AWS I don't think having to compile the source is any real barrier, but does help steer the unwary away from it.

camsaway commented 3 years ago

Hi @universam1 are you happy with the changes or are there more needed?

universam1 commented 3 years ago

Hi @universam1 are you happy with the changes or are there more needed?

Thank you @camsaway for applying the suggestions - looks great to go!