mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-02-04 08:37:44 +05:00
feat: added sensor type "OT, Cooling hours"
This commit is contained in:
@@ -305,6 +305,7 @@ protected:
|
||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_BURNER_HOURS, false);
|
||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_HEATING_PUMP_HOURS, false);
|
||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_DHW_PUMP_HOURS, false);
|
||||
Sensors::setConnectionStatusByType(Sensors::Type::OT_COOLING_HOURS, false);
|
||||
|
||||
this->initialized = false;
|
||||
this->disconnectedTime = millis();
|
||||
@@ -677,6 +678,21 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
// Update cooling hours
|
||||
if (Sensors::getAmountByType(Sensors::Type::OT_COOLING_HOURS, true)) {
|
||||
if (this->updateCoolingHours()) {
|
||||
Log.snoticeln(FPSTR(L_OT), F("Received cooling hours: %hu"), vars.slave.stats.coolingHours);
|
||||
|
||||
Sensors::setValueByType(
|
||||
Sensors::Type::OT_COOLING_HOURS, vars.slave.stats.coolingHours,
|
||||
Sensors::ValueType::PRIMARY, true, true
|
||||
);
|
||||
|
||||
} else {
|
||||
Log.swarningln(FPSTR(L_OT), F("Failed receive cooling hours"));
|
||||
}
|
||||
}
|
||||
|
||||
// Auto fault reset
|
||||
if (settings.opentherm.options.autoFaultReset && vars.slave.fault.active && !vars.actions.resetFault) {
|
||||
vars.actions.resetFault = true;
|
||||
@@ -2171,6 +2187,25 @@ protected:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool updateCoolingHours() {
|
||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||
OpenThermRequestType::READ_DATA,
|
||||
OpenThermMessageID::CoolingOperationHours,
|
||||
0
|
||||
));
|
||||
|
||||
if (!CustomOpenTherm::isValidResponse(response)) {
|
||||
return false;
|
||||
|
||||
} else if (!CustomOpenTherm::isValidResponseId(response, OpenThermMessageID::CoolingOperationHours)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
vars.slave.stats.coolingHours = CustomOpenTherm::getUInt(response);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool updateModulationLevel() {
|
||||
const unsigned long response = this->instance->sendRequest(CustomOpenTherm::buildRequest(
|
||||
OpenThermRequestType::READ_DATA,
|
||||
|
||||
Reference in New Issue
Block a user