truma_inetbox: enhance device discovery with targeted queries and logging

This commit is contained in:
Hendrik Groove 2025-09-14 23:00:01 +02:00
parent a0837070e2
commit 4c097a576d

View File

@ -480,22 +480,31 @@ void TrumaiNetBoxApp::trigger_discovery() {
return; return;
} }
// Start targeted device discovery like CP Plus does ESP_LOGI(TAG, "=== ENHANCED DISCOVERY SEQUENCE STARTED ===");
// Query known Truma device identifiers instead of full scan
// Query identifier 0x23 - typical for Truma heaters // Try multiple NAD addresses - broadcast and specific
std::vector<uint8_t> heater_query = {0xB2, 0x23, 0x17, 0x46, 0x01, 0x03}; std::vector<uint8_t> nad_addresses = {0x7F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
this->master_send_diag_single(0x7F, heater_query);
// Query identifier 0x00 - LIN Product Identification for (uint8_t nad : nad_addresses) {
std::vector<uint8_t> prod_id_query = {0xB2, 0x00, 0x17, 0x46, 0x00, 0x1F}; ESP_LOGI(TAG, "Trying NAD 0x%02X:", nad);
this->master_send_diag_single(0x7F, prod_id_query);
// Query identifier 0x00 with different device signatures // 1. Query identifier 0x23 - from CP Plus log analysis
std::vector<uint8_t> heater_prod_query = {0xB2, 0x00, 0x17, 0x46, 0x40, 0x03}; // Heater signature std::vector<uint8_t> heater_23_query = {0xB2, 0x23, 0x17, 0x46, 0x01, 0x03};
this->master_send_diag_single(0x7F, heater_prod_query); this->master_send_diag_single(nad, heater_23_query);
ESP_LOGD(TAG, " -> Sent B2 23 query to NAD 0x%02X", nad);
ESP_LOGI(TAG, "Manual discovery triggered - sending CP Plus style discovery commands"); // 2. Query identifier 0x00 with heater signature (17 46 40 03)
std::vector<uint8_t> heater_00_query = {0xB2, 0x00, 0x17, 0x46, 0x40, 0x03};
this->master_send_diag_single(nad, heater_00_query);
ESP_LOGD(TAG, " -> Sent B2 00 heater sig query to NAD 0x%02X", nad);
// 3. Query identifier 0x00 with CP Plus signature (as reference)
std::vector<uint8_t> cpplus_00_query = {0xB2, 0x00, 0x17, 0x46, 0x00, 0x04};
this->master_send_diag_single(nad, cpplus_00_query);
ESP_LOGD(TAG, " -> Sent B2 00 CP Plus sig query to NAD 0x%02X", nad);
}
ESP_LOGI(TAG, "=== DISCOVERY SEQUENCE COMPLETED - Monitor PID 3D for responses ===");
} }
} } } }