Skip to content

Commit

Permalink
Fix -1 issue, probably fixing issues: #17, #25, #38 (point nr 3) and #43
Browse files Browse the repository at this point in the history
 (#52)

Values used in the code are -1, if you use NAN home assistant will understand it's a wrong value

Probably fixing issues: #17, #25, #38 (point nr 3) and #43 (#52)
  • Loading branch information
ShurikenGitHub authored Oct 21, 2023
1 parent a7167dc commit d15cb29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions esphome-opentherm/opentherm_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ class OpenthermComponent: public PollingComponent {
}
float getExternalTemperature() {
unsigned long response = ot.sendRequest(ot.buildRequest(OpenThermRequestType::READ, OpenThermMessageID::Toutside, 0));
return ot.isValidResponse(response) ? ot.getFloat(response) : -1;
return ot.isValidResponse(response) ? ot.getFloat(response) : NAN;
}

float getReturnTemperature() {
unsigned long response = ot.sendRequest(ot.buildRequest(OpenThermRequestType::READ, OpenThermMessageID::Tret, 0));
return ot.isValidResponse(response) ? ot.getFloat(response) : -1;
return ot.isValidResponse(response) ? ot.getFloat(response) : NAN;
}

float getHotWaterTemperature() {
unsigned long response = ot.sendRequest(ot.buildRequest(OpenThermRequestType::READ, OpenThermMessageID::Tdhw, 0));
return ot.isValidResponse(response) ? ot.getFloat(response) : -1;
return ot.isValidResponse(response) ? ot.getFloat(response) : NAN;
}

bool setHotWaterTemperature(float temperature) {
Expand All @@ -82,12 +82,12 @@ class OpenthermComponent: public PollingComponent {

float getModulation() {
unsigned long response = ot.sendRequest(ot.buildRequest(OpenThermRequestType::READ, OpenThermMessageID::RelModLevel, 0));
return ot.isValidResponse(response) ? ot.getFloat(response) : -1;
return ot.isValidResponse(response) ? ot.getFloat(response) : NAN;
}

float getPressure() {
unsigned long response = ot.sendRequest(ot.buildRequest(OpenThermRequestType::READ, OpenThermMessageID::CHPressure, 0));
return ot.isValidResponse(response) ? ot.getFloat(response) : -1;
return ot.isValidResponse(response) ? ot.getFloat(response) : NAN;
}

void update() override {
Expand Down Expand Up @@ -161,4 +161,4 @@ class OpenthermComponent: public PollingComponent {
heatingWaterClimate->publish_state();
}

};
};

0 comments on commit d15cb29

Please sign in to comment.