@@ -1141,13 +1141,22 @@ void launchBTDiscovery(bool overrideDiscovery) {
11411141 p->sensorModel_id == TheengsDecoder::BLE_ID_NUM::HHCCJCY01HHCC || p->sensorModel_id == TheengsDecoder::BLE_ID_NUM::BM2) {
11421142 // Discovery of sensors from which we retrieve data only by connect
11431143 // Use device name if available, otherwise use model name
1144- const char * device_name_for_discovery = (p->name [0 ] != ' \0 ' ) ? p->name : model.c_str ();
1144+ const char * device_name_for_discovery;
1145+ #ifdef ForceDeviceNameNoSuffix
1146+ device_name_for_discovery = (p->name [0 ] != ' \0 ' ) ? p->name : model.c_str ();
1147+ #endif
11451148
11461149 if (p->sensorModel_id == BLEconectable::id::DT24_BLE) {
1150+ #ifndef ForceDeviceNameNoSuffix
1151+ device_name_for_discovery = " DT24-BLE" ;
1152+ #endif
11471153 DT24Discovery (macWOdots.c_str (), device_name_for_discovery);
11481154 }
11491155 if (p->sensorModel_id == TheengsDecoder::BLE_ID_NUM::BM2) {
11501156 // Sensor discovery
1157+ #ifndef ForceDeviceNameNoSuffix
1158+ device_name_for_discovery = " BM2" ;
1159+ #endif
11511160 BM2Discovery (macWOdots.c_str (), device_name_for_discovery);
11521161 // Device tracker discovery
11531162 String tracker_id = macWOdots + " -tracker" ;
@@ -1160,15 +1169,27 @@ void launchBTDiscovery(bool overrideDiscovery) {
11601169 stateClassNone);
11611170 }
11621171 if (p->sensorModel_id == BLEconectable::id::LYWSD03MMC) {
1172+ #ifndef ForceDeviceNameNoSuffix
1173+ device_name_for_discovery = " LYWSD03MMC" ;
1174+ #endif
11631175 LYWSD03MMCDiscovery (macWOdots.c_str (), device_name_for_discovery);
11641176 }
11651177 if (p->sensorModel_id == BLEconectable::id::MHO_C401) {
1178+ #ifndef ForceDeviceNameNoSuffix
1179+ device_name_for_discovery = " MHO-C401" ;
1180+ #endif
11661181 MHO_C401Discovery (macWOdots.c_str (), device_name_for_discovery);
11671182 }
11681183 if (p->sensorModel_id == BLEconectable::id::XMWSDJ04MMC) {
1184+ #ifndef ForceDeviceNameNoSuffix
1185+ device_name_for_discovery = " XMWSDJ04MMC" ;
1186+ #endif
11691187 XMWSDJ04MMCDiscovery (macWOdots.c_str (), device_name_for_discovery);
11701188 }
11711189 if (p->sensorModel_id == TheengsDecoder::BLE_ID_NUM::HHCCJCY01HHCC) {
1190+ #ifndef ForceDeviceNameNoSuffix
1191+ device_name_for_discovery = " HHCCJCY01HHCC" ;
1192+ #endif
11721193 HHCCJCY01HHCCDiscovery (macWOdots.c_str (), device_name_for_discovery);
11731194 }
11741195
0 commit comments