Skip to content

Commit

Permalink
Disable compressed frames in flowiq2200
Browse files Browse the repository at this point in the history
  • Loading branch information
SzczepanLeon authored Feb 25, 2024
1 parent d4cd37f commit 1ad30e4
Showing 1 changed file with 40 additions and 39 deletions.
79 changes: 40 additions & 39 deletions driver_flowiq2200.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct Flowiq2200: Driver
// CRC status prev maxF 06FF1B date T1 T2 flow total
// 0001 1718 1920212223 24252627 28293031 3233 343536373839 4041 42 43 4445 46474849 50
// 3244 ... FDC3 7905099CE6 00000000 7CE20300 7C05 06600006D000 0132 0B 11 0000 79E70300 0F
// see https://github.com/SzczepanLeon/esphome-components/issues/86

private:
esphome::optional<double> get_total_water_m3(std::vector<unsigned char> &telegram) {
Expand All @@ -43,14 +44,14 @@ struct Flowiq2200: Driver
if (tpl_ci_field == 0x78) {
ret_val = this->get_0413(telegram);
}
else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
uint32_t usage{0};
uint8_t i = 46;
usage = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) |
((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
ret_val = usage / 1000.0;
ESP_LOGVV(TAG, "Found total_water with '%d'->'%f'", usage, ret_val.value());
}
// else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
// uint32_t usage{0};
// uint8_t i = 46;
// usage = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) |
// ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
// ret_val = usage / 1000.0;
// ESP_LOGVV(TAG, "Found total_water with '%d'->'%f'", usage, ret_val.value());
// }
return ret_val;
};

Expand All @@ -61,14 +62,14 @@ struct Flowiq2200: Driver
if (tpl_ci_field == 0x78) {
ret_val = this->get_4413(telegram);
}
else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
uint32_t usage{0};
uint8_t i = 28;
usage = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) |
((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
ret_val = usage / 1000.0;
ESP_LOGVV(TAG, "Found target_water with '%d'->'%f'", usage, ret_val.value());
}
// else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
// uint32_t usage{0};
// uint8_t i = 28;
// usage = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) |
// ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
// ret_val = usage / 1000.0;
// ESP_LOGVV(TAG, "Found target_water with '%d'->'%f'", usage, ret_val.value());
// }
return ret_val;
};

Expand All @@ -79,14 +80,14 @@ struct Flowiq2200: Driver
if (tpl_ci_field == 0x78) {
ret_val = this->get_04FF23(telegram);
}
else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
uint32_t status{0};
uint8_t i = 24;
status = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) |
((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
ret_val = (double)status;
ESP_LOGVV(TAG, "Found status with '%08X'", status);
}
// else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
// uint32_t status{0};
// uint8_t i = 24;
// status = (((uint32_t)telegram[i+3] << 24) | ((uint32_t)telegram[i+2] << 16) |
// ((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
// ret_val = (double)status;
// ESP_LOGVV(TAG, "Found status with '%08X'", status);
// }
return ret_val;
};

Expand All @@ -97,13 +98,13 @@ struct Flowiq2200: Driver
if (tpl_ci_field == 0x78) {
ret_val = this->get_023B(telegram);
}
else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
uint32_t flow{0};
uint8_t i = 44;
flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
ret_val = (double)flow;
ESP_LOGVV(TAG, "Found volume_flow with '%d'->'%f'", flow, ret_val.value());
}
// else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
// uint32_t flow{0};
// uint8_t i = 44;
// flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
// ret_val = (double)flow;
// ESP_LOGVV(TAG, "Found volume_flow with '%d'->'%f'", flow, ret_val.value());
// }
return ret_val;
};

Expand All @@ -114,14 +115,14 @@ struct Flowiq2200: Driver
if (tpl_ci_field == 0x78) {
ret_val = this->get_523B(telegram);
}
else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
uint32_t flow{0};
uint8_t i = 32;
flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
ret_val = (double)flow;
ESP_LOGVV(TAG, "Found max_flow with '%d'->'%f'", flow, ret_val.value());
}
// else if ((tpl_ci_field == 0x79) && (l_field > 49)) {
// uint32_t flow{0};
// uint8_t i = 32;
// flow = (((uint32_t)telegram[i+1] << 8) | ((uint32_t)telegram[i+0]));
// ret_val = (double)flow;
// ESP_LOGVV(TAG, "Found max_flow with '%d'->'%f'", flow, ret_val.value());
// }
return ret_val;
};

};
};

0 comments on commit 1ad30e4

Please sign in to comment.