From 312b4bcf17c4e221bfb885bf1872de62d9a323f6 Mon Sep 17 00:00:00 2001 From: benzok Date: Wed, 18 Dec 2024 14:53:32 +0100 Subject: [PATCH] [DISC] Whitelist immediate change (#2133) * When updating a device from UNKNOWN force a new scan * update the sensorModel_id and handle if white-list is updated * Restore unduly deleted documentation --- docs/use/ble.md | 2 -- main/ZgatewayBT.ino | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/use/ble.md b/docs/use/ble.md index f89a4ca41d..fa541cf1c4 100644 --- a/docs/use/ble.md +++ b/docs/use/ble.md @@ -124,8 +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}'` diff --git a/main/ZgatewayBT.ino b/main/ZgatewayBT.ino index 6317482432..77a286de05 100644 --- a/main/ZgatewayBT.ino +++ b/main/ZgatewayBT.ino @@ -388,10 +388,16 @@ void createOrUpdateDevice(const char* mac, uint8_t flags, int model, int mac_typ device->connect = true; } - if (model != UNKWNON_MODEL) { + 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;