From c46586da22eb14bfe286026f9a3c849113bf6bc1 Mon Sep 17 00:00:00 2001 From: bengt Date: Sat, 14 Dec 2024 09:06:26 +0100 Subject: [PATCH 1/3] When updating a device from UNKNOWN force a new scan --- docs/use/ble.md | 8 -------- main/ZgatewayBT.ino | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/docs/use/ble.md b/docs/use/ble.md index f89a4ca41d..cfd805277b 100644 --- a/docs/use/ble.md +++ b/docs/use/ble.md @@ -124,14 +124,6 @@ A white list is a list of MAC addresses permitted to be published by OMG to set white list `mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"white-list":["01:23:14:55:16:15","4C:65:77:88:9C:79","4C:65:A6:66:3C:79"]}'` -Note: if you want to filter (white or black list) on BLE sensors that are auto discovered, you need to wait for the discovery before applying the white or black list, or temporarily disable it: - -to temporarily disable white/black list -`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"ignoreWBlist":true}'` - -to enable white/black list back -`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"ignoreWBlist":false}'` - ::: tip So as to keep your white/black list persistent you can publish it with the retain option of MQTT (-r with mosquitto_pub or retain check box of MQTT Explorer) `mosquitto_pub -r -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"white-list":["01:23:14:55:16:15","4C:65:77:88:9C:79","4C:65:A6:66:3C:79"]}'` diff --git a/main/ZgatewayBT.ino b/main/ZgatewayBT.ino index 6317482432..bd2f232d4c 100644 --- a/main/ZgatewayBT.ino +++ b/main/ZgatewayBT.ino @@ -388,8 +388,9 @@ void createOrUpdateDevice(const char* mac, uint8_t flags, int model, int mac_typ device->connect = true; } - if (model != UNKWNON_MODEL) { - device->sensorModel_id = model; + if (model != UNKWNON_MODEL && device->sensorModel_id == UNKWNON_MODEL) { + newDevices++; + device->isDisc = false; } if (flags & device_flags_isWhiteL || flags & device_flags_isBlackL) { From 45fcdb07c101d221c62dcd6e0e20ba4362b5e5d3 Mon Sep 17 00:00:00 2001 From: bengt Date: Sat, 14 Dec 2024 12:50:13 +0100 Subject: [PATCH 2/3] update the sensorModel_id and handle if white-list is updated --- main/ZgatewayBT.ino | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/ZgatewayBT.ino b/main/ZgatewayBT.ino index bd2f232d4c..77a286de05 100644 --- a/main/ZgatewayBT.ino +++ b/main/ZgatewayBT.ino @@ -391,8 +391,13 @@ void createOrUpdateDevice(const char* mac, uint8_t flags, int model, int mac_typ if (model != UNKWNON_MODEL && device->sensorModel_id == UNKWNON_MODEL) { newDevices++; device->isDisc = false; + device->sensorModel_id = model; } + // If a device has been added to the white-list, flag it so it can be auto-detected + if (!device->isWhtL && flags & device_flags_isWhiteL) { + newDevices++; + } if (flags & device_flags_isWhiteL || flags & device_flags_isBlackL) { device->isWhtL = flags & device_flags_isWhiteL; device->isBlkL = flags & device_flags_isBlackL; From e8c3037f9e423dc84fea4b7a726f5440676a3064 Mon Sep 17 00:00:00 2001 From: bengt Date: Sat, 14 Dec 2024 19:42:47 +0100 Subject: [PATCH 3/3] Restore unduly deleted documentation --- docs/use/ble.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/use/ble.md b/docs/use/ble.md index cfd805277b..fa541cf1c4 100644 --- a/docs/use/ble.md +++ b/docs/use/ble.md @@ -124,6 +124,12 @@ A white list is a list of MAC addresses permitted to be published by OMG to set white list `mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"white-list":["01:23:14:55:16:15","4C:65:77:88:9C:79","4C:65:A6:66:3C:79"]}'` +to temporarily disable white/black list +`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"ignoreWBlist":true}'` + +to enable white/black list back +`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"ignoreWBlist":false}'` + ::: tip So as to keep your white/black list persistent you can publish it with the retain option of MQTT (-r with mosquitto_pub or retain check box of MQTT Explorer) `mosquitto_pub -r -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"white-list":["01:23:14:55:16:15","4C:65:77:88:9C:79","4C:65:A6:66:3C:79"]}'`