diff --git a/src/emsesp.h b/src/emsesp.h index cde3e90e2..08306d59c 100644 --- a/src/emsesp.h +++ b/src/emsesp.h @@ -131,6 +131,10 @@ class EMSESP { return (!(dallassensor_.sensors().empty())); } + static uint32_t sensor_reads() { + return dallassensor_.reads(); + } + static uint32_t sensor_fails() { return dallassensor_.fails(); } diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 75b6e816e..d37d1a644 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -347,15 +347,9 @@ void Mqtt::on_message(const char * fulltopic, const char * payload, size_t len) return; // invalid topic name } cmd_only++; // skip the / - int8_t id = -1; - // check for hcx/ prefix, commented out, this is now in command::call - // if (cmd_only[0] == 'h' && cmd_only[1] == 'c' && cmd_only[3] == '/') { - // id = cmd_only[2] - '0'; - // cmd_only += 4; - // } - // LOG_INFO(F("devicetype= %d, topic = %s, cmd = %s, message = %s, id = %d"), mf.device_type_, topic, cmd_only, message, id); - if (!Command::call(mf.device_type_, cmd_only, message, id)) { - LOG_ERROR(F("No matching cmd (%s) in topic %s, id %d, or invalid data"), cmd_only, topic, id); + // LOG_INFO(F("devicetype= %d, topic = %s, cmd = %s, message = %s), mf.device_type_, topic, cmd_only, message); + if (!Command::call(mf.device_type_, cmd_only, message)) { + LOG_ERROR(F("No matching cmd (%s) in topic %s, or invalid data"), cmd_only, topic); Mqtt::publish(F_(response), "unknown"); } return; diff --git a/src/mqtt.h b/src/mqtt.h index fde421eab..bea1e2f2a 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -145,6 +145,10 @@ class Mqtt { return mqtt_base_; } + static uint16_t publish_count() { + return mqtt_message_id_; + } + static uint32_t publish_fails() { return mqtt_publish_fails_; } diff --git a/src/system.cpp b/src/system.cpp index 3094b7eef..1285c8124 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -886,10 +886,6 @@ bool System::command_settings(const char * value, const int8_t id, JsonObject & // export status information including some basic settings // e.g. http://ems-esp/api?device=system&cmd=info bool System::command_info(const char * value, const int8_t id, JsonObject & json) { - if (id == 0) { - return EMSESP::system_.heartbeat_json(json); - } - JsonObject node; node = json.createNestedObject("System"); @@ -925,10 +921,12 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json node["rx line quality"] = EMSESP::rxservice_.quality(); node["tx line quality"] = EMSESP::txservice_.quality(); if (Mqtt::enabled()) { + node["#MQTT publishes"] = Mqtt::publish_count(); node["#MQTT publish fails"] = Mqtt::publish_fails(); } if (EMSESP::dallas_enabled()) { node["#dallas sensors"] = EMSESP::sensor_devices().size(); + node["#dallas reads"] = EMSESP::sensor_reads(); node["#dallas fails"] = EMSESP::sensor_fails(); } } @@ -948,8 +946,8 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & json } if (EMSESP::sensor_devices().size()) { JsonObject obj = devices2.createNestedObject(); - obj["type"] = F("Dallassensor"); - obj["name"] = F("Dallassensor"); + obj["type"] = F_(Dallassensor); + obj["name"] = F_(Dallassensor); } return true;