truma_inetbox: enhance master mode device discovery with targeted queries

This commit is contained in:
Hendrik Groove 2025-09-14 21:22:22 +02:00
parent 98ad6caab9
commit f022db25c4

View File

@ -33,9 +33,23 @@ void TrumaiNetBoxApp::update() {
// Master mode auto-discovery (start device discovery once)
if (this->master_mode_ && !this->master_discovery_started_) {
this->master_discovery_started_ = true;
// Start device discovery for typical Truma heater NAD range
this->master_scan_b2(0x7F, 0x00, 0xFF); // Broadcast scan, full identifier range
ESP_LOGI(TAG, "Master mode: Started automatic device discovery");
// Start targeted device discovery like CP Plus does
// Query known Truma device identifiers instead of full scan
// Query identifier 0x23 - typical for Truma heaters
std::vector<uint8_t> heater_query = {0xB2, 0x23, 0x17, 0x46, 0x01, 0x03};
this->master_send_diag_single(0x7F, heater_query);
// Query identifier 0x00 - LIN Product Identification
std::vector<uint8_t> prod_id_query = {0xB2, 0x00, 0x17, 0x46, 0x00, 0x1F};
this->master_send_diag_single(0x7F, prod_id_query);
// Query identifier 0x00 with different device signatures
std::vector<uint8_t> heater_prod_query = {0xB2, 0x00, 0x17, 0x46, 0x40, 0x03}; // Heater signature
this->master_send_diag_single(0x7F, heater_prod_query);
ESP_LOGI(TAG, "Master mode: Started targeted device discovery (CP Plus style)");
}
// Master TX scheduler (throttle to ~20ms spacing)