Water temp 200 shown as 80 hack.

This commit is contained in:
Martin Polehla 2024-03-13 11:29:05 +01:00
parent e6fbece988
commit 1086945fe2
3 changed files with 10 additions and 1 deletions

View File

@ -5,10 +5,11 @@ namespace esphome {
namespace truma_inetbox {
static const char *const TAG = "truma_inetbox.water_climate";
void TrumaWaterClimate::setup() {
this->parent_->get_heater()->add_on_message_callback([this](const StatusFrameHeater *status_heater) {
// Publish updated state
this->target_temperature = temp_code_to_decimal(status_heater->target_temp_water);
this->target_temperature = water_temp_200_fix(temp_code_to_decimal(status_heater->target_temp_water));
this->current_temperature = temp_code_to_decimal(status_heater->current_temp_water);
this->mode = (status_heater->target_temp_water == TargetTemp::TARGET_TEMP_OFF) ? climate::CLIMATE_MODE_OFF
: climate::CLIMATE_MODE_HEAT;

View File

@ -27,6 +27,13 @@ float temp_code_to_decimal(u_int16_t val, float zero) {
return ((float) val) / 10.0f - 273.0f;
}
float water_temp_200_fix(float val) {
if (val == 200) {
return 80;
}
return val;
}
float temp_code_to_decimal(TargetTemp val, float zero) { return temp_code_to_decimal((u_int16_t) val, zero); }
TargetTemp decimal_to_temp(u_int8_t val) { return (TargetTemp) ((((u_int16_t) val) + 273) * 10); }

View File

@ -16,6 +16,7 @@ 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);
float temp_code_to_decimal(u_int16_t val, float zero = NAN);
float temp_code_to_decimal(TargetTemp val, float zero = NAN);
float water_temp_200_fix(float val);
TargetTemp decimal_to_temp(u_int8_t val);
TargetTemp decimal_to_temp(float val);
TargetTemp decimal_to_room_temp(u_int8_t val);