TAG_DEVICE_DATA_WW is only for BOILER

This commit is contained in:
proddy
2021-06-08 18:24:06 +02:00
parent 07a943eedf
commit cc30e09e4b
4 changed files with 26 additions and 6 deletions

View File

@@ -89,7 +89,7 @@ enum DeviceValueTAG : uint8_t {
TAG_NONE = 0, // wild card TAG_NONE = 0, // wild card
TAG_HEARTBEAT, TAG_HEARTBEAT,
TAG_BOILER_DATA, TAG_BOILER_DATA,
TAG_DEVICE_DATA_WW, TAG_BOILER_DATA_WW,
TAG_THERMOSTAT_DATA, TAG_THERMOSTAT_DATA,
TAG_HC1, TAG_HC1,
TAG_HC2, TAG_HC2,
@@ -119,7 +119,7 @@ enum DeviceValueTAG : uint8_t {
}; };
// mqtt flags for command subscriptions // mqtt flags for command subscriptions
enum MqttSubFlag : uint8_t { FLAG_NORMAL = 0, FLAG_HC, FLAG_WWC, FLAG_WW, FLAG_NOSUB }; enum MqttSubFlag : uint8_t { FLAG_NORMAL = 0, FLAG_HC, FLAG_WWC, FLAG_NOSUB };
// mqtt-HA flags // mqtt-HA flags
enum DeviceValueHA : uint8_t { HA_NONE = 0, HA_VALUE, HA_DONE }; enum DeviceValueHA : uint8_t { HA_NONE = 0, HA_VALUE, HA_DONE };

View File

@@ -460,8 +460,8 @@ void EMSESP::publish_device_values(uint8_t device_type) {
Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_BOILER_DATA), json); Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_BOILER_DATA), json);
} }
doc.clear(); doc.clear();
if (emsdevice->generate_values_json(json, DeviceValueTAG::TAG_DEVICE_DATA_WW, false)) { if (emsdevice->generate_values_json(json, DeviceValueTAG::TAG_BOILER_DATA_WW, false)) {
Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_DEVICE_DATA_WW), json); Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_BOILER_DATA_WW), json);
} }
need_publish = false; need_publish = false;
} }
@@ -561,6 +561,7 @@ void EMSESP::publish_response(std::shared_ptr<const Telegram> telegram) {
Mqtt::publish(F_(response), doc.as<JsonObject>()); Mqtt::publish(F_(response), doc.as<JsonObject>());
} }
// builds json with the detail of each value, for all device types and the dallas sensor
bool EMSESP::get_device_value_info(JsonObject & root, const char * cmd, const int8_t id, const uint8_t devicetype) { bool EMSESP::get_device_value_info(JsonObject & root, const char * cmd, const int8_t id, const uint8_t devicetype) {
for (const auto & emsdevice : emsdevices) { for (const auto & emsdevice : emsdevices) {
if (emsdevice->device_type() == devicetype) { if (emsdevice->device_type() == devicetype) {

View File

@@ -53,7 +53,7 @@ bool Test::run_test(const char * command, int8_t id) {
return true; return true;
} }
if (strcmp(command, "general2") == 0) { if (strcmp(command, "310") == 0) {
EMSESP::logger().info(F("Testing GB072/RC310...")); EMSESP::logger().info(F("Testing GB072/RC310..."));
add_device(0x08, 123); // GB072 add_device(0x08, 123); // GB072
@@ -74,6 +74,9 @@ bool Test::run_test(const char * command, int8_t id) {
uart_telegram({0x10, 00, 0xFF, 00, 01, 0xA5, 0x80, 00, 01, 0x30, 0x28, 00, 0x30, 0x28, 01, 0x54, uart_telegram({0x10, 00, 0xFF, 00, 01, 0xA5, 0x80, 00, 01, 0x30, 0x28, 00, 0x30, 0x28, 01, 0x54,
03, 03, 01, 01, 0x54, 02, 0xA8, 00, 00, 0x11, 01, 03, 0xFF, 0xFF, 00}); 03, 03, 01, 01, 0x54, 02, 0xA8, 00, 00, 0x11, 01, 03, 0xFF, 0xFF, 00});
// RC300WWmode2(0x31D), data: 00 00 09 07
uart_telegram({0x10, 00, 0xFF, 00, 02, 0x1D, 00, 00, 0x09, 0x07});
return true; return true;
} }
@@ -327,6 +330,15 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) {
run_test("gateway"); run_test("gateway");
} }
if (command == "310") {
shell.printfln(F("Testing RC310..."));
run_test("310");
shell.invoke_command("show devices");
shell.invoke_command("show");
shell.invoke_command("call system publish");
shell.invoke_command("show mqtt");
}
if (command == "web") { if (command == "web") {
shell.printfln(F("Testing Web...")); shell.printfln(F("Testing Web..."));
@@ -916,6 +928,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd) {
shell.invoke_command("call system publish"); shell.invoke_command("call system publish");
shell.invoke_command("show mqtt"); shell.invoke_command("show mqtt");
} }
if (command == "api") {
shell.printfln(F("Testing RESTful API..."));
// TODO add API
// AsyncWebServerRequest * request;
}
} }
// simulates a telegram in the Rx queue, but without the CRC which is added automatically // simulates a telegram in the Rx queue, but without the CRC which is added automatically

View File

@@ -29,7 +29,7 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "thermostat" // #define EMSESP_DEBUG_DEFAULT "thermostat"
// #define EMSESP_DEBUG_DEFAULT "solar" // #define EMSESP_DEBUG_DEFAULT "solar"
// #define EMSESP_DEBUG_DEFAULT "mixer" // #define EMSESP_DEBUG_DEFAULT "mixer"
#define EMSESP_DEBUG_DEFAULT "web" // #define EMSESP_DEBUG_DEFAULT "web"
// #define EMSESP_DEBUG_DEFAULT "general" // #define EMSESP_DEBUG_DEFAULT "general"
// #define EMSESP_DEBUG_DEFAULT "boiler" // #define EMSESP_DEBUG_DEFAULT "boiler"
// #define EMSESP_DEBUG_DEFAULT "mqtt2" // #define EMSESP_DEBUG_DEFAULT "mqtt2"
@@ -37,6 +37,7 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "ha" // #define EMSESP_DEBUG_DEFAULT "ha"
// #define EMSESP_DEBUG_DEFAULT "board_profile" // #define EMSESP_DEBUG_DEFAULT "board_profile"
// #define EMSESP_DEBUG_DEFAULT "shower_alert" // #define EMSESP_DEBUG_DEFAULT "shower_alert"
#define EMSESP_DEBUG_DEFAULT "310"
class Test { class Test {
public: public: