mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
rename output to json, implement export_values for info command
This commit is contained in:
@@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- new command under system called `report`. http://ems-esp/api?device=system&cmd=report to generate a report log for troubleshooting
|
- new command under system called `report`. http://ems-esp/api?device=system&cmd=report to generate a report log for troubleshooting
|
||||||
- thermostat error codes
|
- thermostat error codes
|
||||||
- Console command `pulbish ha` to also force the creation of the Home Assistant MQTT Discovery topics
|
- Console command `pulbish ha` to also force the creation of the Home Assistant MQTT Discovery topics
|
||||||
- Heatpump values
|
- Heatpump values (dew temperature and relative air humidity)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- fix wwontime readback
|
- fix wwontime readback
|
||||||
@@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- JWT Secret renamed to Super User Password
|
- JWT Secret renamed to Super User Password
|
||||||
- EMS Devices in Web UI shows button and tooltip to remind users they can click on a device
|
- EMS Devices in Web UI shows button and tooltip to remind users they can click on a device
|
||||||
- MQTT boiler_data payload split into two topics `boiler_data_main` and `boiler_data_ww`
|
- MQTT boiler_data payload split into two topics `boiler_data_main` and `boiler_data_ww`
|
||||||
|
- "sensor" renamed to "dallassensor" as a command. MQTT topic not affected.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Console contexts for thermostat and boiler
|
- Console contexts for thermostat and boiler
|
||||||
|
|||||||
@@ -72,16 +72,16 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
// execute the command
|
// execute the command
|
||||||
if (data.isEmpty()) {
|
if (data.isEmpty()) {
|
||||||
ok = Command::call(device_type, cmd.c_str(), nullptr, id.toInt(), output); // command only
|
ok = Command::call(device_type, cmd.c_str(), nullptr, id.toInt(), json); // command only
|
||||||
} else {
|
} else {
|
||||||
if (api_enabled) {
|
if (api_enabled) {
|
||||||
// we only allow commands with parameters if the API is enabled
|
// we only allow commands with parameters if the API is enabled
|
||||||
ok = Command::call(device_type, cmd.c_str(), data.c_str(), id.toInt(), output); // has cmd, data and id
|
ok = Command::call(device_type, cmd.c_str(), data.c_str(), id.toInt(), json); // has cmd, data and id
|
||||||
} else {
|
} else {
|
||||||
request->send(401, "text/plain", F("Unauthorized"));
|
request->send(401, "text/plain", F("Unauthorized"));
|
||||||
return;
|
return;
|
||||||
@@ -100,15 +100,15 @@ void WebAPIService::webAPIService(AsyncWebServerRequest * request) {
|
|||||||
id.c_str(),
|
id.c_str(),
|
||||||
ok ? F("OK") : F("Invalid"));
|
ok ? F("OK") : F("Invalid"));
|
||||||
EMSESP::logger().info(debug.c_str());
|
EMSESP::logger().info(debug.c_str());
|
||||||
if (output.size()) {
|
if (json.size()) {
|
||||||
char buffer2[EMSESP_MAX_JSON_SIZE_LARGE];
|
char buffer2[EMSESP_MAX_JSON_SIZE_LARGE];
|
||||||
serializeJson(doc, buffer2);
|
serializeJson(doc, buffer2);
|
||||||
EMSESP::logger().info("output (max 255 chars): %s", buffer2);
|
EMSESP::logger().info("json (max 255 chars): %s", buffer2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if we have returned data in JSON format, send this to the WEB
|
// if we have returned data in JSON format, send this to the WEB
|
||||||
if (output.size()) {
|
if (json.size()) {
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
char buffer[EMSESP_MAX_JSON_SIZE_LARGE];
|
char buffer[EMSESP_MAX_JSON_SIZE_LARGE];
|
||||||
serializeJsonPretty(doc, buffer);
|
serializeJsonPretty(doc, buffer);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ std::vector<Command::CmdFunction> Command::cmdfunctions_;
|
|||||||
// calls a command, context is the device_type
|
// calls a command, context is the device_type
|
||||||
// id may be used to represent a heating circuit for example
|
// id may be used to represent a heating circuit for example
|
||||||
// returns false if error or not found
|
// returns false if error or not found
|
||||||
bool Command::call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id, JsonObject & output) {
|
bool Command::call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id, JsonObject & json) {
|
||||||
#ifdef EMSESP_DEBUG
|
#ifdef EMSESP_DEBUG
|
||||||
std::string dname = EMSdevice::device_type_2_device_name(device_type);
|
std::string dname = EMSdevice::device_type_2_device_name(device_type);
|
||||||
if (value == nullptr) {
|
if (value == nullptr) {
|
||||||
@@ -48,11 +48,11 @@ bool Command::call(const uint8_t device_type, const char * cmd, const char * val
|
|||||||
if (uuid::read_flash_string(cf.cmd_) == cmd) {
|
if (uuid::read_flash_string(cf.cmd_) == cmd) {
|
||||||
if (cf.cmdfunction_json_) {
|
if (cf.cmdfunction_json_) {
|
||||||
// check if json object is empty, if so quit
|
// check if json object is empty, if so quit
|
||||||
if (output.isNull()) {
|
if (json.isNull()) {
|
||||||
LOG_WARNING(F("Ignore call for command %s in %s because no json"), cmd, EMSdevice::device_type_2_device_name(device_type).c_str());
|
LOG_WARNING(F("Ignore call for command %s in %s because no json"), cmd, EMSdevice::device_type_2_device_name(device_type).c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ok |= ((cf.cmdfunction_json_)(value, id, output));
|
ok |= ((cf.cmdfunction_json_)(value, id, json));
|
||||||
} else {
|
} else {
|
||||||
ok |= ((cf.cmdfunction_)(value, id));
|
ok |= ((cf.cmdfunction_)(value, id));
|
||||||
}
|
}
|
||||||
@@ -81,11 +81,16 @@ void Command::add_with_json(const uint8_t device_type, const __FlashStringHelper
|
|||||||
|
|
||||||
// see if a command exists for that device type
|
// see if a command exists for that device type
|
||||||
bool Command::find_command(const uint8_t device_type, const char * cmd) {
|
bool Command::find_command(const uint8_t device_type, const char * cmd) {
|
||||||
|
if ((cmd == nullptr) || (strlen(cmd) == 0)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto & cf : cmdfunctions_) {
|
for (const auto & cf : cmdfunctions_) {
|
||||||
if ((strcmp(cmd, uuid::read_flash_string(cf.cmd_).c_str()) == 0) && (cf.device_type_ == device_type)) {
|
if (!strcmp_P(cmd, reinterpret_cast<PGM_P>(cf.cmd_)) && (cf.device_type_ == device_type)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // not found
|
return false; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +119,7 @@ bool Command::device_has_commands(const uint8_t device_type) {
|
|||||||
return true; // we always have System
|
return true; // we always have System
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_type == EMSdevice::DeviceType::SENSOR) {
|
if (device_type == EMSdevice::DeviceType::DALLASSENSOR) {
|
||||||
return true; // we always have Sensor, but should check if there are actual sensors attached!
|
return true; // we always have Sensor, but should check if there are actual sensors attached!
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +141,7 @@ void Command::show_devices(uuid::console::Shell & shell) {
|
|||||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SYSTEM).c_str());
|
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SYSTEM).c_str());
|
||||||
|
|
||||||
if (EMSESP::have_sensors()) {
|
if (EMSESP::have_sensors()) {
|
||||||
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SENSOR).c_str());
|
shell.printf("%s ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::DALLASSENSOR).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto & device_class : EMSFactory::device_handlers()) {
|
for (const auto & device_class : EMSFactory::device_handlers()) {
|
||||||
@@ -160,8 +165,8 @@ void Command::show_all(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
// show sensor
|
// show sensor
|
||||||
if (EMSESP::have_sensors()) {
|
if (EMSESP::have_sensors()) {
|
||||||
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SENSOR).c_str());
|
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::DALLASSENSOR).c_str());
|
||||||
show(shell, EMSdevice::DeviceType::SENSOR);
|
show(shell, EMSdevice::DeviceType::DALLASSENSOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do this in the order of factory classes to keep a consistent order when displaying
|
// do this in the order of factory classes to keep a consistent order when displaying
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ using uuid::console::Shell;
|
|||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
using cmdfunction_p = std::function<bool(const char * data, const int8_t id)>;
|
using cmdfunction_p = std::function<bool(const char * data, const int8_t id)>;
|
||||||
using cmdfunction_json_p = std::function<bool(const char * data, const int8_t id, JsonObject & output)>;
|
using cmdfunction_json_p = std::function<bool(const char * data, const int8_t id, JsonObject & json)>;
|
||||||
|
|
||||||
class Command {
|
class Command {
|
||||||
public:
|
public:
|
||||||
@@ -57,7 +57,7 @@ class Command {
|
|||||||
return cmdfunctions_;
|
return cmdfunctions_;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id, JsonObject & output);
|
static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id, JsonObject & json);
|
||||||
static void add(const uint8_t device_type, const uint8_t device_id, const __FlashStringHelper * cmd, cmdfunction_p cb);
|
static void add(const uint8_t device_type, const uint8_t device_id, const __FlashStringHelper * cmd, cmdfunction_p cb);
|
||||||
static void add_with_json(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_json_p cb);
|
static void add_with_json(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_json_p cb);
|
||||||
static void show_all(uuid::console::Shell & shell);
|
static void show_all(uuid::console::Shell & shell);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
uuid::log::Logger DallasSensor::logger_{F_(sensor), uuid::log::Facility::DAEMON};
|
uuid::log::Logger DallasSensor::logger_{F_(dallassensor), uuid::log::Facility::DAEMON};
|
||||||
|
|
||||||
// start the 1-wire
|
// start the 1-wire
|
||||||
void DallasSensor::start() {
|
void DallasSensor::start() {
|
||||||
@@ -42,8 +42,8 @@ void DallasSensor::start() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// API call
|
// API call
|
||||||
Command::add_with_json(EMSdevice::DeviceType::SENSOR, F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
Command::add_with_json(EMSdevice::DeviceType::DALLASSENSOR, F_(info), [&](const char * value, const int8_t id, JsonObject & json) {
|
||||||
return command_info(value, id, object);
|
return command_info(value, id, json);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,14 +282,14 @@ bool DallasSensor::updated_values() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DallasSensor::command_info(const char * value, const int8_t id, JsonObject & output) {
|
bool DallasSensor::command_info(const char * value, const int8_t id, JsonObject & json) {
|
||||||
return (export_values(output));
|
return (export_values(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates JSON doc from values
|
// creates JSON doc from values
|
||||||
// returns false if empty
|
// returns false if empty
|
||||||
// e.g. sensor_data = {"sensor1":{"id":"28-EA41-9497-0E03-5F","temp":23.30},"sensor2":{"id":"28-233D-9497-0C03-8B","temp":24.0}}
|
// e.g. sensor_data = {"sensor1":{"id":"28-EA41-9497-0E03-5F","temp":23.30},"sensor2":{"id":"28-233D-9497-0C03-8B","temp":24.0}}
|
||||||
bool DallasSensor::export_values(JsonObject & output) {
|
bool DallasSensor::export_values(JsonObject & json) {
|
||||||
if (sensors_.size() == 0) {
|
if (sensors_.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -298,7 +298,7 @@ bool DallasSensor::export_values(JsonObject & output) {
|
|||||||
for (const auto & sensor : sensors_) {
|
for (const auto & sensor : sensors_) {
|
||||||
char sensorID[10]; // sensor{1-n}
|
char sensorID[10]; // sensor{1-n}
|
||||||
snprintf_P(sensorID, 10, PSTR("sensor%d"), i++);
|
snprintf_P(sensorID, 10, PSTR("sensor%d"), i++);
|
||||||
JsonObject dataSensor = output.createNestedObject(sensorID);
|
JsonObject dataSensor = json.createNestedObject(sensorID);
|
||||||
dataSensor["id"] = sensor.to_string();
|
dataSensor["id"] = sensor.to_string();
|
||||||
if (Helpers::hasValue(sensor.temperature_c)) {
|
if (Helpers::hasValue(sensor.temperature_c)) {
|
||||||
dataSensor["temp"] = (float)(sensor.temperature_c) / 10;
|
dataSensor["temp"] = (float)(sensor.temperature_c) / 10;
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class DallasSensor {
|
|||||||
int16_t get_temperature_c(const uint8_t addr[]);
|
int16_t get_temperature_c(const uint8_t addr[]);
|
||||||
uint64_t get_id(const uint8_t addr[]);
|
uint64_t get_id(const uint8_t addr[]);
|
||||||
|
|
||||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
bool command_info(const char * value, const int8_t id, JsonObject & json);
|
||||||
bool export_values(JsonObject & doc);
|
bool export_values(JsonObject & doc);
|
||||||
|
|
||||||
uint32_t last_activity_ = uuid::get_uptime();
|
uint32_t last_activity_ = uuid::get_uptime();
|
||||||
|
|||||||
@@ -70,12 +70,6 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
|
|||||||
register_mqtt_cmd(F("boilhystoff"), [&](const char * value, const int8_t id) { return set_hyst_off(value, id); });
|
register_mqtt_cmd(F("boilhystoff"), [&](const char * value, const int8_t id) { return set_hyst_off(value, id); });
|
||||||
register_mqtt_cmd(F("burnperiod"), [&](const char * value, const int8_t id) { return set_burn_period(value, id); });
|
register_mqtt_cmd(F("burnperiod"), [&](const char * value, const int8_t id) { return set_burn_period(value, id); });
|
||||||
register_mqtt_cmd(F("pumpdelay"), [&](const char * value, const int8_t id) { return set_pump_delay(value, id); });
|
register_mqtt_cmd(F("pumpdelay"), [&](const char * value, const int8_t id) { return set_pump_delay(value, id); });
|
||||||
|
|
||||||
// API call
|
|
||||||
// Command::add_with_json(this->device_type(), F("info"), Boiler::command_info);
|
|
||||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
|
||||||
return command_info(value, id, object);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the config topics for Home Assistant MQTT Discovery
|
// create the config topics for Home Assistant MQTT Discovery
|
||||||
@@ -180,142 +174,142 @@ void Boiler::register_mqtt_ha_config(bool force) {
|
|||||||
void Boiler::device_info_web(JsonArray & root) {
|
void Boiler::device_info_web(JsonArray & root) {
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values_main(output)) {
|
if (!export_values_main(json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
export_values_ww(output); // append ww values
|
export_values_ww(json); // append ww values
|
||||||
|
|
||||||
print_value_json(root, F("heatingActive"), nullptr, F_(heatingActive), nullptr, output);
|
print_value_json(root, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json);
|
||||||
print_value_json(root, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, output);
|
print_value_json(root, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json);
|
||||||
print_value_json(root, F("serviceCode"), nullptr, F_(serviceCode), nullptr, output);
|
print_value_json(root, F("serviceCode"), nullptr, F_(serviceCode), nullptr, json);
|
||||||
print_value_json(root, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, output);
|
print_value_json(root, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, json);
|
||||||
print_value_json(root, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), output);
|
print_value_json(root, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), output);
|
print_value_json(root, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), json);
|
||||||
print_value_json(root, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), output);
|
print_value_json(root, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), json);
|
||||||
print_value_json(root, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), output);
|
print_value_json(root, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), json);
|
||||||
print_value_json(root, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), output);
|
print_value_json(root, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), json);
|
||||||
print_value_json(root, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), output);
|
print_value_json(root, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), output);
|
print_value_json(root, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("retTemp"), nullptr, F_(retTemp), F_(degrees), output);
|
print_value_json(root, F("retTemp"), nullptr, F_(retTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), output);
|
print_value_json(root, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("sysPress"), nullptr, F_(sysPress), nullptr, output);
|
print_value_json(root, F("sysPress"), nullptr, F_(sysPress), nullptr, json);
|
||||||
print_value_json(root, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), output);
|
print_value_json(root, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("burnGas"), nullptr, F_(burnGas), nullptr, output);
|
print_value_json(root, F("burnGas"), nullptr, F_(burnGas), nullptr, json);
|
||||||
print_value_json(root, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), output);
|
print_value_json(root, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), json);
|
||||||
print_value_json(root, F("heatPump"), nullptr, F_(heatPump), nullptr, output);
|
print_value_json(root, F("heatPump"), nullptr, F_(heatPump), nullptr, json);
|
||||||
print_value_json(root, F("fanWork"), nullptr, F_(fanWork), nullptr, output);
|
print_value_json(root, F("fanWork"), nullptr, F_(fanWork), nullptr, json);
|
||||||
print_value_json(root, F("ignWork"), nullptr, F_(ignWork), nullptr, output);
|
print_value_json(root, F("ignWork"), nullptr, F_(ignWork), nullptr, json);
|
||||||
print_value_json(root, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, output);
|
print_value_json(root, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, json);
|
||||||
print_value_json(root, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), output);
|
print_value_json(root, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), output);
|
print_value_json(root, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), json);
|
||||||
print_value_json(root, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), output);
|
print_value_json(root, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), json);
|
||||||
print_value_json(root, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), output);
|
print_value_json(root, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), json);
|
||||||
print_value_json(root, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), output);
|
print_value_json(root, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), json);
|
||||||
print_value_json(root, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), output);
|
print_value_json(root, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), json);
|
||||||
print_value_json(root, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), output);
|
print_value_json(root, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), json);
|
||||||
print_value_json(root, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), output);
|
print_value_json(root, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), json);
|
||||||
print_value_json(root, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), output);
|
print_value_json(root, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), json);
|
||||||
print_value_json(root, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), output);
|
print_value_json(root, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), output);
|
print_value_json(root, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), json);
|
||||||
print_value_json(root, F("burnStarts"), nullptr, F_(burnStarts), nullptr, output);
|
print_value_json(root, F("burnStarts"), nullptr, F_(burnStarts), nullptr, json);
|
||||||
|
|
||||||
// ww
|
// ww
|
||||||
print_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), output);
|
print_value_json(root, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), output);
|
print_value_json(root, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), output);
|
print_value_json(root, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("wWType"), nullptr, F_(wWType), nullptr, output);
|
print_value_json(root, F("wWType"), nullptr, F_(wWType), nullptr, json);
|
||||||
print_value_json(root, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, output);
|
print_value_json(root, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, json);
|
||||||
print_value_json(root, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, output);
|
print_value_json(root, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, json);
|
||||||
print_value_json(root, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, output);
|
print_value_json(root, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, json);
|
||||||
print_value_json(root, F("wWCirc"), nullptr, F_(wWCirc), nullptr, output);
|
print_value_json(root, F("wWCirc"), nullptr, F_(wWCirc), nullptr, json);
|
||||||
print_value_json(root, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), output);
|
print_value_json(root, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), output);
|
print_value_json(root, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), json);
|
||||||
print_value_json(root, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), output);
|
print_value_json(root, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), json);
|
||||||
print_value_json(root, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), output);
|
print_value_json(root, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), json);
|
||||||
print_value_json(root, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), output);
|
print_value_json(root, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), json);
|
||||||
print_value_json(root, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), output);
|
print_value_json(root, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("wWActivated"), nullptr, F_(wWActivated), nullptr, output);
|
print_value_json(root, F("wWActivated"), nullptr, F_(wWActivated), nullptr, json);
|
||||||
print_value_json(root, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, output);
|
print_value_json(root, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, json);
|
||||||
print_value_json(root, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, output);
|
print_value_json(root, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, json);
|
||||||
print_value_json(root, F("wWCharging"), nullptr, F_(wWCharging), nullptr, output);
|
print_value_json(root, F("wWCharging"), nullptr, F_(wWCharging), nullptr, json);
|
||||||
print_value_json(root, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, output);
|
print_value_json(root, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, json);
|
||||||
print_value_json(root, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, output);
|
print_value_json(root, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, json);
|
||||||
print_value_json(root, F("wWActive"), nullptr, F_(wWActive), nullptr, output);
|
print_value_json(root, F("wWActive"), nullptr, F_(wWActive), nullptr, json);
|
||||||
print_value_json(root, F("wWHeat"), nullptr, F_(wWHeat), nullptr, output);
|
print_value_json(root, F("wWHeat"), nullptr, F_(wWHeat), nullptr, json);
|
||||||
print_value_json(root, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), output);
|
print_value_json(root, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), json);
|
||||||
print_value_json(root, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), output);
|
print_value_json(root, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), json);
|
||||||
print_value_json(root, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), output);
|
print_value_json(root, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), json);
|
||||||
print_value_json(root, F("wWStarts"), nullptr, F_(wWStarts), nullptr, output);
|
print_value_json(root, F("wWStarts"), nullptr, F_(wWStarts), nullptr, json);
|
||||||
print_value_json(root, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, output);
|
print_value_json(root, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Boiler::command_info(const char * value, const int8_t id, JsonObject & output) {
|
bool Boiler::export_values(JsonObject & json) {
|
||||||
if (!export_values_main(output)) {
|
if (!export_values_main(json)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
export_values_ww(output); // append ww values
|
export_values_ww(json); // append ww values
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates JSON doc from values
|
// creates JSON doc from values
|
||||||
// returns false if empty
|
// returns false if empty
|
||||||
bool Boiler::export_values_ww(JsonObject & output) {
|
bool Boiler::export_values_ww(JsonObject & json) {
|
||||||
char s[10]; // for formatting strings
|
char s[10]; // for formatting strings
|
||||||
|
|
||||||
// Warm Water comfort setting
|
// Warm Water comfort setting
|
||||||
if (Helpers::hasValue(wWComfort_)) {
|
if (Helpers::hasValue(wWComfort_)) {
|
||||||
if (wWComfort_ == 0x00) {
|
if (wWComfort_ == 0x00) {
|
||||||
output["wWComfort"] = F("Hot");
|
json["wWComfort"] = F("Hot");
|
||||||
} else if (wWComfort_ == 0xD8) {
|
} else if (wWComfort_ == 0xD8) {
|
||||||
output["wWComfort"] = F("Eco");
|
json["wWComfort"] = F("Eco");
|
||||||
} else if (wWComfort_ == 0xEC) {
|
} else if (wWComfort_ == 0xEC) {
|
||||||
output["wWComfort"] = F("Intelligent");
|
json["wWComfort"] = F("Intelligent");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water selected temperature
|
// Warm Water selected temperature
|
||||||
if (Helpers::hasValue(wWSelTemp_)) {
|
if (Helpers::hasValue(wWSelTemp_)) {
|
||||||
output["wWSelTemp"] = wWSelTemp_;
|
json["wWSelTemp"] = wWSelTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water set temperature
|
// Warm Water set temperature
|
||||||
if (Helpers::hasValue(wWSetTemp_)) {
|
if (Helpers::hasValue(wWSetTemp_)) {
|
||||||
output["wWSetTemp"] = wWSetTemp_;
|
json["wWSetTemp"] = wWSetTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water disinfection temperature
|
// Warm Water disinfection temperature
|
||||||
if (Helpers::hasValue(wWDisinfectionTemp_)) {
|
if (Helpers::hasValue(wWDisinfectionTemp_)) {
|
||||||
output["wWDisinfectionTemp"] = wWDisinfectionTemp_;
|
json["wWDisinfectionTemp"] = wWDisinfectionTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water type
|
// Warm Water type
|
||||||
if (wWType_ == 0) { // no output if not set
|
if (wWType_ == 0) { // no json if not set
|
||||||
output["wWType"] = F("off");
|
json["wWType"] = F("off");
|
||||||
} else if (wWType_ == 1) {
|
} else if (wWType_ == 1) {
|
||||||
output["wWType"] = F("flow");
|
json["wWType"] = F("flow");
|
||||||
} else if (wWType_ == 2) {
|
} else if (wWType_ == 2) {
|
||||||
output["wWType"] = F("buffered flow");
|
json["wWType"] = F("buffered flow");
|
||||||
} else if (wWType_ == 3) {
|
} else if (wWType_ == 3) {
|
||||||
output["wWType"] = F("buffer");
|
json["wWType"] = F("buffer");
|
||||||
} else if (wWType_ == 4) {
|
} else if (wWType_ == 4) {
|
||||||
output["wWType"] = F("layered buffer");
|
json["wWType"] = F("layered buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water charging type
|
// Warm Water charging type
|
||||||
if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWChargeType_, EMS_VALUE_BOOL)) {
|
||||||
output["wWChargeType"] = wWChargeType_ ? F("3-way valve") : F("charge pump");
|
json["wWChargeType"] = wWChargeType_ ? F("3-way valve") : F("charge pump");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water circulation pump available bool
|
// Warm Water circulation pump available bool
|
||||||
if (Helpers::hasValue(wWCircPump_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWCircPump_, EMS_VALUE_BOOL)) {
|
||||||
output["wWCircPump"] = Helpers::render_value(s, wWCircPump_, EMS_VALUE_BOOL);
|
json["wWCircPump"] = Helpers::render_value(s, wWCircPump_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water circulation pump freq
|
// Warm Water circulation pump freq
|
||||||
if (Helpers::hasValue(wWCircPumpMode_)) {
|
if (Helpers::hasValue(wWCircPumpMode_)) {
|
||||||
if (wWCircPumpMode_ == 7) {
|
if (wWCircPumpMode_ == 7) {
|
||||||
output["wWCircPumpMode"] = F("continuous");
|
json["wWCircPumpMode"] = F("continuous");
|
||||||
} else {
|
} else {
|
||||||
char s[7];
|
char s[7];
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
@@ -323,313 +317,313 @@ bool Boiler::export_values_ww(JsonObject & output) {
|
|||||||
buffer[1] = '\0';
|
buffer[1] = '\0';
|
||||||
strlcpy(s, buffer, 7);
|
strlcpy(s, buffer, 7);
|
||||||
strlcat(s, "x3min", 7);
|
strlcat(s, "x3min", 7);
|
||||||
output["wWCircPumpMode"] = s;
|
json["wWCircPumpMode"] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water circulation active bool
|
// Warm Water circulation active bool
|
||||||
if (Helpers::hasValue(wWCirc_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWCirc_, EMS_VALUE_BOOL)) {
|
||||||
output["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
json["wWCirc"] = Helpers::render_value(s, wWCirc_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water current temperature (intern)
|
// Warm Water current temperature (intern)
|
||||||
if (Helpers::hasValue(wWCurTemp_)) {
|
if (Helpers::hasValue(wWCurTemp_)) {
|
||||||
output["wWCurTemp"] = (float)wWCurTemp_ / 10;
|
json["wWCurTemp"] = (float)wWCurTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water current temperature (extern)
|
// Warm Water current temperature (extern)
|
||||||
if (Helpers::hasValue(wWCurTemp2_)) {
|
if (Helpers::hasValue(wWCurTemp2_)) {
|
||||||
output["wWCurTemp2"] = (float)wWCurTemp2_ / 10;
|
json["wWCurTemp2"] = (float)wWCurTemp2_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water current tap water flow l/min
|
// Warm Water current tap water flow l/min
|
||||||
if (Helpers::hasValue(wWCurFlow_)) {
|
if (Helpers::hasValue(wWCurFlow_)) {
|
||||||
output["wWCurFlow"] = (float)wWCurFlow_ / 10;
|
json["wWCurFlow"] = (float)wWCurFlow_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water storage temperature (intern)
|
// Warm water storage temperature (intern)
|
||||||
if (Helpers::hasValue(wwStorageTemp1_)) {
|
if (Helpers::hasValue(wwStorageTemp1_)) {
|
||||||
output["wwStorageTemp1"] = (float)wwStorageTemp1_ / 10;
|
json["wwStorageTemp1"] = (float)wwStorageTemp1_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water storage temperature (extern)
|
// Warm water storage temperature (extern)
|
||||||
if (Helpers::hasValue(wwStorageTemp2_)) {
|
if (Helpers::hasValue(wwStorageTemp2_)) {
|
||||||
output["wwStorageTemp2"] = (float)wwStorageTemp2_ / 10;
|
json["wwStorageTemp2"] = (float)wwStorageTemp2_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water activated bool
|
// Warm Water activated bool
|
||||||
if (Helpers::hasValue(wWActivated_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWActivated_, EMS_VALUE_BOOL)) {
|
||||||
output["wWActivated"] = Helpers::render_value(s, wWActivated_, EMS_VALUE_BOOL);
|
json["wWActivated"] = Helpers::render_value(s, wWActivated_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water one time charging bool
|
// Warm Water one time charging bool
|
||||||
if (Helpers::hasValue(wWOneTime_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWOneTime_, EMS_VALUE_BOOL)) {
|
||||||
output["wWOneTime"] = Helpers::render_value(s, wWOneTime_, EMS_VALUE_BOOL);
|
json["wWOneTime"] = Helpers::render_value(s, wWOneTime_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water disinfecting bool
|
// Warm Water disinfecting bool
|
||||||
if (Helpers::hasValue(wWDisinfecting_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWDisinfecting_, EMS_VALUE_BOOL)) {
|
||||||
output["wWDisinfecting"] = Helpers::render_value(s, wWDisinfecting_, EMS_VALUE_BOOL);
|
json["wWDisinfecting"] = Helpers::render_value(s, wWDisinfecting_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water charging bool
|
// Warm water charging bool
|
||||||
if (Helpers::hasValue(wWCharging_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWCharging_, EMS_VALUE_BOOL)) {
|
||||||
output["wWCharging"] = Helpers::render_value(s, wWCharging_, EMS_VALUE_BOOL);
|
json["wWCharging"] = Helpers::render_value(s, wWCharging_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water recharge bool
|
// Warm water recharge bool
|
||||||
if (Helpers::hasValue(wWRecharging_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWRecharging_, EMS_VALUE_BOOL)) {
|
||||||
output["wWRecharging"] = Helpers::render_value(s, wWRecharging_, EMS_VALUE_BOOL);
|
json["wWRecharging"] = Helpers::render_value(s, wWRecharging_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water temperature ok bool
|
// Warm water temperature ok bool
|
||||||
if (Helpers::hasValue(wWTempOK_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWTempOK_, EMS_VALUE_BOOL)) {
|
||||||
output["wWTempOK"] = Helpers::render_value(s, wWTempOK_, EMS_VALUE_BOOL);
|
json["wWTempOK"] = Helpers::render_value(s, wWTempOK_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water active bool
|
// Warm water active bool
|
||||||
if (Helpers::hasValue(wWActive_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWActive_, EMS_VALUE_BOOL)) {
|
||||||
output["wWActive"] = Helpers::render_value(s, wWActive_, EMS_VALUE_BOOL);
|
json["wWActive"] = Helpers::render_value(s, wWActive_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water charging bool
|
// Warm Water charging bool
|
||||||
if (Helpers::hasValue(wWHeat_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(wWHeat_, EMS_VALUE_BOOL)) {
|
||||||
output["wWHeat"] = Helpers::render_value(s, wWHeat_, EMS_VALUE_BOOL);
|
json["wWHeat"] = Helpers::render_value(s, wWHeat_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water pump set power %
|
// Warm Water pump set power %
|
||||||
if (Helpers::hasValue(wWSetPumpPower_)) {
|
if (Helpers::hasValue(wWSetPumpPower_)) {
|
||||||
output["wWSetPumpPower"] = wWSetPumpPower_;
|
json["wWSetPumpPower"] = wWSetPumpPower_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water mix temperature
|
// Warm water mix temperature
|
||||||
if (Helpers::hasValue(wwMixTemperature_)) {
|
if (Helpers::hasValue(wwMixTemperature_)) {
|
||||||
output["wwMixTemperature"] = wwMixTemperature_;
|
json["wwMixTemperature"] = wwMixTemperature_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm water buffer boiler temperature
|
// Warm water buffer boiler temperature
|
||||||
if (Helpers::hasValue(wwBufferTemperature_)) {
|
if (Helpers::hasValue(wwBufferTemperature_)) {
|
||||||
output["wwBufferTemperature"] = wwBufferTemperature_;
|
json["wwBufferTemperature"] = wwBufferTemperature_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water # starts
|
// Warm Water # starts
|
||||||
if (Helpers::hasValue(wWStarts_)) {
|
if (Helpers::hasValue(wWStarts_)) {
|
||||||
output["wWStarts"] = wWStarts_;
|
json["wWStarts"] = wWStarts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warm Water active time
|
// Warm Water active time
|
||||||
if (Helpers::hasValue(wWWorkM_)) {
|
if (Helpers::hasValue(wWWorkM_)) {
|
||||||
output["wWWorkM"] = wWWorkM_;
|
json["wWWorkM"] = wWWorkM_;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (output.size());
|
return (json.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates JSON doc from values
|
// creates JSON doc from values
|
||||||
// returns false if empty
|
// returns false if empty
|
||||||
bool Boiler::export_values_main(JsonObject & output) {
|
bool Boiler::export_values_main(JsonObject & json) {
|
||||||
char s[10]; // for formatting strings
|
char s[10]; // for formatting strings
|
||||||
|
|
||||||
// Hot tap water bool
|
// Hot tap water bool
|
||||||
if (Helpers::hasValue(heatingActive_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(heatingActive_, EMS_VALUE_BOOL)) {
|
||||||
output["heatingActive"] = Helpers::render_value(s, heatingActive_, EMS_VALUE_BOOL);
|
json["heatingActive"] = Helpers::render_value(s, heatingActive_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Central heating bool
|
// Central heating bool
|
||||||
if (Helpers::hasValue(tapwaterActive_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(tapwaterActive_, EMS_VALUE_BOOL)) {
|
||||||
output["tapwaterActive"] = Helpers::render_value(s, tapwaterActive_, EMS_VALUE_BOOL);
|
json["tapwaterActive"] = Helpers::render_value(s, tapwaterActive_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selected flow temperature deg
|
// Selected flow temperature deg
|
||||||
if (Helpers::hasValue(selFlowTemp_)) {
|
if (Helpers::hasValue(selFlowTemp_)) {
|
||||||
output["selFlowTemp"] = selFlowTemp_;
|
json["selFlowTemp"] = selFlowTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Burner selected max power %
|
// Burner selected max power %
|
||||||
if (Helpers::hasValue(selBurnPow_)) {
|
if (Helpers::hasValue(selBurnPow_)) {
|
||||||
output["selBurnPow"] = selBurnPow_;
|
json["selBurnPow"] = selBurnPow_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Burner current power %
|
// Burner current power %
|
||||||
if (Helpers::hasValue(curBurnPow_)) {
|
if (Helpers::hasValue(curBurnPow_)) {
|
||||||
output["curBurnPow"] = curBurnPow_;
|
json["curBurnPow"] = curBurnPow_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pump modulation %
|
// Pump modulation %
|
||||||
if (Helpers::hasValue(pumpMod_)) {
|
if (Helpers::hasValue(pumpMod_)) {
|
||||||
output["pumpMod"] = pumpMod_;
|
json["pumpMod"] = pumpMod_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heat Pump modulation %
|
// Heat Pump modulation %
|
||||||
if (Helpers::hasValue(pumpMod2_)) {
|
if (Helpers::hasValue(pumpMod2_)) {
|
||||||
output["pumpMod2"] = pumpMod2_;
|
json["pumpMod2"] = pumpMod2_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outside temperature
|
// Outside temperature
|
||||||
if (Helpers::hasValue(outdoorTemp_)) {
|
if (Helpers::hasValue(outdoorTemp_)) {
|
||||||
output["outdoorTemp"] = (float)outdoorTemp_ / 10;
|
json["outdoorTemp"] = (float)outdoorTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current flow temperature
|
// Current flow temperature
|
||||||
if (Helpers::hasValue(curFlowTemp_)) {
|
if (Helpers::hasValue(curFlowTemp_)) {
|
||||||
output["curFlowTemp"] = (float)curFlowTemp_ / 10;
|
json["curFlowTemp"] = (float)curFlowTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return temperature
|
// Return temperature
|
||||||
if (Helpers::hasValue(retTemp_)) {
|
if (Helpers::hasValue(retTemp_)) {
|
||||||
output["retTemp"] = (float)retTemp_ / 10;
|
json["retTemp"] = (float)retTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mixing switch temperature
|
// Mixing switch temperature
|
||||||
if (Helpers::hasValue(switchTemp_)) {
|
if (Helpers::hasValue(switchTemp_)) {
|
||||||
output["switchTemp"] = (float)switchTemp_ / 10;
|
json["switchTemp"] = (float)switchTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// System pressure
|
// System pressure
|
||||||
if (Helpers::hasValue(sysPress_)) {
|
if (Helpers::hasValue(sysPress_)) {
|
||||||
output["sysPress"] = (float)sysPress_ / 10;
|
json["sysPress"] = (float)sysPress_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Max boiler temperature
|
// Max boiler temperature
|
||||||
if (Helpers::hasValue(boilTemp_)) {
|
if (Helpers::hasValue(boilTemp_)) {
|
||||||
output["boilTemp"] = (float)boilTemp_ / 10;
|
json["boilTemp"] = (float)boilTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exhaust temperature
|
// Exhaust temperature
|
||||||
if (Helpers::hasValue(exhaustTemp_)) {
|
if (Helpers::hasValue(exhaustTemp_)) {
|
||||||
output["exhaustTemp"] = (float)exhaustTemp_ / 10;
|
json["exhaustTemp"] = (float)exhaustTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gas bool
|
// Gas bool
|
||||||
if (Helpers::hasValue(burnGas_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(burnGas_, EMS_VALUE_BOOL)) {
|
||||||
output["burnGas"] = Helpers::render_value(s, burnGas_, EMS_VALUE_BOOL);
|
json["burnGas"] = Helpers::render_value(s, burnGas_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flame current uA
|
// Flame current uA
|
||||||
if (Helpers::hasValue(flameCurr_)) {
|
if (Helpers::hasValue(flameCurr_)) {
|
||||||
output["flameCurr"] = (float)(int16_t)flameCurr_ / 10;
|
json["flameCurr"] = (float)(int16_t)flameCurr_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler pump bool
|
// Boiler pump bool
|
||||||
if (Helpers::hasValue(heatPump_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(heatPump_, EMS_VALUE_BOOL)) {
|
||||||
output["heatPump"] = Helpers::render_value(s, heatPump_, EMS_VALUE_BOOL);
|
json["heatPump"] = Helpers::render_value(s, heatPump_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fan bool
|
// Fan bool
|
||||||
if (Helpers::hasValue(fanWork_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(fanWork_, EMS_VALUE_BOOL)) {
|
||||||
output["fanWork"] = Helpers::render_value(s, fanWork_, EMS_VALUE_BOOL);
|
json["fanWork"] = Helpers::render_value(s, fanWork_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignition bool
|
// Ignition bool
|
||||||
if (Helpers::hasValue(ignWork_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(ignWork_, EMS_VALUE_BOOL)) {
|
||||||
output["ignWork"] = Helpers::render_value(s, ignWork_, EMS_VALUE_BOOL);
|
json["ignWork"] = Helpers::render_value(s, ignWork_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// heating activated bool
|
// heating activated bool
|
||||||
if (Helpers::hasValue(heatingActivated_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(heatingActivated_, EMS_VALUE_BOOL)) {
|
||||||
output["heatingActivated"] = Helpers::render_value(s, heatingActivated_, EMS_VALUE_BOOL);
|
json["heatingActivated"] = Helpers::render_value(s, heatingActivated_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heating temperature setting on the boiler
|
// Heating temperature setting on the boiler
|
||||||
if (Helpers::hasValue(heatingTemp_)) {
|
if (Helpers::hasValue(heatingTemp_)) {
|
||||||
output["heatingTemp"] = heatingTemp_;
|
json["heatingTemp"] = heatingTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler circuit pump modulation max power %
|
// Boiler circuit pump modulation max power %
|
||||||
if (Helpers::hasValue(pumpModMax_)) {
|
if (Helpers::hasValue(pumpModMax_)) {
|
||||||
output["pumpModMax"] = pumpModMax_;
|
json["pumpModMax"] = pumpModMax_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler circuit pump modulation min power %
|
// Boiler circuit pump modulation min power %
|
||||||
if (Helpers::hasValue(pumpModMin_)) {
|
if (Helpers::hasValue(pumpModMin_)) {
|
||||||
output["pumpModMin"] = pumpModMin_;
|
json["pumpModMin"] = pumpModMin_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler circuit pump delay time min
|
// Boiler circuit pump delay time min
|
||||||
if (Helpers::hasValue(pumpDelay_)) {
|
if (Helpers::hasValue(pumpDelay_)) {
|
||||||
output["pumpDelay"] = pumpDelay_;
|
json["pumpDelay"] = pumpDelay_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler burner min period min
|
// Boiler burner min period min
|
||||||
if (Helpers::hasValue(burnMinPeriod_)) {
|
if (Helpers::hasValue(burnMinPeriod_)) {
|
||||||
output["burnMinPeriod"] = burnMinPeriod_;
|
json["burnMinPeriod"] = burnMinPeriod_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler burner min power %
|
// Boiler burner min power %
|
||||||
if (Helpers::hasValue(burnMinPower_)) {
|
if (Helpers::hasValue(burnMinPower_)) {
|
||||||
output["burnMinPower"] = burnMinPower_;
|
json["burnMinPower"] = burnMinPower_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler burner max power %
|
// Boiler burner max power %
|
||||||
if (Helpers::hasValue(burnMaxPower_)) {
|
if (Helpers::hasValue(burnMaxPower_)) {
|
||||||
output["burnMaxPower"] = burnMaxPower_;
|
json["burnMaxPower"] = burnMaxPower_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler temp hysteresis on degrees
|
// Boiler temp hysteresis on degrees
|
||||||
if (Helpers::hasValue(boilHystOn_)) {
|
if (Helpers::hasValue(boilHystOn_)) {
|
||||||
output["boilHystOn"] = boilHystOn_;
|
json["boilHystOn"] = boilHystOn_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boiler temp hysteresis off degrees
|
// Boiler temp hysteresis off degrees
|
||||||
if (Helpers::hasValue(boilHystOff_)) {
|
if (Helpers::hasValue(boilHystOff_)) {
|
||||||
output["boilHystOff"] = boilHystOff_;
|
json["boilHystOff"] = boilHystOff_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Flow temperature
|
// Set Flow temperature
|
||||||
if (Helpers::hasValue(setFlowTemp_)) {
|
if (Helpers::hasValue(setFlowTemp_)) {
|
||||||
output["setFlowTemp"] = setFlowTemp_;
|
json["setFlowTemp"] = setFlowTemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total UBA working time
|
// Total UBA working time
|
||||||
if (Helpers::hasValue(UBAuptime_)) {
|
if (Helpers::hasValue(UBAuptime_)) {
|
||||||
output["UBAuptime"] = UBAuptime_;
|
json["UBAuptime"] = UBAuptime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(setBurnPow_)) {
|
if (Helpers::hasValue(setBurnPow_)) {
|
||||||
output["setBurnPow"] = setBurnPow_;
|
json["setBurnPow"] = setBurnPow_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Burner # starts
|
// Burner # starts
|
||||||
if (Helpers::hasValue(burnStarts_)) {
|
if (Helpers::hasValue(burnStarts_)) {
|
||||||
output["burnStarts"] = burnStarts_;
|
json["burnStarts"] = burnStarts_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total burner operating time
|
// Total burner operating time
|
||||||
if (Helpers::hasValue(burnWorkMin_)) {
|
if (Helpers::hasValue(burnWorkMin_)) {
|
||||||
output["burnWorkMin"] = burnWorkMin_;
|
json["burnWorkMin"] = burnWorkMin_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total heat operating time
|
// Total heat operating time
|
||||||
if (Helpers::hasValue(heatWorkMin_)) {
|
if (Helpers::hasValue(heatWorkMin_)) {
|
||||||
output["heatWorkMin"] = heatWorkMin_;
|
json["heatWorkMin"] = heatWorkMin_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service Code
|
// Service Code
|
||||||
// Service Code Number
|
// Service Code Number
|
||||||
if (Helpers::hasValue(serviceCodeNumber_)) {
|
if (Helpers::hasValue(serviceCodeNumber_)) {
|
||||||
output["serviceCode"] = serviceCode_;
|
json["serviceCode"] = serviceCode_;
|
||||||
output["serviceCodeNumber"] = serviceCodeNumber_;
|
json["serviceCodeNumber"] = serviceCodeNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (output.size());
|
return (json.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Boiler::publish_values(JsonObject & data, bool force) {
|
void Boiler::publish_values(JsonObject & json, bool force) {
|
||||||
// handle HA first
|
// handle HA first
|
||||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||||
register_mqtt_ha_config(force);
|
register_mqtt_ha_config(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicJsonDocument doc_main(EMSESP_MAX_JSON_SIZE_LARGE);
|
DynamicJsonDocument doc_main(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject output_main = doc_main.to<JsonObject>();
|
JsonObject json_main = doc_main.to<JsonObject>();
|
||||||
if (export_values_main(output_main)) {
|
if (export_values_main(json_main)) {
|
||||||
Mqtt::publish(F("boiler_data_main"), doc_main.as<JsonObject>());
|
Mqtt::publish(F("boiler_data_main"), doc_main.as<JsonObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicJsonDocument doc_ww(EMSESP_MAX_JSON_SIZE_LARGE);
|
DynamicJsonDocument doc_ww(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject output_ww = doc_ww.to<JsonObject>();
|
JsonObject json_ww = doc_ww.to<JsonObject>();
|
||||||
if (export_values_ww(output_ww)) {
|
if (export_values_ww(json_ww)) {
|
||||||
Mqtt::publish(F("boiler_data_ww"), doc_ww.as<JsonObject>());
|
Mqtt::publish(F("boiler_data_ww"), doc_ww.as<JsonObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,73 +646,73 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values_main(output)) {
|
if (!export_values_main(json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
export_values_ww(output); // append ww values
|
export_values_ww(json); // append ww values
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
|
|
||||||
print_value_json(shell, F("heatingActive"), nullptr, F_(heatingActive), nullptr, output);
|
print_value_json(shell, F("heatingActive"), nullptr, F_(heatingActive), nullptr, json);
|
||||||
print_value_json(shell, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, output);
|
print_value_json(shell, F("tapwaterActive"), nullptr, F_(tapwaterActive), nullptr, json);
|
||||||
print_value_json(shell, F("serviceCode"), nullptr, F_(serviceCode), nullptr, output);
|
print_value_json(shell, F("serviceCode"), nullptr, F_(serviceCode), nullptr, json);
|
||||||
print_value_json(shell, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, output);
|
print_value_json(shell, F("serviceCodeNumber"), nullptr, F_(serviceCodeNumber), nullptr, json);
|
||||||
print_value_json(shell, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), output);
|
print_value_json(shell, F("wWSelTemp"), nullptr, F_(wWSelTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), output);
|
print_value_json(shell, F("wWSetTemp"), nullptr, F_(wWSetTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), output);
|
print_value_json(shell, F("wWDisinfectionTemp"), nullptr, F_(wWDisinfectionTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), output);
|
print_value_json(shell, F("selFlowTemp"), nullptr, F_(selFlowTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), output);
|
print_value_json(shell, F("selBurnPow"), nullptr, F_(selBurnPow), F_(percent), json);
|
||||||
print_value_json(shell, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), output);
|
print_value_json(shell, F("curBurnPow"), nullptr, F_(curBurnPow), F_(percent), json);
|
||||||
print_value_json(shell, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), output);
|
print_value_json(shell, F("pumpMod"), nullptr, F_(pumpMod), F_(percent), json);
|
||||||
print_value_json(shell, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), output);
|
print_value_json(shell, F("pumpMod2"), nullptr, F_(pumpMod2), F_(percent), json);
|
||||||
print_value_json(shell, F("wWType"), nullptr, F_(wWType), nullptr, output);
|
print_value_json(shell, F("wWType"), nullptr, F_(wWType), nullptr, json);
|
||||||
print_value_json(shell, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, output);
|
print_value_json(shell, F("wWChargeType"), nullptr, F_(wWChargeType), nullptr, json);
|
||||||
print_value_json(shell, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, output);
|
print_value_json(shell, F("wWCircPump"), nullptr, F_(wWCircPump), nullptr, json);
|
||||||
print_value_json(shell, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, output);
|
print_value_json(shell, F("wWCircPumpMode"), nullptr, F_(wWCircPumpMode), nullptr, json);
|
||||||
print_value_json(shell, F("wWCirc"), nullptr, F_(wWCirc), nullptr, output);
|
print_value_json(shell, F("wWCirc"), nullptr, F_(wWCirc), nullptr, json);
|
||||||
print_value_json(shell, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), output);
|
print_value_json(shell, F("outdoorTemp"), nullptr, F_(outdoorTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), output);
|
print_value_json(shell, F("wWCurTemp"), nullptr, F_(wWCurTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), output);
|
print_value_json(shell, F("wWCurTemp2"), nullptr, F_(wWCurTemp2), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), output);
|
print_value_json(shell, F("wWCurFlow"), nullptr, F_(wWCurFlow), F("l/min"), json);
|
||||||
print_value_json(shell, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), output);
|
print_value_json(shell, F("curFlowTemp"), nullptr, F_(curFlowTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("retTemp"), nullptr, F_(retTemp), F_(degrees), output);
|
print_value_json(shell, F("retTemp"), nullptr, F_(retTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), output);
|
print_value_json(shell, F("switchTemp"), nullptr, F_(switchTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("sysPress"), nullptr, F_(sysPress), nullptr, output);
|
print_value_json(shell, F("sysPress"), nullptr, F_(sysPress), nullptr, json);
|
||||||
print_value_json(shell, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), output);
|
print_value_json(shell, F("boilTemp"), nullptr, F_(boilTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), output);
|
print_value_json(shell, F("wwStorageTemp1"), nullptr, F_(wwStorageTemp1), F_(degrees), json);
|
||||||
print_value_json(shell, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), output);
|
print_value_json(shell, F("wwStorageTemp2"), nullptr, F_(wwStorageTemp2), F_(degrees), json);
|
||||||
print_value_json(shell, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), output);
|
print_value_json(shell, F("exhaustTemp"), nullptr, F_(exhaustTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWActivated"), nullptr, F_(wWActivated), nullptr, output);
|
print_value_json(shell, F("wWActivated"), nullptr, F_(wWActivated), nullptr, json);
|
||||||
print_value_json(shell, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, output);
|
print_value_json(shell, F("wWOneTime"), nullptr, F_(wWOneTime), nullptr, json);
|
||||||
print_value_json(shell, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, output);
|
print_value_json(shell, F("wWDisinfecting"), nullptr, F_(wWDisinfecting), nullptr, json);
|
||||||
print_value_json(shell, F("wWCharging"), nullptr, F_(wWCharging), nullptr, output);
|
print_value_json(shell, F("wWCharging"), nullptr, F_(wWCharging), nullptr, json);
|
||||||
print_value_json(shell, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, output);
|
print_value_json(shell, F("wWRecharging"), nullptr, F_(wWRecharging), nullptr, json);
|
||||||
print_value_json(shell, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, output);
|
print_value_json(shell, F("wWTempOK"), nullptr, F_(wWTempOK), nullptr, json);
|
||||||
print_value_json(shell, F("wWActive"), nullptr, F_(wWActive), nullptr, output);
|
print_value_json(shell, F("wWActive"), nullptr, F_(wWActive), nullptr, json);
|
||||||
print_value_json(shell, F("burnGas"), nullptr, F_(burnGas), nullptr, output);
|
print_value_json(shell, F("burnGas"), nullptr, F_(burnGas), nullptr, json);
|
||||||
print_value_json(shell, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), output);
|
print_value_json(shell, F("flameCurr"), nullptr, F_(flameCurr), F_(uA), json);
|
||||||
print_value_json(shell, F("heatPump"), nullptr, F_(heatPump), nullptr, output);
|
print_value_json(shell, F("heatPump"), nullptr, F_(heatPump), nullptr, json);
|
||||||
print_value_json(shell, F("fanWork"), nullptr, F_(fanWork), nullptr, output);
|
print_value_json(shell, F("fanWork"), nullptr, F_(fanWork), nullptr, json);
|
||||||
print_value_json(shell, F("ignWork"), nullptr, F_(ignWork), nullptr, output);
|
print_value_json(shell, F("ignWork"), nullptr, F_(ignWork), nullptr, json);
|
||||||
print_value_json(shell, F("wWHeat"), nullptr, F_(wWHeat), nullptr, output);
|
print_value_json(shell, F("wWHeat"), nullptr, F_(wWHeat), nullptr, json);
|
||||||
print_value_json(shell, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, output);
|
print_value_json(shell, F("heatingActivated"), nullptr, F_(heatingActivated), nullptr, json);
|
||||||
print_value_json(shell, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), output);
|
print_value_json(shell, F("heatingTemp"), nullptr, F_(heatingTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), output);
|
print_value_json(shell, F("pumpModMax"), nullptr, F_(pumpModMax), F_(percent), json);
|
||||||
print_value_json(shell, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), output);
|
print_value_json(shell, F("pumpModMin"), nullptr, F_(pumpModMin), F_(percent), json);
|
||||||
print_value_json(shell, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), output);
|
print_value_json(shell, F("pumpDelay"), nullptr, F_(pumpDelay), F_(min), json);
|
||||||
print_value_json(shell, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), output);
|
print_value_json(shell, F("burnMinPeriod"), nullptr, F_(burnMinPeriod), F_(min), json);
|
||||||
print_value_json(shell, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), output);
|
print_value_json(shell, F("burnMinPower"), nullptr, F_(burnMinPower), F_(percent), json);
|
||||||
print_value_json(shell, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), output);
|
print_value_json(shell, F("burnMaxPower"), nullptr, F_(burnMaxPower), F_(percent), json);
|
||||||
print_value_json(shell, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), output);
|
print_value_json(shell, F("boilHystOn"), nullptr, F_(boilHystOn), F_(degrees), json);
|
||||||
print_value_json(shell, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), output);
|
print_value_json(shell, F("boilHystOff"), nullptr, F_(boilHystOff), F_(degrees), json);
|
||||||
print_value_json(shell, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), output);
|
print_value_json(shell, F("setFlowTemp"), nullptr, F_(setFlowTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), output);
|
print_value_json(shell, F("wWSetPumpPower"), nullptr, F_(wWSetPumpPower), F_(percent), json);
|
||||||
print_value_json(shell, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), output);
|
print_value_json(shell, F("wwMixTemperature"), nullptr, F_(wwMixTemperature), F_(degrees), json);
|
||||||
print_value_json(shell, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), output);
|
print_value_json(shell, F("wwBufferTemperature"), nullptr, F_(wwBufferTemperature), F_(degrees), json);
|
||||||
print_value_json(shell, F("wWStarts"), nullptr, F_(wWStarts), nullptr, output);
|
print_value_json(shell, F("wWStarts"), nullptr, F_(wWStarts), nullptr, json);
|
||||||
print_value_json(shell, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, output);
|
print_value_json(shell, F("wWWorkM"), nullptr, F_(wWWorkM), nullptr, json);
|
||||||
print_value_json(shell, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), output);
|
print_value_json(shell, F("setBurnPow"), nullptr, F_(setBurnPow), F_(percent), json);
|
||||||
print_value_json(shell, F("burnStarts"), nullptr, F_(burnStarts), nullptr, output);
|
print_value_json(shell, F("burnStarts"), nullptr, F_(burnStarts), nullptr, json);
|
||||||
|
|
||||||
if (Helpers::hasValue(wWWorkM_)) {
|
if (Helpers::hasValue(wWWorkM_)) {
|
||||||
shell.printfln(F(" Warm Water active time: %d days %d hours %d minutes"), wWWorkM_ / 1440, (wWWorkM_ % 1440) / 60, wWWorkM_ % 60);
|
shell.printfln(F(" Warm Water active time: %d days %d hours %d minutes"), wWWorkM_ / 1440, (wWWorkM_ % 1440) / 60, wWWorkM_ % 60);
|
||||||
@@ -1013,7 +1007,7 @@ void Boiler::process_UBAOutdoorTemp(std::shared_ptr<const Telegram> telegram) {
|
|||||||
// UBASetPoint 0x1A
|
// UBASetPoint 0x1A
|
||||||
void Boiler::process_UBASetPoints(std::shared_ptr<const Telegram> telegram) {
|
void Boiler::process_UBASetPoints(std::shared_ptr<const Telegram> telegram) {
|
||||||
changed_ |= telegram->read_value(setFlowTemp_, 0); // boiler set temp from thermostat
|
changed_ |= telegram->read_value(setFlowTemp_, 0); // boiler set temp from thermostat
|
||||||
changed_ |= telegram->read_value(setBurnPow_, 1); // max output power in %
|
changed_ |= telegram->read_value(setBurnPow_, 1); // max json power in %
|
||||||
changed_ |= telegram->read_value(wWSetPumpPower_, 2); // ww pump speed/power?
|
changed_ |= telegram->read_value(wWSetPumpPower_, 2); // ww pump speed/power?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ class Boiler : public EMSdevice {
|
|||||||
Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
@@ -147,8 +148,6 @@ class Boiler : public EMSdevice {
|
|||||||
uint8_t heatingActive_ = EMS_VALUE_BOOL_NOTSET; // Central heating is on/off
|
uint8_t heatingActive_ = EMS_VALUE_BOOL_NOTSET; // Central heating is on/off
|
||||||
uint8_t pumpMod2_ = EMS_VALUE_UINT_NOTSET; // heatpump modulation from 0xE3 (heatpumps)
|
uint8_t pumpMod2_ = EMS_VALUE_UINT_NOTSET; // heatpump modulation from 0xE3 (heatpumps)
|
||||||
|
|
||||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
|
||||||
|
|
||||||
void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram);
|
void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram);
|
void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_UBATotalUptime(std::shared_ptr<const Telegram> telegram);
|
void process_UBATotalUptime(std::shared_ptr<const Telegram> telegram);
|
||||||
|
|||||||
@@ -37,7 +37,12 @@ void Connect::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Connect::publish_values(JsonObject & data, bool force) {
|
void Connect::publish_values(JsonObject & json, bool force) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// export values to JSON
|
||||||
|
bool Connect::export_values(JsonObject & json) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if values have been updated
|
// check to see if values have been updated
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ class Connect : public EMSdevice {
|
|||||||
Connect(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Connect(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,12 @@ void Controller::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Controller::publish_values(JsonObject & data, bool force) {
|
void Controller::publish_values(JsonObject & json, bool force) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// export values to JSON
|
||||||
|
bool Controller::export_values(JsonObject & json) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if values have been updated
|
// check to see if values have been updated
|
||||||
|
|||||||
@@ -36,13 +36,13 @@ class Controller : public EMSdevice {
|
|||||||
Controller(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Controller(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -37,7 +37,12 @@ void Gateway::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Gateway::publish_values(JsonObject & data, bool force) {
|
void Gateway::publish_values(JsonObject & json, bool force) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// export values to JSON
|
||||||
|
bool Gateway::export_values(JsonObject & json) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if values have been updated
|
// check to see if values have been updated
|
||||||
|
|||||||
@@ -36,13 +36,13 @@ class Gateway : public EMSdevice {
|
|||||||
Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -37,7 +37,12 @@ void Generic::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Generic::publish_values(JsonObject & data, bool force) {
|
void Generic::publish_values(JsonObject & json, bool force) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// export values to JSON
|
||||||
|
bool Generic::export_values(JsonObject & json) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if values have been updated
|
// check to see if values have been updated
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ class Generic : public EMSdevice {
|
|||||||
Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
|
|||||||
@@ -31,41 +31,32 @@ Heatpump::Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, c
|
|||||||
// telegram handlers
|
// telegram handlers
|
||||||
register_telegram_type(0x042B, F("HP1"), true, [&](std::shared_ptr<const Telegram> t) { process_HPMonitor1(t); });
|
register_telegram_type(0x042B, F("HP1"), true, [&](std::shared_ptr<const Telegram> t) { process_HPMonitor1(t); });
|
||||||
register_telegram_type(0x047B, F("HP2"), true, [&](std::shared_ptr<const Telegram> t) { process_HPMonitor2(t); });
|
register_telegram_type(0x047B, F("HP2"), true, [&](std::shared_ptr<const Telegram> t) { process_HPMonitor2(t); });
|
||||||
|
|
||||||
// API call
|
|
||||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
|
||||||
return command_info(value, id, object);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Heatpump::command_info(const char * value, const int8_t id, JsonObject & output) {
|
|
||||||
return (export_values(output));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates JSON doc from values
|
// creates JSON doc from values
|
||||||
// returns false if empty
|
// returns false if empty
|
||||||
bool Heatpump::export_values(JsonObject & output) {
|
bool Heatpump::export_values(JsonObject & json) {
|
||||||
if (Helpers::hasValue(airHumidity_)) {
|
if (Helpers::hasValue(airHumidity_)) {
|
||||||
output["airHumidity"] = (float)airHumidity_ / 2;
|
json["airHumidity"] = (float)airHumidity_ / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(dewTemperature_)) {
|
if (Helpers::hasValue(dewTemperature_)) {
|
||||||
output["dewTemperature"] = dewTemperature_;
|
json["dewTemperature"] = dewTemperature_;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.size();
|
return json.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Heatpump::device_info_web(JsonArray & root) {
|
void Heatpump::device_info_web(JsonArray & root) {
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values(output)) {
|
if (!export_values(json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
|
|
||||||
print_value_json(root, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), output);
|
print_value_json(root, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), json);
|
||||||
print_value_json(root, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), output);
|
print_value_json(root, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
// display all values into the shell console
|
// display all values into the shell console
|
||||||
@@ -74,25 +65,25 @@ void Heatpump::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values(output)) {
|
if (!export_values(json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
|
|
||||||
print_value_json(shell, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), output);
|
print_value_json(shell, F("airHumidity"), nullptr, F_(airHumidity), F_(percent), json);
|
||||||
print_value_json(shell, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), output);
|
print_value_json(shell, F("dewTemperature"), nullptr, F_(dewTemperature), F_(degrees), json);
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Heatpump::publish_values(JsonObject & data, bool force) {
|
void Heatpump::publish_values(JsonObject & json, bool force) {
|
||||||
// handle HA first
|
// handle HA first
|
||||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||||
register_mqtt_ha_config(force);
|
register_mqtt_ha_config(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json_data = doc.to<JsonObject>();
|
||||||
if (export_values(output)) {
|
if (export_values(json_data)) {
|
||||||
Mqtt::publish(F("heatpump_data"), doc.as<JsonObject>());
|
Mqtt::publish(F("heatpump_data"), doc.as<JsonObject>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,15 +37,14 @@ class Heatpump : public EMSdevice {
|
|||||||
Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
|
|
||||||
bool export_values(JsonObject & doc);
|
|
||||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
|
||||||
void register_mqtt_ha_config(bool force);
|
void register_mqtt_ha_config(bool force);
|
||||||
|
|
||||||
uint8_t airHumidity_ = EMS_VALUE_UINT_NOTSET;
|
uint8_t airHumidity_ = EMS_VALUE_UINT_NOTSET;
|
||||||
|
|||||||
@@ -53,11 +53,6 @@ Mixing::Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const
|
|||||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_IPM) {
|
if (flags == EMSdevice::EMS_DEVICE_FLAG_IPM) {
|
||||||
register_telegram_type(0x010C, F("IPMSetMessage"), false, [&](std::shared_ptr<const Telegram> t) { process_IPMStatusMessage(t); });
|
register_telegram_type(0x010C, F("IPMSetMessage"), false, [&](std::shared_ptr<const Telegram> t) { process_IPMStatusMessage(t); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// API call
|
|
||||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
|
||||||
return command_info(value, id, object);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// output json to web UI
|
// output json to web UI
|
||||||
@@ -68,23 +63,23 @@ void Mixing::device_info_web(JsonArray & root) {
|
|||||||
|
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values(Mqtt::Format::SINGLE, output)) {
|
if (!export_values_format(Mqtt::Format::SINGLE, json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
|
|
||||||
char prefix_str[10];
|
char prefix_str[10];
|
||||||
if (type() == Type::HC) {
|
if (type() == Type::HC) {
|
||||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), hc_);
|
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), hc_);
|
||||||
print_value_json(root, F("flowTemp"), FPSTR(prefix_str), F_(flowTemp), F_(degrees), output);
|
print_value_json(root, F("flowTemp"), FPSTR(prefix_str), F_(flowTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("flowSetTemp"), FPSTR(prefix_str), F_(flowSetTemp), F_(degrees), output);
|
print_value_json(root, F("flowSetTemp"), FPSTR(prefix_str), F_(flowSetTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, output);
|
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, json);
|
||||||
print_value_json(root, F("valveStatus"), FPSTR(prefix_str), F_(valveStatus), F_(percent), output);
|
print_value_json(root, F("valveStatus"), FPSTR(prefix_str), F_(valveStatus), F_(percent), json);
|
||||||
} else {
|
} else {
|
||||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(wwc %d) "), hc_);
|
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(wwc %d) "), hc_);
|
||||||
print_value_json(root, F("wwTemp"), FPSTR(prefix_str), F_(wwTemp), F_(degrees), output);
|
print_value_json(root, F("wwTemp"), FPSTR(prefix_str), F_(wwTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, output);
|
print_value_json(root, F("pumpStatus"), FPSTR(prefix_str), F_(pumpStatus), nullptr, json);
|
||||||
print_value_json(root, F("tempStatus"), FPSTR(prefix_str), F_(tempStatus), nullptr, output);
|
print_value_json(root, F("tempStatus"), FPSTR(prefix_str), F_(tempStatus), nullptr, json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,38 +102,30 @@ void Mixing::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values(Mqtt::Format::SINGLE, output)) {
|
if (!export_values_format(Mqtt::Format::SINGLE, json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type() == Type::HC) {
|
if (type() == Type::HC) {
|
||||||
shell.printfln(F_(hc), hc_);
|
shell.printfln(F_(hc), hc_);
|
||||||
print_value_json(shell, F("flowTemp"), F_(2spaces), F_(flowTemp), F_(degrees), output);
|
print_value_json(shell, F("flowTemp"), F_(2spaces), F_(flowTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("flowSetTemp"), F_(2spaces), F_(flowSetTemp), F_(degrees), output);
|
print_value_json(shell, F("flowSetTemp"), F_(2spaces), F_(flowSetTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, output);
|
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, json);
|
||||||
print_value_json(shell, F("valveStatus"), F_(2spaces), F_(valveStatus), F_(percent), output);
|
print_value_json(shell, F("valveStatus"), F_(2spaces), F_(valveStatus), F_(percent), json);
|
||||||
} else {
|
} else {
|
||||||
shell.printfln(F_(ww_hc), hc_);
|
shell.printfln(F_(ww_hc), hc_);
|
||||||
print_value_json(shell, F("wwTemp"), F_(2spaces), F_(wwTemp), F_(degrees), output);
|
print_value_json(shell, F("wwTemp"), F_(2spaces), F_(wwTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, output);
|
print_value_json(shell, F("pumpStatus"), F_(2spaces), F_(pumpStatus), nullptr, json);
|
||||||
print_value_json(shell, F("tempStatus"), F_(2spaces), F_(tempStatus), nullptr, output);
|
print_value_json(shell, F("tempStatus"), F_(2spaces), F_(tempStatus), nullptr, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.println();
|
shell.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
// export all values to info command
|
|
||||||
bool Mixing::command_info(const char * value, const int8_t id, JsonObject & output) {
|
|
||||||
if (id != (device_id() - 0x20 + 1) && id > 0) { // defaults to first hc if no id
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (export_values(Mqtt::Format::NESTED, output));
|
|
||||||
}
|
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
// topic is mixing_data<id>
|
// topic is mixing_data<id>
|
||||||
void Mixing::publish_values(JsonObject & data, bool force) {
|
void Mixing::publish_values(JsonObject & json, bool force) {
|
||||||
// handle HA first
|
// handle HA first
|
||||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||||
register_mqtt_ha_config(force);
|
register_mqtt_ha_config(force);
|
||||||
@@ -146,8 +133,8 @@ void Mixing::publish_values(JsonObject & data, bool force) {
|
|||||||
|
|
||||||
if (Mqtt::mqtt_format() == Mqtt::Format::SINGLE) {
|
if (Mqtt::mqtt_format() == Mqtt::Format::SINGLE) {
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (export_values(Mqtt::mqtt_format(), output)) {
|
if (export_values_format(Mqtt::mqtt_format(), json)) {
|
||||||
char topic[30];
|
char topic[30];
|
||||||
char s[5];
|
char s[5];
|
||||||
strlcpy(topic, "mixing_data", 30);
|
strlcpy(topic, "mixing_data", 30);
|
||||||
@@ -156,7 +143,7 @@ void Mixing::publish_values(JsonObject & data, bool force) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// format is HA or Nested. This is bundled together and sent in emsesp.cpp
|
// format is HA or Nested. This is bundled together and sent in emsesp.cpp
|
||||||
(void)export_values(Mqtt::mqtt_format(), data);
|
export_values_format(Mqtt::mqtt_format(), json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,16 +157,22 @@ void Mixing::register_mqtt_ha_config(bool force) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we don't have valid values for this HC don't add it ever again
|
||||||
|
if (!Helpers::hasValue(status_)) {
|
||||||
|
mqtt_ha_config_ = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the Master device
|
// Create the Master device
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
|
|
||||||
char str1[20];
|
char name[20];
|
||||||
snprintf_P(str1, sizeof(str1), PSTR("Mixing %d"), device_id() - 0x20 + 1);
|
snprintf_P(name, sizeof(name), PSTR("Mixing %02X"), device_id() - 0x20 + 1);
|
||||||
doc["name"] = str1;
|
doc["name"] = name;
|
||||||
|
|
||||||
char str2[20];
|
char uniq_id[20];
|
||||||
snprintf_P(str2, sizeof(str2), PSTR("mixing %d"), device_id() - 0x20 + 1);
|
snprintf_P(uniq_id, sizeof(uniq_id), PSTR("mixing%02X"), device_id() - 0x20 + 1);
|
||||||
doc["uniq_id"] = str2;
|
doc["uniq_id"] = uniq_id;
|
||||||
|
|
||||||
doc["ic"] = F("mdi:home-thermometer-outline");
|
doc["ic"] = F("mdi:home-thermometer-outline");
|
||||||
|
|
||||||
@@ -188,6 +181,7 @@ void Mixing::register_mqtt_ha_config(bool force) {
|
|||||||
doc["stat_t"] = stat_t;
|
doc["stat_t"] = stat_t;
|
||||||
|
|
||||||
doc["val_tpl"] = F("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc
|
doc["val_tpl"] = F("{{value_json.type}}"); // HA needs a single value. We take the type which is wwc or hc
|
||||||
|
|
||||||
JsonObject dev = doc.createNestedObject("dev");
|
JsonObject dev = doc.createNestedObject("dev");
|
||||||
dev["name"] = F("EMS-ESP Mixing");
|
dev["name"] = F("EMS-ESP Mixing");
|
||||||
dev["sw"] = EMSESP_APP_VERSION;
|
dev["sw"] = EMSESP_APP_VERSION;
|
||||||
@@ -220,54 +214,72 @@ void Mixing::register_mqtt_ha_config(bool force) {
|
|||||||
mqtt_ha_config_ = true; // done
|
mqtt_ha_config_ = true; // done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Mixing::export_values(JsonObject & json) {
|
||||||
|
return export_values_format(Mqtt::Format::NESTED, json);
|
||||||
|
}
|
||||||
|
|
||||||
// creates JSON doc from values
|
// creates JSON doc from values
|
||||||
// returns false if empty
|
// returns false if empty
|
||||||
bool Mixing::export_values(uint8_t mqtt_format, JsonObject & output) {
|
bool Mixing::export_values_format(uint8_t mqtt_format, JsonObject & json) {
|
||||||
JsonObject output_hc;
|
// check if there is data for the mixing unit
|
||||||
|
if (!Helpers::hasValue(status_)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonObject json_hc;
|
||||||
char hc_name[10]; // hc{1-4}
|
char hc_name[10]; // hc{1-4}
|
||||||
|
|
||||||
if (this->type() == Type::HC) {
|
if (this->type() == Type::HC) {
|
||||||
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
|
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc_);
|
||||||
if (mqtt_format == Mqtt::Format::NESTED || mqtt_format == Mqtt::Format::HA) {
|
if (mqtt_format == Mqtt::Format::NESTED) {
|
||||||
output_hc = output.createNestedObject(hc_name);
|
json_hc = json.createNestedObject(hc_name);
|
||||||
|
} else if (mqtt_format == Mqtt::Format::HA) {
|
||||||
|
json_hc = json.createNestedObject(hc_name);
|
||||||
|
json_hc["type"] = F("hc");
|
||||||
} else {
|
} else {
|
||||||
output_hc = output;
|
json_hc = json;
|
||||||
output["type"] = F("hc");
|
json["type"] = F("hc");
|
||||||
}
|
}
|
||||||
if (Helpers::hasValue(flowTemp_)) {
|
if (Helpers::hasValue(flowTemp_)) {
|
||||||
output_hc["flowTemp"] = (float)flowTemp_ / 10;
|
json_hc["flowTemp"] = (float)flowTemp_ / 10;
|
||||||
}
|
}
|
||||||
if (Helpers::hasValue(flowSetTemp_)) {
|
if (Helpers::hasValue(flowSetTemp_)) {
|
||||||
output_hc["flowSetTemp"] = flowSetTemp_;
|
json_hc["flowSetTemp"] = flowSetTemp_;
|
||||||
}
|
}
|
||||||
if (Helpers::hasValue(pumpStatus_)) {
|
if (Helpers::hasValue(pumpStatus_)) {
|
||||||
char s[5];
|
char s[5];
|
||||||
output_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
json_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
if (Helpers::hasValue(status_)) {
|
if (Helpers::hasValue(status_)) {
|
||||||
output_hc["valveStatus"] = status_;
|
json_hc["valveStatus"] = status_;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_);
|
|
||||||
if (mqtt_format == Mqtt::Format::NESTED || mqtt_format == Mqtt::Format::HA) {
|
|
||||||
output_hc = output.createNestedObject(hc_name);
|
|
||||||
} else {
|
|
||||||
output_hc = output;
|
|
||||||
output["type"] = F("wwc");
|
|
||||||
}
|
|
||||||
if (Helpers::hasValue(flowTemp_)) {
|
|
||||||
output_hc["wwTemp"] = (float)flowTemp_ / 10;
|
|
||||||
}
|
|
||||||
if (Helpers::hasValue(pumpStatus_)) {
|
|
||||||
char s[5];
|
|
||||||
output_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
|
||||||
}
|
|
||||||
if (Helpers::hasValue(status_)) {
|
|
||||||
output_hc["tempStatus"] = status_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return json_hc.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.size();
|
// WWC
|
||||||
|
snprintf_P(hc_name, sizeof(hc_name), PSTR("wwc%d"), hc_);
|
||||||
|
if (mqtt_format == Mqtt::Format::NESTED) {
|
||||||
|
json_hc = json.createNestedObject(hc_name);
|
||||||
|
} else if (mqtt_format == Mqtt::Format::HA) {
|
||||||
|
json_hc = json.createNestedObject(hc_name);
|
||||||
|
json_hc["type"] = F("wwc");
|
||||||
|
} else {
|
||||||
|
json_hc = json;
|
||||||
|
json["type"] = F("wwc");
|
||||||
|
}
|
||||||
|
if (Helpers::hasValue(flowTemp_)) {
|
||||||
|
json_hc["wwTemp"] = (float)flowTemp_ / 10;
|
||||||
|
}
|
||||||
|
if (Helpers::hasValue(pumpStatus_)) {
|
||||||
|
char s[5];
|
||||||
|
json_hc["pumpStatus"] = Helpers::render_value(s, pumpStatus_, EMS_VALUE_BOOL);
|
||||||
|
}
|
||||||
|
if (Helpers::hasValue(status_)) {
|
||||||
|
json_hc["tempStatus"] = status_;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_hc.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// heating circuits 0x02D7, 0x02D8 etc...
|
// heating circuits 0x02D7, 0x02D8 etc...
|
||||||
@@ -298,14 +310,17 @@ void Mixing::process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> tel
|
|||||||
// A1 00 FF 00 00 0C 02 04 00 01 1D 00 82
|
// A1 00 FF 00 00 0C 02 04 00 01 1D 00 82
|
||||||
void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram) {
|
void Mixing::process_IPMStatusMessage(std::shared_ptr<const Telegram> telegram) {
|
||||||
type(Type::HC);
|
type(Type::HC);
|
||||||
hc_ = device_id() - 0x20 + 1;
|
hc_ = device_id() - 0x20 + 1;
|
||||||
|
|
||||||
|
// check if circuit is active, 0-off, 1-unmixed, 2-mixed
|
||||||
uint8_t ismixed = 0;
|
uint8_t ismixed = 0;
|
||||||
changed_ |= telegram->read_value(ismixed, 0); // check if circuit is active, 0-off, 1-unmixed, 2-mixed
|
changed_ |= telegram->read_value(ismixed, 0);
|
||||||
if (ismixed == 0) {
|
if (ismixed == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ismixed == 2) { // we have a mixed circuit
|
// do we have a mixed circuit
|
||||||
|
if (ismixed == 2) {
|
||||||
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
|
changed_ |= telegram->read_value(flowTemp_, 3); // is * 10
|
||||||
changed_ |= telegram->read_value(flowSetTemp_, 5);
|
changed_ |= telegram->read_value(flowSetTemp_, 5);
|
||||||
changed_ |= telegram->read_value(status_, 2); // valve status
|
changed_ |= telegram->read_value(status_, 2); // valve status
|
||||||
|
|||||||
@@ -37,16 +37,16 @@ class Mixing : public EMSdevice {
|
|||||||
Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
|
|
||||||
bool export_values(uint8_t mqtt_format, JsonObject & doc);
|
bool export_values_format(uint8_t mqtt_format, JsonObject & doc);
|
||||||
void register_mqtt_ha_config(bool force);
|
void register_mqtt_ha_config(bool force);
|
||||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
|
||||||
|
|
||||||
void process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram);
|
void process_MMPLUSStatusMessage_HC(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram);
|
void process_MMPLUSStatusMessage_WWC(std::shared_ptr<const Telegram> telegram);
|
||||||
@@ -73,9 +73,10 @@ class Mixing : public EMSdevice {
|
|||||||
uint16_t hc_ = EMS_VALUE_USHORT_NOTSET;
|
uint16_t hc_ = EMS_VALUE_USHORT_NOTSET;
|
||||||
uint16_t flowTemp_ = EMS_VALUE_USHORT_NOTSET;
|
uint16_t flowTemp_ = EMS_VALUE_USHORT_NOTSET;
|
||||||
uint8_t pumpStatus_ = EMS_VALUE_UINT_NOTSET;
|
uint8_t pumpStatus_ = EMS_VALUE_UINT_NOTSET;
|
||||||
int8_t status_ = EMS_VALUE_UINT_NOTSET;
|
uint8_t status_ = EMS_VALUE_UINT_NOTSET;
|
||||||
uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET;
|
uint8_t flowSetTemp_ = EMS_VALUE_UINT_NOTSET;
|
||||||
Type type_ = Type::NONE;
|
|
||||||
|
Type type_ = Type::NONE;
|
||||||
|
|
||||||
bool changed_ = false;
|
bool changed_ = false;
|
||||||
bool mqtt_ha_config_ = false; // for HA MQTT Discovery
|
bool mqtt_ha_config_ = false; // for HA MQTT Discovery
|
||||||
|
|||||||
@@ -52,39 +52,30 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s
|
|||||||
register_telegram_type(0x0103, F("ISM1StatusMessage"), true, [&](std::shared_ptr<const Telegram> t) { process_ISM1StatusMessage(t); });
|
register_telegram_type(0x0103, F("ISM1StatusMessage"), true, [&](std::shared_ptr<const Telegram> t) { process_ISM1StatusMessage(t); });
|
||||||
register_telegram_type(0x0101, F("ISM1Set"), false, [&](std::shared_ptr<const Telegram> t) { process_ISM1Set(t); });
|
register_telegram_type(0x0101, F("ISM1Set"), false, [&](std::shared_ptr<const Telegram> t) { process_ISM1Set(t); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// API call
|
|
||||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
|
||||||
return command_info(value, id, object);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Solar::command_info(const char * value, const int8_t id, JsonObject & output) {
|
|
||||||
return (export_values(output));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// print to web
|
// print to web
|
||||||
void Solar::device_info_web(JsonArray & root) {
|
void Solar::device_info_web(JsonArray & root) {
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values(output)) {
|
if (!export_values(json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
|
|
||||||
print_value_json(root, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), output);
|
print_value_json(root, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), output);
|
print_value_json(root, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), output);
|
print_value_json(root, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), json);
|
||||||
print_value_json(root, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), output);
|
print_value_json(root, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), json);
|
||||||
print_value_json(root, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), output);
|
print_value_json(root, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), json);
|
||||||
print_value_json(root, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), output);
|
print_value_json(root, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), json);
|
||||||
print_value_json(root, F("valveStatus"), nullptr, F_(valveStatus), nullptr, output);
|
print_value_json(root, F("valveStatus"), nullptr, F_(valveStatus), nullptr, json);
|
||||||
print_value_json(root, F("solarPump"), nullptr, F_(solarPump), nullptr, output);
|
print_value_json(root, F("solarPump"), nullptr, F_(solarPump), nullptr, json);
|
||||||
print_value_json(root, F("tankHeated"), nullptr, F_(tankHeated), nullptr, output);
|
print_value_json(root, F("tankHeated"), nullptr, F_(tankHeated), nullptr, json);
|
||||||
print_value_json(root, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, output);
|
print_value_json(root, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, json);
|
||||||
print_value_json(root, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), output);
|
print_value_json(root, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), json);
|
||||||
print_value_json(root, F("energyToday"), nullptr, F_(energyToday), F_(wh), output);
|
print_value_json(root, F("energyToday"), nullptr, F_(energyToday), F_(wh), json);
|
||||||
print_value_json(root, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), output);
|
print_value_json(root, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), json);
|
||||||
|
|
||||||
if (Helpers::hasValue(pumpWorkMin_)) {
|
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||||
JsonObject dataElement = root.createNestedObject();
|
JsonObject dataElement = root.createNestedObject();
|
||||||
@@ -101,24 +92,24 @@ void Solar::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
// fetch the values into a JSON document
|
// fetch the values into a JSON document
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
if (!export_values(output)) {
|
if (!export_values(json)) {
|
||||||
return; // empty
|
return; // empty
|
||||||
}
|
}
|
||||||
|
|
||||||
print_value_json(shell, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), output);
|
print_value_json(shell, F("collectorTemp"), nullptr, F_(collectorTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), output);
|
print_value_json(shell, F("tankBottomTemp"), nullptr, F_(tankBottomTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), output);
|
print_value_json(shell, F("tankBottomTemp2"), nullptr, F_(tankBottomTemp2), F_(degrees), json);
|
||||||
print_value_json(shell, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), output);
|
print_value_json(shell, F("heatExchangerTemp"), nullptr, F_(heatExchangerTemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), output);
|
print_value_json(shell, F("solarPumpModulation"), nullptr, F_(solarPumpModulation), F_(percent), json);
|
||||||
print_value_json(shell, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), output);
|
print_value_json(shell, F("cylinderPumpModulation"), nullptr, F_(cylinderPumpModulation), F_(percent), json);
|
||||||
print_value_json(shell, F("valveStatus"), nullptr, F_(valveStatus), nullptr, output);
|
print_value_json(shell, F("valveStatus"), nullptr, F_(valveStatus), nullptr, json);
|
||||||
print_value_json(shell, F("solarPump"), nullptr, F_(solarPump), nullptr, output);
|
print_value_json(shell, F("solarPump"), nullptr, F_(solarPump), nullptr, json);
|
||||||
print_value_json(shell, F("tankHeated"), nullptr, F_(tankHeated), nullptr, output);
|
print_value_json(shell, F("tankHeated"), nullptr, F_(tankHeated), nullptr, json);
|
||||||
print_value_json(shell, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, output);
|
print_value_json(shell, F("collectorShutdown"), nullptr, F_(collectorShutdown), nullptr, json);
|
||||||
print_value_json(shell, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), output);
|
print_value_json(shell, F("energyLastHour"), nullptr, F_(energyLastHour), F_(wh), json);
|
||||||
print_value_json(shell, F("energyToday"), nullptr, F_(energyToday), F_(wh), output);
|
print_value_json(shell, F("energyToday"), nullptr, F_(energyToday), F_(wh), json);
|
||||||
print_value_json(shell, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), output);
|
print_value_json(shell, F("energyTotal"), nullptr, F_(energyTotal), F_(kwh), json);
|
||||||
|
|
||||||
if (Helpers::hasValue(pumpWorkMin_)) {
|
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||||
shell.printfln(F(" %s: %d days %d hours %d minutes"),
|
shell.printfln(F(" %s: %d days %d hours %d minutes"),
|
||||||
@@ -130,15 +121,15 @@ void Solar::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Solar::publish_values(JsonObject & data, bool force) {
|
void Solar::publish_values(JsonObject & json, bool force) {
|
||||||
// handle HA first
|
// handle HA first
|
||||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||||
register_mqtt_ha_config(force);
|
register_mqtt_ha_config(force);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json_payload = doc.to<JsonObject>();
|
||||||
if (export_values(output)) {
|
if (export_values(json_payload)) {
|
||||||
if (device_id() == 0x2A) {
|
if (device_id() == 0x2A) {
|
||||||
Mqtt::publish(F("ww_data"), doc.as<JsonObject>());
|
Mqtt::publish(F("ww_data"), doc.as<JsonObject>());
|
||||||
} else {
|
} else {
|
||||||
@@ -197,66 +188,66 @@ void Solar::register_mqtt_ha_config(bool force) {
|
|||||||
|
|
||||||
// creates JSON doc from values
|
// creates JSON doc from values
|
||||||
// returns false if empty
|
// returns false if empty
|
||||||
bool Solar::export_values(JsonObject & output) {
|
bool Solar::export_values(JsonObject & json) {
|
||||||
char s[10]; // for formatting strings
|
char s[10]; // for formatting strings
|
||||||
|
|
||||||
if (Helpers::hasValue(collectorTemp_)) {
|
if (Helpers::hasValue(collectorTemp_)) {
|
||||||
output["collectorTemp"] = (float)collectorTemp_ / 10;
|
json["collectorTemp"] = (float)collectorTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(tankBottomTemp_)) {
|
if (Helpers::hasValue(tankBottomTemp_)) {
|
||||||
output["tankBottomTemp"] = (float)tankBottomTemp_ / 10;
|
json["tankBottomTemp"] = (float)tankBottomTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(tankBottomTemp2_)) {
|
if (Helpers::hasValue(tankBottomTemp2_)) {
|
||||||
output["tankBottomTemp2"] = (float)tankBottomTemp2_ / 10;
|
json["tankBottomTemp2"] = (float)tankBottomTemp2_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(heatExchangerTemp_)) {
|
if (Helpers::hasValue(heatExchangerTemp_)) {
|
||||||
output["heatExchangerTemp"] = (float)heatExchangerTemp_ / 10;
|
json["heatExchangerTemp"] = (float)heatExchangerTemp_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(solarPumpModulation_)) {
|
if (Helpers::hasValue(solarPumpModulation_)) {
|
||||||
output["solarPumpModulation"] = solarPumpModulation_;
|
json["solarPumpModulation"] = solarPumpModulation_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(cylinderPumpModulation_)) {
|
if (Helpers::hasValue(cylinderPumpModulation_)) {
|
||||||
output["cylinderPumpModulation"] = cylinderPumpModulation_;
|
json["cylinderPumpModulation"] = cylinderPumpModulation_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(solarPump_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(solarPump_, EMS_VALUE_BOOL)) {
|
||||||
output["solarPump"] = Helpers::render_value(s, solarPump_, EMS_VALUE_BOOL);
|
json["solarPump"] = Helpers::render_value(s, solarPump_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(valveStatus_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(valveStatus_, EMS_VALUE_BOOL)) {
|
||||||
output["valveStatus"] = Helpers::render_value(s, valveStatus_, EMS_VALUE_BOOL);
|
json["valveStatus"] = Helpers::render_value(s, valveStatus_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(pumpWorkMin_)) {
|
if (Helpers::hasValue(pumpWorkMin_)) {
|
||||||
output["pumpWorkMin"] = pumpWorkMin_;
|
json["pumpWorkMin"] = pumpWorkMin_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(tankHeated_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(tankHeated_, EMS_VALUE_BOOL)) {
|
||||||
output["tankHeated"] = Helpers::render_value(s, tankHeated_, EMS_VALUE_BOOL);
|
json["tankHeated"] = Helpers::render_value(s, tankHeated_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(collectorShutdown_, EMS_VALUE_BOOL)) {
|
if (Helpers::hasValue(collectorShutdown_, EMS_VALUE_BOOL)) {
|
||||||
output["collectorShutdown"] = Helpers::render_value(s, collectorShutdown_, EMS_VALUE_BOOL);
|
json["collectorShutdown"] = Helpers::render_value(s, collectorShutdown_, EMS_VALUE_BOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(energyLastHour_)) {
|
if (Helpers::hasValue(energyLastHour_)) {
|
||||||
output["energyLastHour"] = (float)energyLastHour_ / 10;
|
json["energyLastHour"] = (float)energyLastHour_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(energyToday_)) {
|
if (Helpers::hasValue(energyToday_)) {
|
||||||
output["energyToday"] = energyToday_;
|
json["energyToday"] = energyToday_;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(energyTotal_)) {
|
if (Helpers::hasValue(energyTotal_)) {
|
||||||
output["energyTotal"] = (float)energyTotal_ / 10;
|
json["energyTotal"] = (float)energyTotal_ / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.size();
|
return json.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if values have been updated
|
// check to see if values have been updated
|
||||||
|
|||||||
@@ -37,16 +37,14 @@ class Solar : public EMSdevice {
|
|||||||
Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
|
void register_mqtt_ha_config(bool force);
|
||||||
bool export_values(JsonObject & doc);
|
|
||||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
|
||||||
void register_mqtt_ha_config(bool force);
|
|
||||||
|
|
||||||
int16_t collectorTemp_ = EMS_VALUE_SHORT_NOTSET; // TS1: Temperature sensor for collector array 1
|
int16_t collectorTemp_ = EMS_VALUE_SHORT_NOTSET; // TS1: Temperature sensor for collector array 1
|
||||||
int16_t tankBottomTemp_ = EMS_VALUE_SHORT_NOTSET; // TS2: Temperature sensor 1 cylinder, bottom (solar thermal system)
|
int16_t tankBottomTemp_ = EMS_VALUE_SHORT_NOTSET; // TS2: Temperature sensor 1 cylinder, bottom (solar thermal system)
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ namespace emsesp {
|
|||||||
|
|
||||||
REGISTER_FACTORY(Switch, EMSdevice::DeviceType::SWITCH);
|
REGISTER_FACTORY(Switch, EMSdevice::DeviceType::SWITCH);
|
||||||
|
|
||||||
uuid::log::Logger Switch::logger_{F_(switch), uuid::log::Facility::CONSOLE};
|
uuid::log::Logger Switch::logger_ {
|
||||||
|
F_(switch), uuid::log::Facility::CONSOLE
|
||||||
|
};
|
||||||
|
|
||||||
Switch::Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand)
|
Switch::Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand)
|
||||||
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
|
: EMSdevice(device_type, device_id, product_id, version, name, flags, brand) {
|
||||||
@@ -37,7 +39,12 @@ void Switch::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Switch::publish_values(JsonObject & data, bool force) {
|
void Switch::publish_values(JsonObject & json, bool force) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// export values to JSON
|
||||||
|
bool Switch::export_values(JsonObject & json) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if values have been updated
|
// check to see if values have been updated
|
||||||
|
|||||||
@@ -36,13 +36,13 @@ class Switch : public EMSdevice {
|
|||||||
Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const std::string & version, const std::string & name, uint8_t flags, uint8_t brand);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uuid::log::Logger logger_;
|
static uuid::log::Logger logger_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -173,57 +173,57 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
|||||||
// prepare data for Web UI
|
// prepare data for Web UI
|
||||||
void Thermostat::device_info_web(JsonArray & root) {
|
void Thermostat::device_info_web(JsonArray & root) {
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc_main;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_SMALL> doc_main;
|
||||||
JsonObject output_main = doc_main.to<JsonObject>();
|
JsonObject json_main = doc_main.to<JsonObject>();
|
||||||
if (export_values_main(output_main)) {
|
if (export_values_main(json_main)) {
|
||||||
print_value_json(root, F("time"), nullptr, F_(time), nullptr, output_main);
|
print_value_json(root, F("time"), nullptr, F_(time), nullptr, json_main);
|
||||||
print_value_json(root, F("errorcode"), nullptr, F_(error), nullptr, output_main);
|
print_value_json(root, F("errorcode"), nullptr, F_(error), nullptr, json_main);
|
||||||
print_value_json(root, F("display"), nullptr, F_(display), nullptr, output_main);
|
print_value_json(root, F("display"), nullptr, F_(display), nullptr, json_main);
|
||||||
print_value_json(root, F("language"), nullptr, F_(language), nullptr, output_main);
|
print_value_json(root, F("language"), nullptr, F_(language), nullptr, json_main);
|
||||||
print_value_json(root, F("offsetclock"), nullptr, F_(offsetclock), nullptr, output_main);
|
print_value_json(root, F("offsetclock"), nullptr, F_(offsetclock), nullptr, json_main);
|
||||||
print_value_json(root, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), output_main);
|
print_value_json(root, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), json_main);
|
||||||
print_value_json(root, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), output_main);
|
print_value_json(root, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), json_main);
|
||||||
print_value_json(root, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), output_main);
|
print_value_json(root, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), json_main);
|
||||||
print_value_json(root, F("intoffset"), nullptr, F_(intoffset), nullptr, output_main);
|
print_value_json(root, F("intoffset"), nullptr, F_(intoffset), nullptr, json_main);
|
||||||
print_value_json(root, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), output_main);
|
print_value_json(root, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), json_main);
|
||||||
print_value_json(root, F("building"), nullptr, F_(building), nullptr, output_main);
|
print_value_json(root, F("building"), nullptr, F_(building), nullptr, json_main);
|
||||||
print_value_json(root, F("wwmode"), nullptr, F_(wwmode), nullptr, output_main);
|
print_value_json(root, F("wwmode"), nullptr, F_(wwmode), nullptr, json_main);
|
||||||
print_value_json(root, F("wwtemp"), nullptr, F_(wwtemp), nullptr, output_main);
|
print_value_json(root, F("wwtemp"), nullptr, F_(wwtemp), nullptr, json_main);
|
||||||
print_value_json(root, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, output_main);
|
print_value_json(root, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, json_main);
|
||||||
print_value_json(root, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, output_main);
|
print_value_json(root, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, json_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_hc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_hc;
|
||||||
JsonObject output_hc = doc_hc.to<JsonObject>();
|
JsonObject json_hc = doc_hc.to<JsonObject>();
|
||||||
|
|
||||||
if (export_values_hc(Mqtt::Format::NESTED, output_hc)) {
|
if (export_values_hc(Mqtt::Format::NESTED, json_hc)) {
|
||||||
// display for each active heating circuit
|
// display for each active heating circuit
|
||||||
for (const auto & hc : heating_circuits_) {
|
for (const auto & hc : heating_circuits_) {
|
||||||
if (hc->is_active()) {
|
if (hc->is_active()) {
|
||||||
char prefix_str[10];
|
char prefix_str[10];
|
||||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("hc%d"), hc->hc_num());
|
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("hc%d"), hc->hc_num());
|
||||||
JsonObject output = output_hc[prefix_str];
|
JsonObject json = json_hc[prefix_str];
|
||||||
|
|
||||||
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), hc->hc_num());
|
snprintf_P(prefix_str, sizeof(prefix_str), PSTR("(hc %d) "), hc->hc_num());
|
||||||
|
|
||||||
print_value_json(root, F("seltemp"), FPSTR(prefix_str), F_(seltemp), F_(degrees), output);
|
print_value_json(root, F("seltemp"), FPSTR(prefix_str), F_(seltemp), F_(degrees), json);
|
||||||
print_value_json(root, F("currtemp"), FPSTR(prefix_str), F_(currtemp), F_(degrees), output);
|
print_value_json(root, F("currtemp"), FPSTR(prefix_str), F_(currtemp), F_(degrees), json);
|
||||||
print_value_json(root, F("heattemp"), FPSTR(prefix_str), F_(heattemp), F_(degrees), output);
|
print_value_json(root, F("heattemp"), FPSTR(prefix_str), F_(heattemp), F_(degrees), json);
|
||||||
print_value_json(root, F("comforttemp"), FPSTR(prefix_str), F_(comforttemp), F_(degrees), output);
|
print_value_json(root, F("comforttemp"), FPSTR(prefix_str), F_(comforttemp), F_(degrees), json);
|
||||||
print_value_json(root, F("daytemp"), FPSTR(prefix_str), F_(daytemp), F_(degrees), output);
|
print_value_json(root, F("daytemp"), FPSTR(prefix_str), F_(daytemp), F_(degrees), json);
|
||||||
print_value_json(root, F("ecotemp"), FPSTR(prefix_str), F_(ecotemp), F_(degrees), output);
|
print_value_json(root, F("ecotemp"), FPSTR(prefix_str), F_(ecotemp), F_(degrees), json);
|
||||||
print_value_json(root, F("nighttemp"), FPSTR(prefix_str), F_(nighttemp), F_(degrees), output);
|
print_value_json(root, F("nighttemp"), FPSTR(prefix_str), F_(nighttemp), F_(degrees), json);
|
||||||
print_value_json(root, F("manualtemp"), FPSTR(prefix_str), F_(manualtemp), F_(degrees), output);
|
print_value_json(root, F("manualtemp"), FPSTR(prefix_str), F_(manualtemp), F_(degrees), json);
|
||||||
print_value_json(root, F("holidaytemp"), FPSTR(prefix_str), F_(holidaytemp), F_(degrees), output);
|
print_value_json(root, F("holidaytemp"), FPSTR(prefix_str), F_(holidaytemp), F_(degrees), json);
|
||||||
print_value_json(root, F("nofrosttemp"), FPSTR(prefix_str), F_(nofrosttemp), F_(degrees), output);
|
print_value_json(root, F("nofrosttemp"), FPSTR(prefix_str), F_(nofrosttemp), F_(degrees), json);
|
||||||
print_value_json(root, F("heatingtype"), FPSTR(prefix_str), F_(heatingtype), nullptr, output);
|
print_value_json(root, F("heatingtype"), FPSTR(prefix_str), F_(heatingtype), nullptr, json);
|
||||||
print_value_json(root, F("targetflowtemp"), FPSTR(prefix_str), F_(targetflowtemp), F_(degrees), output);
|
print_value_json(root, F("targetflowtemp"), FPSTR(prefix_str), F_(targetflowtemp), F_(degrees), json);
|
||||||
print_value_json(root, F("offsettemp"), FPSTR(prefix_str), F_(offsettemp), F_(degrees), output);
|
print_value_json(root, F("offsettemp"), FPSTR(prefix_str), F_(offsettemp), F_(degrees), json);
|
||||||
print_value_json(root, F("designtemp"), FPSTR(prefix_str), F_(designtemp), F_(degrees), output);
|
print_value_json(root, F("designtemp"), FPSTR(prefix_str), F_(designtemp), F_(degrees), json);
|
||||||
print_value_json(root, F("roominfluence"), FPSTR(prefix_str), F_(roominfluence), F_(degrees), output);
|
print_value_json(root, F("roominfluence"), FPSTR(prefix_str), F_(roominfluence), F_(degrees), json);
|
||||||
print_value_json(root, F("summertemp"), FPSTR(prefix_str), F_(summertemp), F_(degrees), output);
|
print_value_json(root, F("summertemp"), FPSTR(prefix_str), F_(summertemp), F_(degrees), json);
|
||||||
print_value_json(root, F("summermode"), FPSTR(prefix_str), F_(summermode), F_(degrees), output);
|
print_value_json(root, F("summermode"), FPSTR(prefix_str), F_(summermode), F_(degrees), json);
|
||||||
print_value_json(root, F("mode"), FPSTR(prefix_str), F_(mode), nullptr, output);
|
print_value_json(root, F("mode"), FPSTR(prefix_str), F_(mode), nullptr, json);
|
||||||
print_value_json(root, F("modetype"), FPSTR(prefix_str), F_(modetype), nullptr, output);
|
print_value_json(root, F("modetype"), FPSTR(prefix_str), F_(modetype), nullptr, json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,12 +243,9 @@ bool Thermostat::updated_values() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// info API command
|
bool Thermostat::export_values(JsonObject & json) {
|
||||||
// returns the same MQTT publish payload in Nested format
|
bool has_value = export_values_main(json);
|
||||||
bool Thermostat::command_info(const char * value, const int8_t id, JsonObject & output) {
|
has_value |= export_values_hc(Mqtt::Format::NESTED, json);
|
||||||
bool has_value = false;
|
|
||||||
has_value |= export_values_main(output);
|
|
||||||
has_value |= export_values_hc(Mqtt::Format::NESTED, output);
|
|
||||||
return has_value;
|
return has_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,30 +254,30 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
EMSdevice::show_values(shell); // always call this to show header
|
EMSdevice::show_values(shell); // always call this to show header
|
||||||
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_main;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_main;
|
||||||
JsonObject output_main = doc_main.to<JsonObject>();
|
JsonObject json_main = doc_main.to<JsonObject>();
|
||||||
if (export_values_main(output_main)) {
|
if (export_values_main(json_main)) {
|
||||||
print_value_json(shell, F("time"), nullptr, F_(time), nullptr, output_main);
|
print_value_json(shell, F("time"), nullptr, F_(time), nullptr, json_main);
|
||||||
print_value_json(shell, F("errorcode"), nullptr, F_(error), nullptr, output_main);
|
print_value_json(shell, F("errorcode"), nullptr, F_(error), nullptr, json_main);
|
||||||
print_value_json(shell, F("display"), nullptr, F_(display), nullptr, output_main);
|
print_value_json(shell, F("display"), nullptr, F_(display), nullptr, json_main);
|
||||||
print_value_json(shell, F("language"), nullptr, F_(language), nullptr, output_main);
|
print_value_json(shell, F("language"), nullptr, F_(language), nullptr, json_main);
|
||||||
print_value_json(shell, F("offsetclock"), nullptr, F_(offsetclock), nullptr, output_main);
|
print_value_json(shell, F("offsetclock"), nullptr, F_(offsetclock), nullptr, json_main);
|
||||||
print_value_json(shell, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), output_main);
|
print_value_json(shell, F("dampedtemp"), nullptr, F_(dampedtemp), F_(degrees), json_main);
|
||||||
print_value_json(shell, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), output_main);
|
print_value_json(shell, F("inttemp1"), nullptr, F_(inttemp1), F_(degrees), json_main);
|
||||||
print_value_json(shell, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), output_main);
|
print_value_json(shell, F("inttemp2"), nullptr, F_(inttemp2), F_(degrees), json_main);
|
||||||
print_value_json(shell, F("intoffset"), nullptr, F_(intoffset), nullptr, output_main);
|
print_value_json(shell, F("intoffset"), nullptr, F_(intoffset), nullptr, json_main);
|
||||||
print_value_json(shell, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), output_main);
|
print_value_json(shell, F("minexttemp"), nullptr, F_(minexttemp), F_(degrees), json_main);
|
||||||
print_value_json(shell, F("building"), nullptr, F_(building), nullptr, output_main);
|
print_value_json(shell, F("building"), nullptr, F_(building), nullptr, json_main);
|
||||||
print_value_json(shell, F("wwmode"), nullptr, F_(wwmode), nullptr, output_main);
|
print_value_json(shell, F("wwmode"), nullptr, F_(wwmode), nullptr, json_main);
|
||||||
print_value_json(shell, F("wwtemp"), nullptr, F_(wwtemp), nullptr, output_main);
|
print_value_json(shell, F("wwtemp"), nullptr, F_(wwtemp), nullptr, json_main);
|
||||||
print_value_json(shell, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, output_main);
|
print_value_json(shell, F("wwtemplow"), nullptr, F_(wwtemplow), nullptr, json_main);
|
||||||
print_value_json(shell, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, output_main);
|
print_value_json(shell, F("wwcircmode"), nullptr, F_(wwcircmode), nullptr, json_main);
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_hc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc_hc;
|
||||||
JsonObject output_hc = doc_hc.to<JsonObject>();
|
JsonObject json_hc = doc_hc.to<JsonObject>();
|
||||||
// e.g. {"hc1":{"seltemp":849.4,"currtemp":819.2,"mode":"unknown","modetype":"day"},"hc2":{"seltemp":875.1,"currtemp":409.6,"mode":"unknown","modetype":"day"},"hc3":{"seltemp":0,"currtemp":0,"mode":"unknown","modetype":"day"}}
|
// e.g. {"hc1":{"seltemp":849.4,"currtemp":819.2,"mode":"unknown","modetype":"day"},"hc2":{"seltemp":875.1,"currtemp":409.6,"mode":"unknown","modetype":"day"},"hc3":{"seltemp":0,"currtemp":0,"mode":"unknown","modetype":"day"}}
|
||||||
|
|
||||||
if (export_values_hc(Mqtt::Format::NESTED, output_hc)) {
|
if (export_values_hc(Mqtt::Format::NESTED, json_hc)) {
|
||||||
// display for each active heating circuit
|
// display for each active heating circuit
|
||||||
for (const auto & hc : heating_circuits_) {
|
for (const auto & hc : heating_circuits_) {
|
||||||
if (hc->is_active()) {
|
if (hc->is_active()) {
|
||||||
@@ -288,26 +285,26 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
|
|
||||||
char hc_name[10]; // hc{1-4}
|
char hc_name[10]; // hc{1-4}
|
||||||
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc->hc_num());
|
snprintf_P(hc_name, sizeof(hc_name), PSTR("hc%d"), hc->hc_num());
|
||||||
JsonObject output = output_hc[hc_name];
|
JsonObject json = json_hc[hc_name];
|
||||||
|
|
||||||
print_value_json(shell, F("seltemp"), F_(2spaces), F_(seltemp), F_(degrees), output);
|
print_value_json(shell, F("seltemp"), F_(2spaces), F_(seltemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("currtemp"), F_(2spaces), F_(currtemp), F_(degrees), output);
|
print_value_json(shell, F("currtemp"), F_(2spaces), F_(currtemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("heattemp"), F_(2spaces), F_(heattemp), F_(degrees), output);
|
print_value_json(shell, F("heattemp"), F_(2spaces), F_(heattemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("comforttemp"), F_(2spaces), F_(comforttemp), F_(degrees), output);
|
print_value_json(shell, F("comforttemp"), F_(2spaces), F_(comforttemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("daytemp"), F_(2spaces), F_(daytemp), F_(degrees), output);
|
print_value_json(shell, F("daytemp"), F_(2spaces), F_(daytemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("ecotemp"), F_(2spaces), F_(ecotemp), F_(degrees), output);
|
print_value_json(shell, F("ecotemp"), F_(2spaces), F_(ecotemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("nighttemp"), F_(2spaces), F_(nighttemp), F_(degrees), output);
|
print_value_json(shell, F("nighttemp"), F_(2spaces), F_(nighttemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("manualtemp"), F_(2spaces), F_(manualtemp), F_(degrees), output);
|
print_value_json(shell, F("manualtemp"), F_(2spaces), F_(manualtemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("holidaytemp"), F_(2spaces), F_(holidaytemp), F_(degrees), output);
|
print_value_json(shell, F("holidaytemp"), F_(2spaces), F_(holidaytemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("nofrosttemp"), F_(2spaces), F_(nofrosttemp), F_(degrees), output);
|
print_value_json(shell, F("nofrosttemp"), F_(2spaces), F_(nofrosttemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("targetflowtemp"), F_(2spaces), F_(targetflowtemp), F_(degrees), output);
|
print_value_json(shell, F("targetflowtemp"), F_(2spaces), F_(targetflowtemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("offsettemp"), F_(2spaces), F_(offsettemp), F_(degrees), output);
|
print_value_json(shell, F("offsettemp"), F_(2spaces), F_(offsettemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("designtemp"), F_(2spaces), F_(designtemp), F_(degrees), output);
|
print_value_json(shell, F("designtemp"), F_(2spaces), F_(designtemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("roominfluence"), F_(2spaces), F_(roominfluence), F_(degrees), output);
|
print_value_json(shell, F("roominfluence"), F_(2spaces), F_(roominfluence), F_(degrees), json);
|
||||||
print_value_json(shell, F("summertemp"), F_(2spaces), F_(summertemp), F_(degrees), output);
|
print_value_json(shell, F("summertemp"), F_(2spaces), F_(summertemp), F_(degrees), json);
|
||||||
print_value_json(shell, F("summermode"), F_(2spaces), F_(summermode), F_(degrees), output);
|
print_value_json(shell, F("summermode"), F_(2spaces), F_(summermode), F_(degrees), json);
|
||||||
print_value_json(shell, F("mode"), F_(2spaces), F_(mode), nullptr, output);
|
print_value_json(shell, F("mode"), F_(2spaces), F_(mode), nullptr, json);
|
||||||
print_value_json(shell, F("modetype"), F_(2spaces), F_(modetype), nullptr, output);
|
print_value_json(shell, F("modetype"), F_(2spaces), F_(modetype), nullptr, json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,25 +312,25 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// publish values via MQTT
|
// publish values via MQTT
|
||||||
void Thermostat::publish_values(JsonObject & data, bool force) {
|
void Thermostat::publish_values(JsonObject & json, bool force) {
|
||||||
if (EMSESP::actual_master_thermostat() != this->device_id()) {
|
if (EMSESP::actual_master_thermostat() != this->device_id()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
StaticJsonDocument<EMSESP_MAX_JSON_SIZE_MEDIUM> doc;
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json_data = doc.to<JsonObject>();
|
||||||
bool has_data = false;
|
bool has_data = false;
|
||||||
|
|
||||||
// if MQTT is in single mode send out the main data to the thermostat_data topic
|
// if MQTT is in single mode send out the main data to the thermostat_data topic
|
||||||
has_data |= export_values_main(output);
|
has_data |= export_values_main(json_data);
|
||||||
if (Mqtt::mqtt_format() == Mqtt::Format::SINGLE && has_data) {
|
if (Mqtt::mqtt_format() == Mqtt::Format::SINGLE && has_data) {
|
||||||
Mqtt::publish(F("thermostat_data"), output);
|
Mqtt::publish(F("thermostat_data"), json_data);
|
||||||
output.clear();
|
json_data.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the thermostat data.
|
// get the thermostat data.
|
||||||
// if we're in Single mode this function will also have published each of the heating circuits
|
// if we're in Single mode this function will also have published each of the heating circuits
|
||||||
has_data |= export_values_hc(Mqtt::mqtt_format(), output);
|
has_data |= export_values_hc(Mqtt::mqtt_format(), json_data);
|
||||||
|
|
||||||
// if we're in HA or CUSTOM, send out the complete topic with all the data
|
// if we're in HA or CUSTOM, send out the complete topic with all the data
|
||||||
if (Mqtt::mqtt_format() != Mqtt::Format::SINGLE && has_data) {
|
if (Mqtt::mqtt_format() != Mqtt::Format::SINGLE && has_data) {
|
||||||
@@ -341,7 +338,7 @@ void Thermostat::publish_values(JsonObject & data, bool force) {
|
|||||||
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
if (Mqtt::mqtt_format() == Mqtt::Format::HA) {
|
||||||
ha_config(force);
|
ha_config(force);
|
||||||
}
|
}
|
||||||
Mqtt::publish(F("thermostat_data"), output);
|
Mqtt::publish(F("thermostat_data"), json_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2164,11 +2161,6 @@ bool Thermostat::set_manualtemp(const char * value, const int8_t id) {
|
|||||||
|
|
||||||
// API commands for MQTT and Console
|
// API commands for MQTT and Console
|
||||||
void Thermostat::add_commands() {
|
void Thermostat::add_commands() {
|
||||||
// API call
|
|
||||||
Command::add_with_json(this->device_type(), F("info"), [&](const char * value, const int8_t id, JsonObject & object) {
|
|
||||||
return command_info(value, id, object);
|
|
||||||
});
|
|
||||||
|
|
||||||
// if this thermostat doesn't support write, don't add the commands
|
// if this thermostat doesn't support write, don't add the commands
|
||||||
if ((this->flags() & EMSdevice::EMS_DEVICE_FLAG_NO_WRITE) == EMSdevice::EMS_DEVICE_FLAG_NO_WRITE) {
|
if ((this->flags() & EMSdevice::EMS_DEVICE_FLAG_NO_WRITE) == EMSdevice::EMS_DEVICE_FLAG_NO_WRITE) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -100,7 +100,8 @@ class Thermostat : public EMSdevice {
|
|||||||
static std::string mode_tostring(uint8_t mode);
|
static std::string mode_tostring(uint8_t mode);
|
||||||
|
|
||||||
virtual void show_values(uuid::console::Shell & shell);
|
virtual void show_values(uuid::console::Shell & shell);
|
||||||
virtual void publish_values(JsonObject & data, bool force);
|
virtual void publish_values(JsonObject & json, bool force);
|
||||||
|
virtual bool export_values(JsonObject & json);
|
||||||
virtual void device_info_web(JsonArray & root);
|
virtual void device_info_web(JsonArray & root);
|
||||||
virtual bool updated_values();
|
virtual bool updated_values();
|
||||||
|
|
||||||
@@ -242,8 +243,6 @@ class Thermostat : public EMSdevice {
|
|||||||
void ha_config(bool force = false);
|
void ha_config(bool force = false);
|
||||||
bool thermostat_ha_cmd(const char * message, uint8_t hc_num);
|
bool thermostat_ha_cmd(const char * message, uint8_t hc_num);
|
||||||
|
|
||||||
bool command_info(const char * value, const int8_t id, JsonObject & output);
|
|
||||||
|
|
||||||
void process_RCOutdoorTemp(std::shared_ptr<const Telegram> telegram);
|
void process_RCOutdoorTemp(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_IBASettings(std::shared_ptr<const Telegram> telegram);
|
void process_IBASettings(std::shared_ptr<const Telegram> telegram);
|
||||||
void process_RCTime(std::shared_ptr<const Telegram> telegram);
|
void process_RCTime(std::shared_ptr<const Telegram> telegram);
|
||||||
|
|||||||
@@ -54,39 +54,39 @@ std::string EMSdevice::brand_to_string() const {
|
|||||||
std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
||||||
switch (device_type) {
|
switch (device_type) {
|
||||||
case DeviceType::SYSTEM:
|
case DeviceType::SYSTEM:
|
||||||
return read_flash_string(F("system"));
|
return read_flash_string(F_(system));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::BOILER:
|
case DeviceType::BOILER:
|
||||||
return read_flash_string(F("boiler"));
|
return read_flash_string(F_(boiler));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::THERMOSTAT:
|
case DeviceType::THERMOSTAT:
|
||||||
return read_flash_string(F("thermostat"));
|
return read_flash_string(F_(thermostat));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::HEATPUMP:
|
case DeviceType::HEATPUMP:
|
||||||
return read_flash_string(F("heatpump"));
|
return read_flash_string(F_(heatpump));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::SOLAR:
|
case DeviceType::SOLAR:
|
||||||
return read_flash_string(F("solar"));
|
return read_flash_string(F_(solar));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::MIXING:
|
case DeviceType::MIXING:
|
||||||
return read_flash_string(F("mixing"));
|
return read_flash_string(F_(mixing));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::SENSOR:
|
case DeviceType::DALLASSENSOR:
|
||||||
return read_flash_string(F("sensor"));
|
return read_flash_string(F_(dallassensor));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::CONTROLLER:
|
case DeviceType::CONTROLLER:
|
||||||
return read_flash_string(F("controller"));
|
return read_flash_string(F_(controller));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DeviceType::SWITCH:
|
case DeviceType::SWITCH:
|
||||||
return read_flash_string(F("switch"));
|
return read_flash_string(F_(switch));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -97,32 +97,32 @@ std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
|||||||
|
|
||||||
// returns device_type from a string
|
// returns device_type from a string
|
||||||
uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
|
uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
|
||||||
if (strcmp(topic, "boiler") == 0) {
|
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(boiler)))) {
|
||||||
return DeviceType::BOILER;
|
return DeviceType::BOILER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(topic, "thermostat") == 0) {
|
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(thermostat)))) {
|
||||||
return DeviceType::THERMOSTAT;
|
return DeviceType::THERMOSTAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(topic, "system") == 0) {
|
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(system)))) {
|
||||||
return DeviceType::SYSTEM;
|
return DeviceType::SYSTEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(topic, "heatpump") == 0) {
|
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(heatpump)))) {
|
||||||
return DeviceType::HEATPUMP;
|
return DeviceType::HEATPUMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(topic, "solar") == 0) {
|
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(solar)))) {
|
||||||
return DeviceType::SOLAR;
|
return DeviceType::SOLAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(topic, "mixing") == 0) {
|
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(mixing)))) {
|
||||||
return DeviceType::MIXING;
|
return DeviceType::MIXING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(topic, "sensor") == 0) {
|
if (!strcmp_P(topic, reinterpret_cast<PGM_P>(F_(dallassensor)))) {
|
||||||
return DeviceType::SENSOR;
|
return DeviceType::DALLASSENSOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeviceType::UNKNOWN;
|
return DeviceType::UNKNOWN;
|
||||||
|
|||||||
@@ -141,7 +141,8 @@ class EMSdevice {
|
|||||||
|
|
||||||
// virtual functions overrules by derived classes
|
// virtual functions overrules by derived classes
|
||||||
virtual void show_values(uuid::console::Shell & shell) = 0;
|
virtual void show_values(uuid::console::Shell & shell) = 0;
|
||||||
virtual void publish_values(JsonObject & data, bool force = false) = 0;
|
virtual void publish_values(JsonObject & json, bool force = false) = 0;
|
||||||
|
virtual bool export_values(JsonObject & json) = 0;
|
||||||
virtual bool updated_values() = 0;
|
virtual bool updated_values() = 0;
|
||||||
virtual void device_info_web(JsonArray & root) = 0;
|
virtual void device_info_web(JsonArray & root) = 0;
|
||||||
|
|
||||||
@@ -218,8 +219,8 @@ class EMSdevice {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum DeviceType : uint8_t {
|
enum DeviceType : uint8_t {
|
||||||
SYSTEM = 0, // this is us (EMS-ESP)
|
SYSTEM = 0, // this is us (EMS-ESP)
|
||||||
SENSOR, // for internal dallas sensors
|
DALLASSENSOR, // for internal dallas sensors
|
||||||
BOILER,
|
BOILER,
|
||||||
THERMOSTAT,
|
THERMOSTAT,
|
||||||
MIXING,
|
MIXING,
|
||||||
|
|||||||
@@ -305,14 +305,14 @@ void EMSESP::publish_all(bool force) {
|
|||||||
void EMSESP::publish_device_values(uint8_t device_type, bool force) {
|
void EMSESP::publish_device_values(uint8_t device_type, bool force) {
|
||||||
if (device_type == EMSdevice::DeviceType::MIXING && Mqtt::mqtt_format() != Mqtt::Format::SINGLE) {
|
if (device_type == EMSdevice::DeviceType::MIXING && Mqtt::mqtt_format() != Mqtt::Format::SINGLE) {
|
||||||
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
DynamicJsonDocument doc(EMSESP_MAX_JSON_SIZE_LARGE);
|
||||||
JsonObject output = doc.to<JsonObject>();
|
JsonObject json = doc.to<JsonObject>();
|
||||||
for (const auto & emsdevice : emsdevices) {
|
for (const auto & emsdevice : emsdevices) {
|
||||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||||
emsdevice->publish_values(output, force);
|
emsdevice->publish_values(json, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc.shrinkToFit();
|
doc.shrinkToFit();
|
||||||
Mqtt::publish("mixing_data", doc.as<JsonObject>());
|
Mqtt::publish(F("mixing_data"), doc.as<JsonObject>());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,11 +713,54 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
|
|||||||
emsdevices.push_back(EMSFactory::add(device_p->device_type, device_id, device_p->product_id, version, name, device_p->flags, brand));
|
emsdevices.push_back(EMSFactory::add(device_p->device_type, device_id, device_p->product_id, version, name, device_p->flags, brand));
|
||||||
emsdevices.back()->unique_id(++unique_id_count_);
|
emsdevices.back()->unique_id(++unique_id_count_);
|
||||||
LOG_DEBUG(F("Adding new device %s (device ID 0x%02X, product ID %d, version %s)"), name.c_str(), device_id, product_id, version.c_str());
|
LOG_DEBUG(F("Adding new device %s (device ID 0x%02X, product ID %d, version %s)"), name.c_str(), device_id, product_id, version.c_str());
|
||||||
fetch_device_values(device_id); // go and fetch its data,
|
fetch_device_values(device_id); // go and fetch its data
|
||||||
|
|
||||||
|
switch (device_p->device_type) {
|
||||||
|
case EMSdevice::DeviceType::BOILER:
|
||||||
|
Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) {
|
||||||
|
return command_info(EMSdevice::DeviceType::BOILER, json);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case EMSdevice::DeviceType::MIXING:
|
||||||
|
Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) {
|
||||||
|
return command_info(EMSdevice::DeviceType::MIXING, json);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case EMSdevice::DeviceType::SOLAR:
|
||||||
|
Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) {
|
||||||
|
return command_info(EMSdevice::DeviceType::SOLAR, json);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case EMSdevice::DeviceType::THERMOSTAT:
|
||||||
|
Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) {
|
||||||
|
return command_info(EMSdevice::DeviceType::THERMOSTAT, json);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case EMSdevice::DeviceType::HEATPUMP:
|
||||||
|
Command::add_with_json(device_p->device_type, F_(info), [&](const char * value, const int8_t id, JsonObject & json) {
|
||||||
|
return command_info(EMSdevice::DeviceType::HEATPUMP, json);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// export all values to info command
|
||||||
|
// value and id are ignored
|
||||||
|
bool EMSESP::command_info(uint8_t device_type, JsonObject & json) {
|
||||||
|
bool ok = false;
|
||||||
|
for (const auto & emsdevice : emsdevices) {
|
||||||
|
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||||
|
ok |= emsdevice->export_values(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
// send a read request, passing it into to the Tx Service, with offset
|
// send a read request, passing it into to the Tx Service, with offset
|
||||||
void EMSESP::send_read_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset) {
|
void EMSESP::send_read_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset) {
|
||||||
txservice_.read_request(type_id, dest, offset);
|
txservice_.read_request(type_id, dest, offset);
|
||||||
|
|||||||
@@ -185,6 +185,8 @@ class EMSESP {
|
|||||||
static void process_version(std::shared_ptr<const Telegram> telegram);
|
static void process_version(std::shared_ptr<const Telegram> telegram);
|
||||||
static void publish_response(std::shared_ptr<const Telegram> telegram);
|
static void publish_response(std::shared_ptr<const Telegram> telegram);
|
||||||
|
|
||||||
|
static bool command_info(uint8_t device_type, JsonObject & json);
|
||||||
|
|
||||||
static constexpr uint32_t EMS_FETCH_FREQUENCY = 60000; // check every minute
|
static constexpr uint32_t EMS_FETCH_FREQUENCY = 60000; // check every minute
|
||||||
static uint32_t last_fetch_;
|
static uint32_t last_fetch_;
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ MAKE_PSTR_WORD(device)
|
|||||||
MAKE_PSTR_WORD(data)
|
MAKE_PSTR_WORD(data)
|
||||||
MAKE_PSTR_WORD(command)
|
MAKE_PSTR_WORD(command)
|
||||||
MAKE_PSTR_WORD(commands)
|
MAKE_PSTR_WORD(commands)
|
||||||
|
MAKE_PSTR_WORD(info)
|
||||||
|
MAKE_PSTR_WORD(report)
|
||||||
|
|
||||||
// devices
|
// devices
|
||||||
MAKE_PSTR_WORD(boiler)
|
MAKE_PSTR_WORD(boiler)
|
||||||
@@ -91,9 +93,7 @@ MAKE_PSTR_WORD(controller)
|
|||||||
MAKE_PSTR_WORD(connect)
|
MAKE_PSTR_WORD(connect)
|
||||||
MAKE_PSTR_WORD(heatpump)
|
MAKE_PSTR_WORD(heatpump)
|
||||||
MAKE_PSTR_WORD(generic)
|
MAKE_PSTR_WORD(generic)
|
||||||
|
MAKE_PSTR_WORD(dallassensor)
|
||||||
// dallas sensors
|
|
||||||
MAKE_PSTR_WORD(sensor)
|
|
||||||
|
|
||||||
MAKE_PSTR(1space, " ")
|
MAKE_PSTR(1space, " ")
|
||||||
MAKE_PSTR(2spaces, " ")
|
MAKE_PSTR(2spaces, " ")
|
||||||
|
|||||||
12
src/mqtt.cpp
12
src/mqtt.cpp
@@ -269,18 +269,18 @@ void Mqtt::on_message(const char * topic, const char * payload, size_t len) {
|
|||||||
bool cmd_known = false;
|
bool cmd_known = false;
|
||||||
JsonVariant data = doc["data"];
|
JsonVariant data = doc["data"];
|
||||||
|
|
||||||
JsonObject output; // empty object
|
JsonObject json; // empty object
|
||||||
|
|
||||||
if (data.is<char *>()) {
|
if (data.is<char *>()) {
|
||||||
cmd_known = Command::call(mf.device_type_, command, data.as<char *>(), n, output);
|
cmd_known = Command::call(mf.device_type_, command, data.as<char *>(), n, json);
|
||||||
} else if (data.is<int>()) {
|
} else if (data.is<int>()) {
|
||||||
char data_str[10];
|
char data_str[10];
|
||||||
cmd_known = Command::call(mf.device_type_, command, Helpers::itoa(data_str, (int16_t)data.as<int>()), n, output);
|
cmd_known = Command::call(mf.device_type_, command, Helpers::itoa(data_str, (int16_t)data.as<int>()), n, json);
|
||||||
} else if (data.is<float>()) {
|
} else if (data.is<float>()) {
|
||||||
char data_str[10];
|
char data_str[10];
|
||||||
cmd_known = Command::call(mf.device_type_, command, Helpers::render_value(data_str, (float)data.as<float>(), 2), n, output);
|
cmd_known = Command::call(mf.device_type_, command, Helpers::render_value(data_str, (float)data.as<float>(), 2), n, json);
|
||||||
} else if (data.isNull()) {
|
} else if (data.isNull()) {
|
||||||
cmd_known = Command::call(mf.device_type_, command, "", n, output);
|
cmd_known = Command::call(mf.device_type_, command, "", n, json);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmd_known) {
|
if (!cmd_known) {
|
||||||
@@ -467,7 +467,7 @@ void Mqtt::on_connect() {
|
|||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
doc["ip"] = WiFi.localIP().toString();
|
doc["ip"] = WiFi.localIP().toString();
|
||||||
#endif
|
#endif
|
||||||
publish(F("info"), doc.as<JsonObject>());
|
publish(F_(info), doc.as<JsonObject>());
|
||||||
|
|
||||||
publish_retain(F("status"), "online", true); // say we're alive to the Last Will topic, with retain on
|
publish_retain(F("status"), "online", true); // say we're alive to the Last Will topic, with retain on
|
||||||
|
|
||||||
|
|||||||
@@ -149,10 +149,10 @@ void System::start() {
|
|||||||
|
|
||||||
// these commands respond to the topic "system" and take a payload like {cmd:"", data:"", id:""}
|
// these commands respond to the topic "system" and take a payload like {cmd:"", data:"", id:""}
|
||||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F("pin"), System::command_pin);
|
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F_(pin), System::command_pin);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F("send"), System::command_send);
|
Command::add(EMSdevice::DeviceType::SYSTEM, settings.ems_bus_id, F_(send), System::command_send);
|
||||||
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F("info"), System::command_info);
|
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info);
|
||||||
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F("report"), System::command_report);
|
Command::add_with_json(EMSdevice::DeviceType::SYSTEM, F_(report), System::command_report);
|
||||||
});
|
});
|
||||||
|
|
||||||
syslog_init(); // init SysLog
|
syslog_init(); // init SysLog
|
||||||
@@ -845,13 +845,13 @@ bool System::check_upgrade() {
|
|||||||
// export all settings to JSON text
|
// export all settings to JSON text
|
||||||
// http://ems-esp/api?device=system&cmd=info
|
// http://ems-esp/api?device=system&cmd=info
|
||||||
// value and id are ignored
|
// value and id are ignored
|
||||||
bool System::command_info(const char * value, const int8_t id, JsonObject & output) {
|
bool System::command_info(const char * value, const int8_t id, JsonObject & json) {
|
||||||
#ifdef EMSESP_STANDALONE
|
#ifdef EMSESP_STANDALONE
|
||||||
output["test"] = "testing info command";
|
json["test"] = "testing info command";
|
||||||
#else
|
#else
|
||||||
EMSESP::esp8266React.getWiFiSettingsService()->read([&](WiFiSettings & settings) {
|
EMSESP::esp8266React.getWiFiSettingsService()->read([&](WiFiSettings & settings) {
|
||||||
char s[7];
|
char s[7];
|
||||||
JsonObject node = output.createNestedObject("WIFI");
|
JsonObject node = json.createNestedObject("WIFI");
|
||||||
node["ssid"] = settings.ssid;
|
node["ssid"] = settings.ssid;
|
||||||
// node["password"] = settings.password;
|
// node["password"] = settings.password;
|
||||||
node["hostname"] = settings.hostname;
|
node["hostname"] = settings.hostname;
|
||||||
@@ -864,7 +864,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
});
|
});
|
||||||
|
|
||||||
EMSESP::esp8266React.getAPSettingsService()->read([&](APSettings & settings) {
|
EMSESP::esp8266React.getAPSettingsService()->read([&](APSettings & settings) {
|
||||||
JsonObject node = output.createNestedObject("AP");
|
JsonObject node = json.createNestedObject("AP");
|
||||||
node["provision_mode"] = settings.provisionMode;
|
node["provision_mode"] = settings.provisionMode;
|
||||||
node["ssid"] = settings.ssid;
|
node["ssid"] = settings.ssid;
|
||||||
// node["password"] = settings.password;
|
// node["password"] = settings.password;
|
||||||
@@ -875,7 +875,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
|
|
||||||
EMSESP::esp8266React.getMqttSettingsService()->read([&](MqttSettings & settings) {
|
EMSESP::esp8266React.getMqttSettingsService()->read([&](MqttSettings & settings) {
|
||||||
char s[7];
|
char s[7];
|
||||||
JsonObject node = output.createNestedObject("MQTT");
|
JsonObject node = json.createNestedObject("MQTT");
|
||||||
node["enabled"] = Helpers::render_boolean(s, settings.enabled);
|
node["enabled"] = Helpers::render_boolean(s, settings.enabled);
|
||||||
node["host"] = settings.host;
|
node["host"] = settings.host;
|
||||||
node["port"] = settings.port;
|
node["port"] = settings.port;
|
||||||
@@ -898,7 +898,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
|
|
||||||
EMSESP::esp8266React.getNTPSettingsService()->read([&](NTPSettings & settings) {
|
EMSESP::esp8266React.getNTPSettingsService()->read([&](NTPSettings & settings) {
|
||||||
char s[7];
|
char s[7];
|
||||||
JsonObject node = output.createNestedObject("NTP");
|
JsonObject node = json.createNestedObject("NTP");
|
||||||
node["enabled"] = Helpers::render_boolean(s, settings.enabled);
|
node["enabled"] = Helpers::render_boolean(s, settings.enabled);
|
||||||
node["server"] = settings.server;
|
node["server"] = settings.server;
|
||||||
node["tz_label"] = settings.tzLabel;
|
node["tz_label"] = settings.tzLabel;
|
||||||
@@ -907,7 +907,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
|
|
||||||
EMSESP::esp8266React.getOTASettingsService()->read([&](OTASettings & settings) {
|
EMSESP::esp8266React.getOTASettingsService()->read([&](OTASettings & settings) {
|
||||||
char s[7];
|
char s[7];
|
||||||
JsonObject node = output.createNestedObject("OTA");
|
JsonObject node = json.createNestedObject("OTA");
|
||||||
node["enabled"] = Helpers::render_boolean(s, settings.enabled);
|
node["enabled"] = Helpers::render_boolean(s, settings.enabled);
|
||||||
node["port"] = settings.port;
|
node["port"] = settings.port;
|
||||||
// node["password"] = settings.password;
|
// node["password"] = settings.password;
|
||||||
@@ -915,7 +915,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
|
|
||||||
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
EMSESP::webSettingsService.read([&](WebSettings & settings) {
|
||||||
char s[7];
|
char s[7];
|
||||||
JsonObject node = output.createNestedObject("Settings");
|
JsonObject node = json.createNestedObject("Settings");
|
||||||
node["tx_mode"] = settings.tx_mode;
|
node["tx_mode"] = settings.tx_mode;
|
||||||
node["ems_bus_id"] = settings.ems_bus_id;
|
node["ems_bus_id"] = settings.ems_bus_id;
|
||||||
node["syslog_level"] = settings.syslog_level;
|
node["syslog_level"] = settings.syslog_level;
|
||||||
@@ -941,10 +941,10 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
|||||||
|
|
||||||
// export debug information
|
// export debug information
|
||||||
// http://ems-esp/api?device=system&cmd=report
|
// http://ems-esp/api?device=system&cmd=report
|
||||||
bool System::command_report(const char * value, const int8_t id, JsonObject & output) {
|
bool System::command_report(const char * value, const int8_t id, JsonObject & json) {
|
||||||
JsonObject node;
|
JsonObject node;
|
||||||
|
|
||||||
node = output.createNestedObject("System");
|
node = json.createNestedObject("System");
|
||||||
|
|
||||||
node["version"] = EMSESP_APP_VERSION;
|
node["version"] = EMSESP_APP_VERSION;
|
||||||
node["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
node["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3);
|
||||||
@@ -953,7 +953,7 @@ bool System::command_report(const char * value, const int8_t id, JsonObject & ou
|
|||||||
node["fragmem"] = ESP.getHeapFragmentation();
|
node["fragmem"] = ESP.getHeapFragmentation();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
node = output.createNestedObject("Settings");
|
node = json.createNestedObject("Settings");
|
||||||
|
|
||||||
EMSESP::esp8266React.getMqttSettingsService()->read([&](MqttSettings & settings) {
|
EMSESP::esp8266React.getMqttSettingsService()->read([&](MqttSettings & settings) {
|
||||||
node["publish_time_boiler"] = settings.publish_time_boiler;
|
node["publish_time_boiler"] = settings.publish_time_boiler;
|
||||||
@@ -984,7 +984,7 @@ bool System::command_report(const char * value, const int8_t id, JsonObject & ou
|
|||||||
node["analog_enabled"] = settings.analog_enabled;
|
node["analog_enabled"] = settings.analog_enabled;
|
||||||
});
|
});
|
||||||
|
|
||||||
node = output.createNestedObject("Status");
|
node = json.createNestedObject("Status");
|
||||||
|
|
||||||
switch (EMSESP::bus_status()) {
|
switch (EMSESP::bus_status()) {
|
||||||
case EMSESP::BUS_STATUS_OFFLINE:
|
case EMSESP::BUS_STATUS_OFFLINE:
|
||||||
@@ -1012,7 +1012,7 @@ bool System::command_report(const char * value, const int8_t id, JsonObject & ou
|
|||||||
node["#dallas sensors"] = EMSESP::sensor_devices().size();
|
node["#dallas sensors"] = EMSESP::sensor_devices().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonArray devices2 = output.createNestedArray("Devices");
|
JsonArray devices2 = json.createNestedArray("Devices");
|
||||||
|
|
||||||
for (const auto & device_class : EMSFactory::device_handlers()) {
|
for (const auto & device_class : EMSFactory::device_handlers()) {
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ class System {
|
|||||||
|
|
||||||
static bool command_pin(const char * value, const int8_t id);
|
static bool command_pin(const char * value, const int8_t id);
|
||||||
static bool command_send(const char * value, const int8_t id);
|
static bool command_send(const char * value, const int8_t id);
|
||||||
static bool command_info(const char * value, const int8_t id, JsonObject & output);
|
static bool command_info(const char * value, const int8_t id, JsonObject & json);
|
||||||
static bool command_report(const char * value, const int8_t id, JsonObject & output);
|
static bool command_report(const char * value, const int8_t id, JsonObject & json);
|
||||||
|
|
||||||
static uint8_t free_mem();
|
static uint8_t free_mem();
|
||||||
static void upload_status(bool in_progress);
|
static void upload_status(bool in_progress);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "2.1.0b10"
|
#define EMSESP_APP_VERSION "2.1.0b11"
|
||||||
|
|||||||
Reference in New Issue
Block a user