You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fixes BLE scanning being disabled after switching server fails.
* Fixes crash caused by BLE scan results arriving while switching servers.
* Adds documentation to use the server switching command.
Copy file name to clipboardExpand all lines: docs/use/gateway.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,27 @@ Server, port, and secure_flag are only required if changing connection to anothe
57
57
If the new connection fails the gateway will fallback to the previous connection.
58
58
:::
59
59
60
+
## Switching brokers and using self signed and client certificates
61
+
62
+
In the `user_config.h` file it is possible to specify multiple MQTT brokers and client certificates. These are commonly self signed and are supported by defining `MQTT_SECURE_SELF_SIGNED` as true or 1.
63
+
Additonally, support for multiple brokers and client certificates has been added. To use this, it is required that the server certificate, client certificate, and client key are provided as their own constatnt string value as demonstrated in the file.
64
+
To add more than one broker and switch between them it is necessary to provide all of the relevant certificates/keys and add their respective variable names in the `certs_array` structure, as shown in `user_config.h`, and changing the array size to the number of different connections -1.
65
+
66
+
To switch between these servers with an MQTT command message, the format is as follows:
if (advertisedDevice->haveRSSI() && !publishOnlySensors && hassPresence) {
655
-
hass_presence(BLEdata); // this device has an rssi and we don't want only sensors so in consequence we can use it for home assistant room presence component
656
-
}
657
-
if (advertisedDevice->haveServiceData()) {
658
-
int serviceDataCount = advertisedDevice->getServiceDataCount();
659
-
Log.trace(F("Get services data number: %d" CR), serviceDataCount);
if (advertisedDevice->haveRSSI() && !publishOnlySensors && hassPresence) {
656
+
hass_presence(BLEdata); // this device has an rssi and we don't want only sensors so in consequence we can use it for home assistant room presence component
657
+
}
658
+
if (advertisedDevice->haveServiceData()) {
659
+
int serviceDataCount = advertisedDevice->getServiceDataCount();
660
+
Log.trace(F("Get services data number: %d" CR), serviceDataCount);
678
661
for (int j = 0; j < serviceDataCount; j++) {
679
-
strcpy(jsonmsg, jsonmsgb); // the parse _destroys_ the message buffer
680
-
JsonObject& BLEdataLocal = getBTJsonObject(jsonmsg, j == 0); // note, that first time we will get here the BLEdata itself; haPresence for the first msg
681
-
if (!BLEdataLocal.containsKey("id")) { // would crash without id
682
-
Log.trace("Json parsing error for %s" CR, jsonmsgb);
strcpy(jsonmsg, jsonmsgb); // the parse _destroys_ the message buffer
681
+
JsonObject& BLEdataLocal = getBTJsonObject(jsonmsg, j == 0); // note, that first time we will get here the BLEdata itself; haPresence for the first msg
682
+
if (!BLEdataLocal.containsKey("id")) { // would crash without id
683
+
Log.trace("Json parsing error for %s" CR, jsonmsgb);
0 commit comments