Remove Secure Connection macro and add the config to wifimanager. (#961)

This adds the ability to specify if the MQTT broker connection is secure via a checkbox on the config page of WiFiManager.
Also added to the WiFiManager config page is a text box to enter the brokers TLS certificate.

In the case of using manual configuration a new macro is created MQTT_SECURE_DEFAULT.
When defined as true a secure connection will be requested and the certificate defined in user_config.h will be used.
This commit is contained in:
h2zero authored and GitHub committed 2021-06-02 21:10:38 -06:00
1 parent cd09476807
commit 31efcb32ee
5 files changed
+131 -107

No files matched your search

+1 -4
View File
@@ -13,7 +13,7 @@ The MQTT broker is configured for TLS and you have access to the CA certificate
You are using ESP8266 or ESP32, for other boards TLS is not supported.
### Configure secure connection in the gateway
To enable the secure connection and use TLS uncomment `//#define SECURE_CONNECTION` in `User_config.h`.
To enable the secure connection and use TLS set the `#define MQTT_DEFAULT_SECURE` to true.
Set `MQTT_SERVER` to the Common Name (CN) of the certificate of the broker.
This can be the hostname or the ip of the broker.
@@ -28,9 +28,6 @@ const char* certificate CERT_ATTRIBUTE = R"EOF("
")EOF";
```
If you have no ntp server in your local network (included in the router) or not using dhcp, you should uncomment `//# define NTP_SERVER "pool.ntp.org"` to use a ntp server for time synchronization.
This is related to the `W: failed, ssl error code=54` error message, which indicate that the time of the esp is not correct.
You can know compile and upload to your board and the gateway should connect with TLS to your broker.
## Add the reveived "value" at the end of the topic
+4 -1
View File
@@ -14,6 +14,9 @@ From your smartphone search for your OpenMQTTGateway wifi network and connect to
* Select your wifi
* Set your wifi password
* Set your MQTT Server IP
* Set your MQTT Server Port
* Set the MQTT secure connection box to select whether or not the connection should be secure
* Copy/paste the MQTT server certificate in the MQTT server cert box (only required if using a secure connection), be sure to include the `-----BEGIN CERIFICATE-----` and `-----END CERTIFICATE-----` markers
* Set your MQTT Server username (facultative)
* Set your MQTT Server password (facultative)
* Set your MQTT base topic if you need to change it (you must keep the / at the end)
@@ -55,4 +58,4 @@ build_flags =
'-DMQTT_USER="salut"'
'-DMQTT_PASS="atoi"'
'-DGateway_Name="OpenMQTTGateway_ESP32_OLM_GTW"'
```
```