Add alde detection.

This commit is contained in:
Your Name 2024-03-10 17:17:06 +01:00
parent a743ee12f8
commit e6fbece988
4 changed files with 18 additions and 4 deletions

View File

@ -139,6 +139,12 @@ 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,

View File

@ -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)

View File

@ -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;

View File

@ -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 <https://github.com/Fabian-Schmidt/esphome-truma_inetbox/issues/25>).
// First byte is service identifier and to be ignored. Last three bytes can be `xFF` or `x00` (see
// <https://github.com/Fabian-Schmidt/esphome-truma_inetbox/issues/25>).
// `truma_message_header` and `alde_message_header` must have the same size!
const std::array<u_int8_t, 11> truma_message_header = {0x00, 0x00, 0x1F, 0x00, 0x1E, 0x00,
0x00, 0x22, 0xFF, 0xFF, 0xFF};
const std::array<u_int8_t, 11> 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);