diff --git a/components/truma_inetbox/TrumaEnums.h b/components/truma_inetbox/TrumaEnums.h index e33336f..6811942 100644 --- a/components/truma_inetbox/TrumaEnums.h +++ b/components/truma_inetbox/TrumaEnums.h @@ -139,9 +139,15 @@ enum class ClockSource : u_int8_t { CLOCK_SOURCE_PROG = 0x2, }; +enum class TRUMA_COMPANY : u_int8_t { + UNKNOWN = 0x00, + TRUMA = 0x1E, + ALDE = 0x1A, +}; + enum class TRUMA_DEVICE : u_int8_t { UNKNOWN = 0x00, - + // Saphir Compact AC AIRCON_DEVICE = 0x01, @@ -160,7 +166,7 @@ enum class TRUMA_DEVICE : u_int8_t { HEATER_COMBI6D = 0x06, }; -enum class TRUMA_DEVICE_STATE : u_int8_t{ +enum class TRUMA_DEVICE_STATE : u_int8_t { OFFLINE = 0x00, ONLINE = 0x01, }; diff --git a/components/truma_inetbox/TrumaiNetBoxApp.cpp b/components/truma_inetbox/TrumaiNetBoxApp.cpp index b2fad32..976f489 100644 --- a/components/truma_inetbox/TrumaiNetBoxApp.cpp +++ b/components/truma_inetbox/TrumaiNetBoxApp.cpp @@ -133,10 +133,14 @@ const u_int8_t *TrumaiNetBoxApp::lin_multiframe_recieved(const u_int8_t *message return nullptr; } for (u_int8_t i = 1; i < truma_message_header.size() - 3; i++) { - if (message[i] != truma_message_header[i]) { + if (message[i] != truma_message_header[i] && message[i] != alde_message_header[i]) { return nullptr; } } + if (message[4] != (u_int8_t) this->company_) { + ESP_LOGI(TAG, "Switch company to 0x%02x", message[4]); + this->company_ = (TRUMA_COMPANY) message[4]; + } if (message[0] == LIN_SID_READ_STATE_BUFFER) { // Example: BA.00.1F.00.1E.00.00.22.FF.FF.FF (11) diff --git a/components/truma_inetbox/TrumaiNetBoxApp.h b/components/truma_inetbox/TrumaiNetBoxApp.h index 68ec6c9..19c1860 100644 --- a/components/truma_inetbox/TrumaiNetBoxApp.h +++ b/components/truma_inetbox/TrumaiNetBoxApp.h @@ -52,6 +52,7 @@ class TrumaiNetBoxApp : public LinBusProtocol { u_int8_t message_counter = 1; // Truma heater conected to CP Plus. + TRUMA_COMPANY company_ = TRUMA_COMPANY::TRUMA; TRUMA_DEVICE heater_device_ = TRUMA_DEVICE::UNKNOWN; TRUMA_DEVICE aircon_device_ = TRUMA_DEVICE::UNKNOWN; diff --git a/components/truma_inetbox/helpers.h b/components/truma_inetbox/helpers.h index 35ccaba..fad927c 100644 --- a/components/truma_inetbox/helpers.h +++ b/components/truma_inetbox/helpers.h @@ -5,9 +5,12 @@ namespace esphome { namespace truma_inetbox { -// First byte is service identifier and to be ignored. Last three bytes can be `xFF` or `x00` (see ). +// First byte is service identifier and to be ignored. Last three bytes can be `xFF` or `x00` (see +// ). +// `truma_message_header` and `alde_message_header` must have the same size! const std::array truma_message_header = {0x00, 0x00, 0x1F, 0x00, 0x1E, 0x00, 0x00, 0x22, 0xFF, 0xFF, 0xFF}; +const std::array alde_message_header = {0x00, 0x00, 0x1F, 0x00, 0x1A, 0x00, 0x00, 0x22, 0xFF, 0xFF, 0xFF}; u_int8_t addr_parity(const u_int8_t pid); u_int8_t data_checksum(const u_int8_t *message, u_int8_t length, uint16_t sum);