mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
added status_
This commit is contained in:
@@ -162,6 +162,8 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
|||||||
return; // don't fetch data if more than 1 thermostat
|
return; // don't fetch data if more than 1 thermostat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strlcpy(status_, "offline", sizeof(status_));
|
||||||
|
|
||||||
//
|
//
|
||||||
// this next section is only for the master thermostat....
|
// this next section is only for the master thermostat....
|
||||||
//
|
//
|
||||||
@@ -186,7 +188,7 @@ bool Thermostat::publish_ha_config() {
|
|||||||
doc["stat_t"] = stat_t;
|
doc["stat_t"] = stat_t;
|
||||||
|
|
||||||
doc["name"] = FJSON("Thermostat Status");
|
doc["name"] = FJSON("Thermostat Status");
|
||||||
doc["val_tpl"] = FJSON("{{value_json.errorcode}}"); // default value - must have one, so we use errorcode
|
doc["val_tpl"] = FJSON("{{value_json.status}}");
|
||||||
JsonObject dev = doc.createNestedObject("dev");
|
JsonObject dev = doc.createNestedObject("dev");
|
||||||
dev["name"] = FJSON("EMS-ESP Thermostat");
|
dev["name"] = FJSON("EMS-ESP Thermostat");
|
||||||
dev["sw"] = EMSESP_APP_VERSION;
|
dev["sw"] = EMSESP_APP_VERSION;
|
||||||
@@ -298,6 +300,15 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* at this point we have discovered a new heating circuit
|
||||||
|
*/
|
||||||
|
|
||||||
|
// if it's the first set the status flag
|
||||||
|
if (heating_circuits_.size() == 0) {
|
||||||
|
strlcpy(status_, "online", sizeof(status_));
|
||||||
|
}
|
||||||
|
|
||||||
// create a new heating circuit object
|
// create a new heating circuit object
|
||||||
auto new_hc = std::make_shared<Thermostat::HeatingCircuit>(hc_num, model());
|
auto new_hc = std::make_shared<Thermostat::HeatingCircuit>(hc_num, model());
|
||||||
heating_circuits_.push_back(new_hc);
|
heating_circuits_.push_back(new_hc);
|
||||||
@@ -2066,6 +2077,7 @@ void Thermostat::register_device_values() {
|
|||||||
uint8_t model = this->model();
|
uint8_t model = this->model();
|
||||||
|
|
||||||
// Common for all thermostats
|
// Common for all thermostats
|
||||||
|
register_device_value(TAG_NONE, &status_, DeviceValueType::TEXT, nullptr, F("status"), F("Status"), DeviceValueUOM::NONE);
|
||||||
register_device_value(TAG_NONE, &dateTime_, DeviceValueType::TEXT, nullptr, F("dateTime"), F("Date/Time"), DeviceValueUOM::NONE);
|
register_device_value(TAG_NONE, &dateTime_, DeviceValueType::TEXT, nullptr, F("dateTime"), F("Date/Time"), DeviceValueUOM::NONE);
|
||||||
register_device_value(TAG_NONE, &errorCode_, DeviceValueType::TEXT, nullptr, F("errorCode"), F("Error code"), DeviceValueUOM::NONE);
|
register_device_value(TAG_NONE, &errorCode_, DeviceValueType::TEXT, nullptr, F("errorCode"), F("Error code"), DeviceValueUOM::NONE);
|
||||||
register_device_value(TAG_NONE, &lastCode_, DeviceValueType::TEXT, nullptr, F("lastCode"), F("Last error"), DeviceValueUOM::NONE);
|
register_device_value(TAG_NONE, &lastCode_, DeviceValueType::TEXT, nullptr, F("lastCode"), F("Last error"), DeviceValueUOM::NONE);
|
||||||
|
|||||||
Reference in New Issue
Block a user