Modify new BT config using MQTT (#1259)

* Move BTConfig_default to ZgatewayBT.ino as BTConfig_init()

* Remove unused function declaration & typo

* Move bleconnect outside of ifdef ESP32

* Add new parameters to json payload on MQTTtoBT/config
And move them to function BTConfig_fromJson()

new parameters: [presenceEnable, presenceTopic, presenceUseBeaconUuid, extDecoderEnable,
extDecoderTopic, filterConnectable, pubKnownServiceData,
pubUnknownServiceData, pubKnownManufData, pubUnknownManufData,
pubServiceDataUUID, pubBeaconUuidForTopic]

* Add ignoreWBlist as new configuration parameter

* Keep hasspresence keyword (do not use presenceEnable)

* Documentation

* Typos & Optimizations arround RemoveJsonPropertyIf

* Template for BT config update

* Ensure BTConfig.minRssi sign does not matter

* Report configuration change on topic /commands/BTtoMQTT/config

# Conflicts:
#	main/ZgatewayBT.ino

* Add BT config bool commands (init, load, erase & save) to persist config parameters

* Documentation

* Fix pre-compilation issue

* Fix Code Format

* Use Preference only for ESP32

* Update Doc
This commit is contained in:
Bad authored and GitHub committed 2022-09-03 15:08:07 -05:00
1 parent 9120d06932
commit 312ef858c1
5 files changed
+310 -95

No files matched your search

+2 -19
View File
@@ -63,7 +63,7 @@ extern int btQueueLengthCount;
# define BLE_FILTER_CONNECTABLE 0 // Sets whether to filter publishing of scanned devices that require a connection.
#endif // Setting this to 1 prevents overwriting the publication of the device connection data with the advertised data (Recommended for use with OpenHAB).
#define MinimumRSSI -100 //default minimum rssi value, all the devices below -90 will not be reported
#define MinimumRSSI -100 //default minimum rssi value, all the devices below -100 will not be reported
#ifndef Scan_duration
# define Scan_duration 10000 //define the time for a scan
@@ -162,24 +162,7 @@ struct BTConfig_s {
bool pubUnknownManufData; // Publish the manufacturer's data (sometimes contains characters that aren't valid with receiving client)
bool pubServiceDataUUID; // Publish the service UUID data
bool pubBeaconUuidForTopic; // Use iBeacon UUID as topic, instead of sender (random) MAC address
} BTConfig_default = {
.bleConnect = AttemptBLEConnect,
.BLEinterval = TimeBtwRead,
.BLEscanBeforeConnect = ScanBeforeConnect,
.pubOnlySensors = PublishOnlySensors,
.presenceEnable = HassPresence,
.presenceTopic = subjectHomePresence,
.presenceUseBeaconUuid = useBeaconUuidForPresence,
.minRssi = abs(MinimumRSSI),
.extDecoderEnable = UseExtDecoder,
.extDecoderTopic = MQTTDecodeTopic,
.filterConnectable = BLE_FILTER_CONNECTABLE,
.pubKnownServiceData = pubKnownBLEServiceData,
.pubUnknownServiceData = pubUnknownBLEServiceData,
.pubKnownManufData = pubBLEManufacturerData,
.pubUnknownManufData = pubUnknownBLEManufacturerData,
.pubServiceDataUUID = pubBLEServiceUUID,
.pubBeaconUuidForTopic = useBeaconUuidForTopic,
bool ignoreWBlist; // Disable Whitelist & Blacklist
};
// Global struct to store live BT configuration data