-
Notifications
You must be signed in to change notification settings - Fork 848
[BLE] Add support for decrypting PVVX, BTHome v2 and Victron BLE frames #2219
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
Changes from all commits
70c992f
5f20c72
df1d711
90f1360
8fb8f41
9817461
966c234
56f1bb2
f9df090
6ff9d61
678e983
3166c6f
4865234
913b95e
cb2fed0
5231f72
222e378
74734fb
507be3f
a8b13f4
7610605
c1a16de
f993aee
d5369a8
68aafe9
7317dde
dbbdd47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,12 @@ bool ethConnected = false; | |
char mqtt_topic[parameters_size + 1] = Base_Topic; | ||
char gateway_name[parameters_size + 1] = Gateway_Name; | ||
unsigned long lastDiscovery = 0; | ||
|
||
#ifdef BLEDecryptor | ||
char ble_aes[parameters_size] = BLE_AES; | ||
StaticJsonDocument<JSON_BLE_AES_CUSTOM_KEYS> ble_aes_keys; | ||
#endif | ||
|
||
#if !MQTT_BROKER_MODE | ||
ss_cnt_parameters cnt_parameters_array[cnt_parameters_array_size] = CNT_PARAMS_ARR; | ||
#endif | ||
|
@@ -2022,6 +2028,10 @@ void saveConfig() { | |
# endif | ||
json["gateway_name"] = gateway_name; | ||
json["ota_pass"] = ota_pass; | ||
# ifdef BLEDecryptor | ||
json["ble_aes"] = ble_aes; | ||
json["ble_aes_keys"] = ble_aes_keys; | ||
# endif | ||
|
||
File configFile = SPIFFS.open("/config.json", "w"); | ||
if (!configFile) { | ||
|
@@ -2169,6 +2179,16 @@ bool loadConfigFromFlash() { | |
} | ||
# endif | ||
} | ||
# ifdef BLEDecryptor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this is where the config gets loaded back in @DigiH from the |
||
if (json.containsKey("ble_aes")) { | ||
strcpy(ble_aes, json["ble_aes"]); | ||
Log.trace(F("loaded default BLE AES key %s" CR), ble_aes); | ||
} | ||
if (json.containsKey("ble_aes_keys")) { | ||
ble_aes_keys = json["ble_aes_keys"]; | ||
Log.trace(F("loaded %d custom BLE AES keys" CR), ble_aes_keys.size()); | ||
} | ||
# endif | ||
result = true; | ||
} else { | ||
Log.warning(F("failed to load json config" CR)); | ||
|
@@ -3441,6 +3461,25 @@ void XtoSYS(const char* topicOri, JsonObject& SYSdata) { // json object decoding | |
mqttSetupPending = true; // trigger reconnect in loop using the new topic/name | ||
} | ||
|
||
#ifdef BLEDecryptor | ||
if (SYSdata.containsKey("ble_aes") || SYSdata.containsKey("ble_aes_keys")) { | ||
if (SYSdata.containsKey("ble_aes")) { | ||
strncpy(ble_aes, SYSdata["ble_aes"], parameters_size); | ||
} | ||
if (SYSdata.containsKey("ble_aes_keys")) { | ||
Log.warning(F("Contains ble_aes_keys" CR)); | ||
ble_aes_keys = SYSdata["ble_aes_keys"]; | ||
} else { | ||
// If no keys are passed clear the object. | ||
StaticJsonDocument<JSON_BLE_AES_CUSTOM_KEYS> jsonBLEBuffer; | ||
ble_aes_keys = jsonBLEBuffer.to<JsonObject>(); | ||
} | ||
# ifndef ESPWifiManualSetup | ||
saveConfig(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @plambrechtsen I overlooked that comment before, but that is what Iand many other users have, plus me also the parent MQTT_HTTPS_FW_UPDATE undefined ;) |
||
# endif | ||
} | ||
#endif | ||
|
||
#if !MQTT_BROKER_MODE | ||
# ifdef MQTTsetMQTT | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.