Skip to content

Commit

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

Values used in the code are -1, if you use NAN home assistant will understand it's a wrong value
  • Loading branch information
ShurikenGitHub committed Feb 12, 2023
1 parent a7167dc commit c0a8639
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 c0a8639

Please sign in to comment.