From 815397dba655ceaee6efaade04a51ba1eab49d29 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 25 Sep 2022 14:36:45 +0200 Subject: [PATCH 01/28] move device_library name to const char * --- src/common.h | 12 +-- src/dallassensor.cpp | 2 +- src/device_library.h | 206 ++++++++++++++++++------------------- src/devices/boiler.cpp | 2 +- src/devices/boiler.h | 2 +- src/devices/connect.cpp | 2 +- src/devices/connect.h | 2 +- src/devices/controller.cpp | 2 +- src/devices/controller.h | 2 +- src/devices/gateway.cpp | 2 +- src/devices/gateway.h | 2 +- src/devices/generic.cpp | 2 +- src/devices/generic.h | 2 +- src/devices/heatpump.cpp | 2 +- src/devices/heatpump.h | 2 +- src/devices/mixer.cpp | 2 +- src/devices/mixer.h | 2 +- src/devices/solar.cpp | 2 +- src/devices/solar.h | 2 +- src/devices/switch.cpp | 2 +- src/devices/switch.h | 2 +- src/devices/thermostat.cpp | 2 +- src/devices/thermostat.h | 2 +- src/emsdevice.cpp | 17 ++- src/emsdevice.h | 22 ++-- src/emsesp.cpp | 9 +- src/emsesp.h | 8 +- src/emsfactory.h | 8 +- src/locale_translations.h | 54 +++++----- src/mqtt.cpp | 20 ++-- src/shower.cpp | 6 +- src/system.cpp | 11 +- 32 files changed, 207 insertions(+), 208 deletions(-) diff --git a/src/common.h b/src/common.h index 0e476c26e..54e222f37 100644 --- a/src/common.h +++ b/src/common.h @@ -38,9 +38,6 @@ using uuid::read_flash_string; #undef FPSTR #endif -#define FJSON(x) x -// #define FJSON(x) F(x) - // clang-format off #define MAKE_STR(string_name, string_literal) static constexpr const char * __str__##string_name = string_literal; @@ -48,12 +45,15 @@ using uuid::read_flash_string; #define FPSTR(pstr_pointer) (reinterpret_cast(pstr_pointer)) #define F_(string_name) FPSTR(__pstr__##string_name) -#define MAKE_PSTR(string_name, string_literal) static const char __pstr__##string_name[] __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = string_literal; +#define MAKE_PSTR(string_name, string_literal) static const char __pstr__##string_name[] = string_literal; #define MAKE_PSTR_WORD(string_name) MAKE_PSTR(string_name, #string_name) #define FL_(list_name) (__pstr__L_##list_name) -#define MAKE_PSTR_LIST(list_name, ...) static const __FlashStringHelper * const __pstr__L_##list_name[] PROGMEM = {__VA_ARGS__, nullptr}; -#define MAKE_PSTR_ENUM(enum_name, ...) static const __FlashStringHelper * const * __pstr__L_##enum_name[] PROGMEM = {__VA_ARGS__, nullptr}; +#define MAKE_PSTR_LIST(list_name, ...) static const __FlashStringHelper * const __pstr__L_##list_name[] = {__VA_ARGS__, nullptr}; +#define MAKE_PSTR_ENUM(enum_name, ...) static const __FlashStringHelper * const * __pstr__L_##enum_name[] = {__VA_ARGS__, nullptr}; + +// #define MAKE_PSTR_LIST2(list_name, ...) static const char * const __pstr__L_##list_name2[] = {__VA_ARGS__, nullptr}; + // clang-format on diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index 53fb0c8e5..d02a8e8d0 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -486,7 +486,7 @@ void DallasSensor::publish_values(const bool force) { LOG_DEBUG(F("Recreating HA config for sensor ID %s"), sensor.id().c_str()); StaticJsonDocument config; - config["dev_cla"] = FJSON("temperature"); + config["dev_cla"] = "temperature"; char stat_t[50]; snprintf(stat_t, sizeof(stat_t), "%s/dallassensor_data", Mqtt::base().c_str()); diff --git a/src/device_library.h b/src/device_library.h index e9306d972..255d63c3d 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -24,140 +24,140 @@ */ // Boilers - 0x08 -{ 64, DeviceType::BOILER, F("BK13/BK15/Smartline/GB1x2"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{ 72, DeviceType::BOILER, F("GB125/MC10"), DeviceFlags::EMS_DEVICE_FLAG_EMS}, -{ 81, DeviceType::BOILER, F("Cascade CM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{ 84, DeviceType::BOILER, F("Logamax Plus GB022"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{ 95, DeviceType::BOILER, F("Condens 2500/Logamax/Logomatic/Cerapur Top/Greenstar/Generic HT3"), DeviceFlags::EMS_DEVICE_FLAG_HT3}, -{115, DeviceType::BOILER, F("Topline/GB162"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{122, DeviceType::BOILER, F("Proline"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{123, DeviceType::BOILER, F("GBx72/Trendline/Cerapur/Greenstar Si/27i"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{131, DeviceType::BOILER, F("GB212"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{132, DeviceType::BOILER, F("GC7000F"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{133, DeviceType::BOILER, F("Logano GB125/KB195i/Logamatic MC110"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{154, DeviceType::BOILER, F("Greenstar 30Ri Compact"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{167, DeviceType::BOILER, F("Cerapur Aero"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{168, DeviceType::BOILER, F("Hybrid Heatpump"), DeviceFlags::EMS_DEVICE_FLAG_HYBRID}, -{170, DeviceType::BOILER, F("Logano GB212"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{172, DeviceType::BOILER, F("Enviline/Compress 6000AW/Hybrid 7000iAW/SupraEco/Geo 5xx"), DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP}, -{173, DeviceType::BOILER, F("Geo 5xx"), DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP}, -{195, DeviceType::BOILER, F("Condens 5000i/Greenstar 8000"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{203, DeviceType::BOILER, F("Logamax U122/Cerapur"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{206, DeviceType::BOILER, F("Ecomline Excellent"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{208, DeviceType::BOILER, F("Logamax Plus/GB192/Condens GC9000"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{210, DeviceType::BOILER, F("Cascade MC400"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{211, DeviceType::BOILER, F("EasyControl Adapter"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{228, DeviceType::BOILER, F("Alternative Heatsource"), DeviceFlags::EMS_DEVICE_FLAG_AM200}, -{234, DeviceType::BOILER, F("Logamax Plus GB122/Condense 2300"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 64, DeviceType::BOILER, "BK13/BK15/Smartline/GB1x2", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 72, DeviceType::BOILER, "GB125/MC10", DeviceFlags::EMS_DEVICE_FLAG_EMS}, +{ 81, DeviceType::BOILER, "Cascade CM10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 84, DeviceType::BOILER, "Logamax Plus GB022", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 95, DeviceType::BOILER, "Condens 2500/Logamax/Logomatic/Cerapur Top/Greenstar/Generic HT3", DeviceFlags::EMS_DEVICE_FLAG_HT3}, +{115, DeviceType::BOILER, "Topline/GB162", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{122, DeviceType::BOILER, "Proline", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{123, DeviceType::BOILER, "GBx72/Trendline/Cerapur/Greenstar Si/27i", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{131, DeviceType::BOILER, "GB212", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{132, DeviceType::BOILER, "GC7000F", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{133, DeviceType::BOILER, "Logano GB125/KB195i/Logamatic MC110", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{154, DeviceType::BOILER, "Greenstar 30Ri Compact", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{167, DeviceType::BOILER, "Cerapur Aero", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{168, DeviceType::BOILER, "Hybrid Heatpump", DeviceFlags::EMS_DEVICE_FLAG_HYBRID}, +{170, DeviceType::BOILER, "Logano GB212", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{172, DeviceType::BOILER, "Enviline/Compress 6000AW/Hybrid 7000iAW/SupraEco/Geo 5xx", DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP}, +{173, DeviceType::BOILER, "Geo 5xx", DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP}, +{195, DeviceType::BOILER, "Condens 5000i/Greenstar 8000", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{203, DeviceType::BOILER, "Logamax U122/Cerapur", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{206, DeviceType::BOILER, "Ecomline Excellent", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{208, DeviceType::BOILER, "Logamax Plus/GB192/Condens GC9000", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{210, DeviceType::BOILER, "Cascade MC400", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{211, DeviceType::BOILER, "EasyControl Adapter", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{228, DeviceType::BOILER, "Alternative Heatsource", DeviceFlags::EMS_DEVICE_FLAG_AM200}, +{234, DeviceType::BOILER, "Logamax Plus GB122/Condense 2300", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Controllers - 0x09 / 0x10 / 0x50 -{ 68, DeviceType::CONTROLLER, F("BC10/RFM20"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{ 81, DeviceType::CONTROLLER, F("CM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{ 84, DeviceType::CONTROLLER, F("GB022"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{ 89, DeviceType::CONTROLLER, F("BC10 GB142"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{ 95, DeviceType::CONTROLLER, F("HT3"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{114, DeviceType::CONTROLLER, F("BC10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{125, DeviceType::CONTROLLER, F("BC25"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{152, DeviceType::CONTROLLER, F("Controller"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{168, DeviceType::CONTROLLER, F("Hybrid Heatpump"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{169, DeviceType::CONTROLLER, F("BC40"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{190, DeviceType::CONTROLLER, F("BC10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{194, DeviceType::CONTROLLER, F("BC10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{206, DeviceType::CONTROLLER, F("Ecomline"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{207, DeviceType::CONTROLLER, F("Sense II/CS200"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x10 -{209, DeviceType::CONTROLLER, F("ErP"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{218, DeviceType::CONTROLLER, F("M200/RFM200"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x50 -{224, DeviceType::CONTROLLER, F("9000i"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{229, DeviceType::CONTROLLER, F("8700i"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{230, DeviceType::CONTROLLER, F("BC Base"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 -{240, DeviceType::CONTROLLER, F("Rego 3000"), DeviceFlags::EMS_DEVICE_FLAG_IVT}, // 0x09 -{241, DeviceType::CONTROLLER, F("Condens 5000i"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{ 68, DeviceType::CONTROLLER, "BC10/RFM20", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{ 81, DeviceType::CONTROLLER, "CM10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 84, DeviceType::CONTROLLER, "GB022", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 89, DeviceType::CONTROLLER, "BC10 GB142", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{ 95, DeviceType::CONTROLLER, "HT3", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{114, DeviceType::CONTROLLER, "BC10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{125, DeviceType::CONTROLLER, "BC25", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{152, DeviceType::CONTROLLER, "Controller", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{168, DeviceType::CONTROLLER, "Hybrid Heatpump", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{169, DeviceType::CONTROLLER, "BC40", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{190, DeviceType::CONTROLLER, "BC10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{194, DeviceType::CONTROLLER, "BC10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{206, DeviceType::CONTROLLER, "Ecomline", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{207, DeviceType::CONTROLLER, "Sense II/CS200", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x10 +{209, DeviceType::CONTROLLER, "ErP", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{218, DeviceType::CONTROLLER, "M200/RFM200", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x50 +{224, DeviceType::CONTROLLER, "9000i", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{229, DeviceType::CONTROLLER, "8700i", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{230, DeviceType::CONTROLLER, "BC Base", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 +{240, DeviceType::CONTROLLER, "Rego 3000", DeviceFlags::EMS_DEVICE_FLAG_IVT}, // 0x09 +{241, DeviceType::CONTROLLER, "Condens 5000i", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 // Thermostat - not currently supporting write operations, like the Easy/100 types - 0x18 -{202, DeviceType::THERMOSTAT, F("Logamatic TC100/Moduline Easy"), DeviceFlags::EMS_DEVICE_FLAG_EASY | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18, cannot write -{203, DeviceType::THERMOSTAT, F("EasyControl CT200"), DeviceFlags::EMS_DEVICE_FLAG_EASY | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18, cannot write +{202, DeviceType::THERMOSTAT, "Logamatic TC100/Moduline Easy", DeviceFlags::EMS_DEVICE_FLAG_EASY | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18, cannot write +{203, DeviceType::THERMOSTAT, "EasyControl CT200", DeviceFlags::EMS_DEVICE_FLAG_EASY | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18, cannot write // Thermostat - Buderus/Nefit/Bosch specific - 0x17 / 0x10 / 0x18 / 0x19-0x1B for hc2-4 / 0x38 -{ 65, DeviceType::THERMOSTAT, F("RC10"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N},// 0x17 -{ 67, DeviceType::THERMOSTAT, F("RC30"), DeviceFlags::EMS_DEVICE_FLAG_RC30_N},// 0x10 - based on RC35 -{ 77, DeviceType::THERMOSTAT, F("RC20/Moduline 300"), DeviceFlags::EMS_DEVICE_FLAG_RC20},// 0x17 -{ 78, DeviceType::THERMOSTAT, F("Moduline 400"), DeviceFlags::EMS_DEVICE_FLAG_RC30}, // 0x10 -{ 79, DeviceType::THERMOSTAT, F("RC10/Moduline 100"), DeviceFlags::EMS_DEVICE_FLAG_RC10},// 0x17 -{ 80, DeviceType::THERMOSTAT, F("Moduline 200"), DeviceFlags::EMS_DEVICE_FLAG_RC10}, // 0x17 -{ 86, DeviceType::THERMOSTAT, F("RC35"), DeviceFlags::EMS_DEVICE_FLAG_RC35}, // 0x10 -{ 90, DeviceType::THERMOSTAT, F("RC10/Moduline 100"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 -{ 93, DeviceType::THERMOSTAT, F("RC20RF"), DeviceFlags::EMS_DEVICE_FLAG_RC20}, // 0x19 -{ 94, DeviceType::THERMOSTAT, F("RFM20 Remote"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x18 -{151, DeviceType::THERMOSTAT, F("RC25"), DeviceFlags::EMS_DEVICE_FLAG_RC25}, // 0x17 -{157, DeviceType::THERMOSTAT, F("RC200/CW100"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18 -{158, DeviceType::THERMOSTAT, F("RC300/RC310/Moduline 3000/1010H/CW400/Sense II"), DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10 -{165, DeviceType::THERMOSTAT, F("RC100/Moduline 1000/1010"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18, 0x38 -{172, DeviceType::THERMOSTAT, F("Rego 2000/3000"), DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10 -{216, DeviceType::THERMOSTAT, F("CRF200S"), DeviceFlags::EMS_DEVICE_FLAG_CRF | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18 -{246, DeviceType::THERMOSTAT, F("Comfort+2RF"), DeviceFlags::EMS_DEVICE_FLAG_CRF | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18 +{ 65, DeviceType::THERMOSTAT, "RC10", DeviceFlags::EMS_DEVICE_FLAG_RC20_N},// 0x17 +{ 67, DeviceType::THERMOSTAT, "RC30", DeviceFlags::EMS_DEVICE_FLAG_RC30_N},// 0x10 - based on RC35 +{ 77, DeviceType::THERMOSTAT, "RC20/Moduline 300", DeviceFlags::EMS_DEVICE_FLAG_RC20},// 0x17 +{ 78, DeviceType::THERMOSTAT, "Moduline 400", DeviceFlags::EMS_DEVICE_FLAG_RC30}, // 0x10 +{ 79, DeviceType::THERMOSTAT, "RC10/Moduline 100", DeviceFlags::EMS_DEVICE_FLAG_RC10},// 0x17 +{ 80, DeviceType::THERMOSTAT, "Moduline 200", DeviceFlags::EMS_DEVICE_FLAG_RC10}, // 0x17 +{ 86, DeviceType::THERMOSTAT, "RC35", DeviceFlags::EMS_DEVICE_FLAG_RC35}, // 0x10 +{ 90, DeviceType::THERMOSTAT, "RC10/Moduline 100", DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 +{ 93, DeviceType::THERMOSTAT, "RC20RF", DeviceFlags::EMS_DEVICE_FLAG_RC20}, // 0x19 +{ 94, DeviceType::THERMOSTAT, "RFM20 Remote", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x18 +{151, DeviceType::THERMOSTAT, "RC25", DeviceFlags::EMS_DEVICE_FLAG_RC25}, // 0x17 +{157, DeviceType::THERMOSTAT, "RC200/CW100", DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18 +{158, DeviceType::THERMOSTAT, "RC300/RC310/Moduline 3000/1010H/CW400/Sense II", DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10 +{165, DeviceType::THERMOSTAT, "RC100/Moduline 1000/1010", DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18, 0x38 +{172, DeviceType::THERMOSTAT, "Rego 2000/3000", DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10 +{216, DeviceType::THERMOSTAT, "CRF200S", DeviceFlags::EMS_DEVICE_FLAG_CRF | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18 +{246, DeviceType::THERMOSTAT, "Comfort+2RF", DeviceFlags::EMS_DEVICE_FLAG_CRF | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18 // Thermostat - Sieger - 0x10 / 0x17 -{ 66, DeviceType::THERMOSTAT, F("ES72/RC20"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 or remote -{ 76, DeviceType::THERMOSTAT, F("ES73"), DeviceFlags::EMS_DEVICE_FLAG_RC30_N}, // 0x10 -{113, DeviceType::THERMOSTAT, F("ES72/RC20"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 +{ 66, DeviceType::THERMOSTAT, "ES72/RC20", DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 or remote +{ 76, DeviceType::THERMOSTAT, "ES73", DeviceFlags::EMS_DEVICE_FLAG_RC30_N}, // 0x10 +{113, DeviceType::THERMOSTAT, "ES72/RC20", DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 // Thermostat - Junkers - 0x10 -{105, DeviceType::THERMOSTAT, F("FW100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, -{106, DeviceType::THERMOSTAT, F("FW200"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, -{107, DeviceType::THERMOSTAT, F("FR100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model -{108, DeviceType::THERMOSTAT, F("FR110"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model -{109, DeviceType::THERMOSTAT, F("FB10"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, -{110, DeviceType::THERMOSTAT, F("FB100"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, -{111, DeviceType::THERMOSTAT, F("FR10"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model -{147, DeviceType::THERMOSTAT, F("FR50"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, -{191, DeviceType::THERMOSTAT, F("FR120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model -{192, DeviceType::THERMOSTAT, F("FW120"), DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, +{105, DeviceType::THERMOSTAT, "FW100", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, +{106, DeviceType::THERMOSTAT, "FW200", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, +{107, DeviceType::THERMOSTAT, "FR100", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model +{108, DeviceType::THERMOSTAT, "FR110", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model +{109, DeviceType::THERMOSTAT, "FB10", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, +{110, DeviceType::THERMOSTAT, "FB100", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, +{111, DeviceType::THERMOSTAT, "FR10", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model +{147, DeviceType::THERMOSTAT, "FR50", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, +{191, DeviceType::THERMOSTAT, "FR120", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model +{192, DeviceType::THERMOSTAT, "FW120", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, // Thermostat remote - 0x38 -{200, DeviceType::THERMOSTAT, F("RC100H"), DeviceFlags::EMS_DEVICE_FLAG_RC100H}, +{200, DeviceType::THERMOSTAT, "RC100H", DeviceFlags::EMS_DEVICE_FLAG_RC100H}, // Solar Modules - 0x30 (for solar), 0x2A, 0x41 (for ww) -{ 73, DeviceType::SOLAR, F("SM10"), DeviceFlags::EMS_DEVICE_FLAG_SM10}, -{101, DeviceType::SOLAR, F("ISM1"), DeviceFlags::EMS_DEVICE_FLAG_ISM}, -{103, DeviceType::SOLAR, F("ISM2"), DeviceFlags::EMS_DEVICE_FLAG_ISM}, -{162, DeviceType::SOLAR, F("SM50"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, -{163, DeviceType::SOLAR, F("SM100/MS100"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, -{164, DeviceType::SOLAR, F("SM200/MS200"), DeviceFlags::EMS_DEVICE_FLAG_SM100}, +{ 73, DeviceType::SOLAR, "SM10", DeviceFlags::EMS_DEVICE_FLAG_SM10}, +{101, DeviceType::SOLAR, "ISM1", DeviceFlags::EMS_DEVICE_FLAG_ISM}, +{103, DeviceType::SOLAR, "ISM2", DeviceFlags::EMS_DEVICE_FLAG_ISM}, +{162, DeviceType::SOLAR, "SM50", DeviceFlags::EMS_DEVICE_FLAG_SM100}, +{163, DeviceType::SOLAR, "SM100/MS100", DeviceFlags::EMS_DEVICE_FLAG_SM100}, +{164, DeviceType::SOLAR, "SM200/MS200", DeviceFlags::EMS_DEVICE_FLAG_SM100}, // Mixer Modules - 0x20-0x27 for HC, 0x28-0x29 for WWC and 0x11 for the MP100 -{ 69, DeviceType::MIXER, F("MM10"), DeviceFlags::EMS_DEVICE_FLAG_MM10}, -{100, DeviceType::MIXER, F("IPM"), DeviceFlags::EMS_DEVICE_FLAG_IPM}, -{102, DeviceType::MIXER, F("IPM"), DeviceFlags::EMS_DEVICE_FLAG_IPM}, -{159, DeviceType::MIXER, F("MM50"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, -{160, DeviceType::MIXER, F("MM100"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, -{161, DeviceType::MIXER, F("MM200"), DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, -{204, DeviceType::MIXER, F("MP100"), DeviceFlags::EMS_DEVICE_FLAG_MP}, // pool +{ 69, DeviceType::MIXER, "MM10", DeviceFlags::EMS_DEVICE_FLAG_MM10}, +{100, DeviceType::MIXER, "IPM", DeviceFlags::EMS_DEVICE_FLAG_IPM}, +{102, DeviceType::MIXER, "IPM", DeviceFlags::EMS_DEVICE_FLAG_IPM}, +{159, DeviceType::MIXER, "MM50", DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, +{160, DeviceType::MIXER, "MM100", DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, +{161, DeviceType::MIXER, "MM200", DeviceFlags::EMS_DEVICE_FLAG_MMPLUS}, +{204, DeviceType::MIXER, "MP100", DeviceFlags::EMS_DEVICE_FLAG_MP}, // pool // Heat Pumps - 0x38? -{252, DeviceType::HEATPUMP, F("HP Module"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{252, DeviceType::HEATPUMP, "HP Module", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Heat Pumps - 0x53 -{248, DeviceType::HEATPUMP, F("Hybrid Manager HM200"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{248, DeviceType::HEATPUMP, "Hybrid Manager HM200", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Connect devices - 0x02 -{171, DeviceType::CONNECT, F("OpenTherm Converter"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{205, DeviceType::CONNECT, F("Moduline Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{206, DeviceType::CONNECT, F("Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{171, DeviceType::CONNECT, "OpenTherm Converter", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{205, DeviceType::CONNECT, "Moduline Easy Connect", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{206, DeviceType::CONNECT, "Easy Connect", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Wireless sensor base - 0x50 -{236, DeviceType::CONNECT, F("Wireless sensor base"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, -{238, DeviceType::CONNECT, F("Wireless sensor base"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{236, DeviceType::CONNECT, "Wireless sensor base", DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{238, DeviceType::CONNECT, "Wireless sensor base", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Switches - 0x11 -{ 71, DeviceType::SWITCH, F("WM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 71, DeviceType::SWITCH, "WM10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // EM10 error contact and analog flowtemp control- 0x12 -{ 74, DeviceType::GATEWAY, F("Error Module EM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{ 74, DeviceType::GATEWAY, "Error Module EM10", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Gateways - 0x48 -{189, DeviceType::GATEWAY, F("KM200/MB LAN 2"), DeviceFlags::EMS_DEVICE_FLAG_NONE}, +{189, DeviceType::GATEWAY, "KM200/MB LAN 2", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // Generic - 0x40 or other with no product-id and no version -{0, DeviceType::GENERIC, F("unknown"), DeviceFlags::EMS_DEVICE_FLAG_NONE} +{0, DeviceType::GENERIC, "unknown", DeviceFlags::EMS_DEVICE_FLAG_NONE} // clang-format on diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 54b87ed2e..6b1b2cb93 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -24,7 +24,7 @@ REGISTER_FACTORY(Boiler, EMSdevice::DeviceType::BOILER) uuid::log::Logger Boiler::logger_{F_(boiler), uuid::log::Facility::CONSOLE}; -Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // alternative heatsource special messages diff --git a/src/devices/boiler.h b/src/devices/boiler.h index 78ea8c729..932fade40 100644 --- a/src/devices/boiler.h +++ b/src/devices/boiler.h @@ -25,7 +25,7 @@ namespace emsesp { class Boiler : public EMSdevice { public: - Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); private: static uuid::log::Logger logger_; diff --git a/src/devices/connect.cpp b/src/devices/connect.cpp index d242d0a5c..50df43c8a 100644 --- a/src/devices/connect.cpp +++ b/src/devices/connect.cpp @@ -22,7 +22,7 @@ namespace emsesp { REGISTER_FACTORY(Connect, EMSdevice::DeviceType::CONNECT); -Connect::Connect(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Connect::Connect(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { } diff --git a/src/devices/connect.h b/src/devices/connect.h index a29b711b1..8ad8769d6 100644 --- a/src/devices/connect.h +++ b/src/devices/connect.h @@ -25,7 +25,7 @@ namespace emsesp { class Connect : public EMSdevice { public: - Connect(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); }; } // namespace emsesp diff --git a/src/devices/controller.cpp b/src/devices/controller.cpp index 03e90a4a4..3dad2e8c1 100644 --- a/src/devices/controller.cpp +++ b/src/devices/controller.cpp @@ -22,7 +22,7 @@ namespace emsesp { REGISTER_FACTORY(Controller, EMSdevice::DeviceType::CONTROLLER); -Controller::Controller(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Controller::Controller(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // IVT broadcasts Thermostat time from controller (0x09) if display is off. if ((flags & 0x0F) == EMS_DEVICE_FLAG_IVT) { diff --git a/src/devices/controller.h b/src/devices/controller.h index e9efb73af..f3f0eeed8 100644 --- a/src/devices/controller.h +++ b/src/devices/controller.h @@ -25,7 +25,7 @@ namespace emsesp { class Controller : public EMSdevice { public: - Controller(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); void process_dateTime(std::shared_ptr telegram); diff --git a/src/devices/gateway.cpp b/src/devices/gateway.cpp index 9109e63ad..b4d5b38e8 100644 --- a/src/devices/gateway.cpp +++ b/src/devices/gateway.cpp @@ -22,7 +22,7 @@ namespace emsesp { REGISTER_FACTORY(Gateway, EMSdevice::DeviceType::GATEWAY); -Gateway::Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Gateway::Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char *name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { } diff --git a/src/devices/gateway.h b/src/devices/gateway.h index 4132780ec..ffbe7d033 100644 --- a/src/devices/gateway.h +++ b/src/devices/gateway.h @@ -25,7 +25,7 @@ namespace emsesp { class Gateway : public EMSdevice { public: - Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); }; } // namespace emsesp diff --git a/src/devices/generic.cpp b/src/devices/generic.cpp index e0f71eccf..7e2f969fc 100644 --- a/src/devices/generic.cpp +++ b/src/devices/generic.cpp @@ -24,7 +24,7 @@ REGISTER_FACTORY(Generic, EMSdevice::DeviceType::GENERIC); uuid::log::Logger Generic::logger_{F_(generic), uuid::log::Facility::CONSOLE}; -Generic::Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Generic::Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { } diff --git a/src/devices/generic.h b/src/devices/generic.h index 9eaabe860..23ed45326 100644 --- a/src/devices/generic.h +++ b/src/devices/generic.h @@ -25,7 +25,7 @@ namespace emsesp { class Generic : public EMSdevice { public: - Generic(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); private: static uuid::log::Logger logger_; diff --git a/src/devices/heatpump.cpp b/src/devices/heatpump.cpp index cbb5d1ec2..399452a90 100644 --- a/src/devices/heatpump.cpp +++ b/src/devices/heatpump.cpp @@ -22,7 +22,7 @@ namespace emsesp { REGISTER_FACTORY(Heatpump, EMSdevice::DeviceType::HEATPUMP); -Heatpump::Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Heatpump::Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // telegram handlers register_telegram_type(0x042B, F("HP1"), false, MAKE_PF_CB(process_HPMonitor1)); diff --git a/src/devices/heatpump.h b/src/devices/heatpump.h index fc8e51876..cf723e8ca 100644 --- a/src/devices/heatpump.h +++ b/src/devices/heatpump.h @@ -25,7 +25,7 @@ namespace emsesp { class Heatpump : public EMSdevice { public: - Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); private: uint8_t airHumidity_; diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index cbde2d4bb..fff55c6ad 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -24,7 +24,7 @@ REGISTER_FACTORY(Mixer, EMSdevice::DeviceType::MIXER); uuid::log::Logger Mixer::logger_{F_(mixer), uuid::log::Facility::CONSOLE}; -Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // Pool module if (flags == EMSdevice::EMS_DEVICE_FLAG_MP) { diff --git a/src/devices/mixer.h b/src/devices/mixer.h index 0a2c12039..35aa971c5 100644 --- a/src/devices/mixer.h +++ b/src/devices/mixer.h @@ -25,7 +25,7 @@ namespace emsesp { class Mixer : public EMSdevice { public: - Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand); + Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand); private: static uuid::log::Logger logger_; diff --git a/src/devices/solar.cpp b/src/devices/solar.cpp index 85b483eed..af1b8096c 100644 --- a/src/devices/solar.cpp +++ b/src/devices/solar.cpp @@ -24,7 +24,7 @@ REGISTER_FACTORY(Solar, EMSdevice::DeviceType::SOLAR); uuid::log::Logger Solar::logger_{F_(solar), uuid::log::Facility::CONSOLE}; -Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // telegram handlers if (flags == EMSdevice::EMS_DEVICE_FLAG_SM10) { diff --git a/src/devices/solar.h b/src/devices/solar.h index 363462cb6..0d3dd3c63 100644 --- a/src/devices/solar.h +++ b/src/devices/solar.h @@ -25,7 +25,7 @@ namespace emsesp { class Solar : public EMSdevice { public: - Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); private: static uuid::log::Logger logger_; diff --git a/src/devices/switch.cpp b/src/devices/switch.cpp index 12deddba7..0309b0fcd 100644 --- a/src/devices/switch.cpp +++ b/src/devices/switch.cpp @@ -22,7 +22,7 @@ namespace emsesp { REGISTER_FACTORY(Switch, EMSdevice::DeviceType::SWITCH); -Switch::Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // WM10 module, device_id 0x11 register_telegram_type(0x9C, F("WM10MonitorMessage"), false, MAKE_PF_CB(process_WM10MonitorMessage)); diff --git a/src/devices/switch.h b/src/devices/switch.h index 6b42976e2..ead1b73d6 100644 --- a/src/devices/switch.h +++ b/src/devices/switch.h @@ -25,7 +25,7 @@ namespace emsesp { class Switch : public EMSdevice { public: - Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * 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 char * version, const char * name, uint8_t flags, uint8_t brand); private: void process_WM10SetMessage(std::shared_ptr telegram); diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 36f9516cf..064194977 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -24,7 +24,7 @@ REGISTER_FACTORY(Thermostat, EMSdevice::DeviceType::THERMOSTAT); uuid::log::Logger Thermostat::logger_{F_(thermostat), uuid::log::Facility::CONSOLE}; -Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) +Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { uint8_t model = this->model(); diff --git a/src/devices/thermostat.h b/src/devices/thermostat.h index a926090dc..37170e13b 100644 --- a/src/devices/thermostat.h +++ b/src/devices/thermostat.h @@ -25,7 +25,7 @@ namespace emsesp { class Thermostat : public EMSdevice { public: - Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand); + Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand); class HeatingCircuit { public: HeatingCircuit(const uint8_t hc_num, const uint8_t model) diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 3c4ab5170..2a8a8321d 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -193,11 +193,11 @@ uint8_t EMSdevice::decode_brand(uint8_t value) { std::string EMSdevice::to_string() const { // for devices that haven't been lookup yet, don't show all details if (product_id_ == 0) { - return name_ + " (DeviceID:" + Helpers::hextoa(device_id_) + ")"; + return std::string(name_) + " (DeviceID:" + Helpers::hextoa(device_id_) + ")"; } if (brand_ == Brand::NO_BRAND) { - return name_ + " (DeviceID:" + Helpers::hextoa(device_id_) + ", ProductID:" + Helpers::itoa(product_id_) + ", Version:" + version_ + ")"; + return std::string(name_) + " (DeviceID:" + Helpers::hextoa(device_id_) + ", ProductID:" + Helpers::itoa(product_id_) + ", Version:" + version_ + ")"; } return brand_to_string() + " " + name_ + " (DeviceID:" + Helpers::hextoa(device_id_) + ", ProductID:" + Helpers::itoa(product_id_) + ", Version:" + version_ @@ -956,14 +956,13 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) { obj["n"] = name; } } - - // add the custom name, is optional - if (!dv.custom_fullname.empty()) { - obj["cn"] = dv.custom_fullname; - } } else { - // it's a command - obj["n"] = "!" + fullname; // prefix ! to fullname for commands + obj["n"] = "!" + fullname; // prefix commands with a ! + } + + // add the custom name, is optional + if (!dv.custom_fullname.empty()) { + obj["cn"] = dv.custom_fullname; } obj["m"] = dv.state >> 4; // send back the mask state. We're only interested in the high nibble diff --git a/src/emsdevice.h b/src/emsdevice.h index 0ff13ba38..1d21270bf 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -34,7 +34,7 @@ class EMSdevice { static constexpr uint8_t EMS_DEVICES_MAX_TELEGRAMS = 20; // device_type defines which derived class to use, e.g. BOILER, THERMOSTAT etc.. - EMSdevice(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const std::string & name, uint8_t flags, uint8_t brand) + EMSdevice(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : device_type_(device_type) , device_id_(device_id) , product_id_(product_id) @@ -104,11 +104,11 @@ class EMSdevice { return brand_; } - inline void name(const std::string & name) { + inline void name(const char * name) { name_ = name; } - inline std::string name() const { + inline const char * name() const { return name_; } @@ -424,14 +424,14 @@ class EMSdevice { bool has_entities() const; private: - uint8_t unique_id_; - uint8_t device_type_ = DeviceType::SYSTEM; - uint8_t device_id_ = 0; - uint8_t product_id_ = 0; - char version_[6]; - std::string name_; // the long name for the EMS model - uint8_t flags_ = 0; - uint8_t brand_ = Brand::NO_BRAND; + uint8_t unique_id_; + uint8_t device_type_ = DeviceType::SYSTEM; + uint8_t device_id_ = 0; + uint8_t product_id_ = 0; + char version_[6]; + const char * name_; // the long name for the EMS model + uint8_t flags_ = 0; + uint8_t brand_ = Brand::NO_BRAND; bool ha_config_done_ = false; bool has_update_ = false; diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 23f05c0a1..51f2a6fe9 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -945,7 +945,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const // find the name and flags in our database for (const auto & device : device_library_) { if (device.product_id == product_id && device.device_type == emsdevice->device_type()) { - emsdevice->name(std::move(read_flash_string(device.name))); + emsdevice->name(device.name); emsdevice->add_flags(device.flags); } } @@ -977,13 +977,12 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const // if we don't recognize the productID report it and add as a generic device if (device_p == nullptr) { LOG_NOTICE(F("Unrecognized EMS device (deviceID 0x%02X, productID %d). Please report on GitHub."), device_id, product_id); - std::string name("unknown"); emsdevices.push_back( - EMSFactory::add(DeviceType::GENERIC, device_id, product_id, version, name, DeviceFlags::EMS_DEVICE_FLAG_NONE, EMSdevice::Brand::NO_BRAND)); + EMSFactory::add(DeviceType::GENERIC, device_id, product_id, version, "unknown", DeviceFlags::EMS_DEVICE_FLAG_NONE, EMSdevice::Brand::NO_BRAND)); return false; // not found } - auto name = read_flash_string(device_p->name); + auto name = device_p->name; auto device_type = device_p->device_type; auto flags = device_p->flags; @@ -1029,7 +1028,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const } } - LOG_DEBUG(F("Adding new device %s (deviceID 0x%02X, productID %d, version %s)"), name.c_str(), device_id, product_id, version); + LOG_DEBUG(F("Adding new device %s (deviceID 0x%02X, productID %d, version %s)"), name, device_id, product_id, version); emsdevices.push_back(EMSFactory::add(device_type, device_id, product_id, version, name, flags, brand)); // assign a unique ID. Note that this is not actual unique after a restart as it's dependent on the order that devices are found diff --git a/src/emsesp.h b/src/emsesp.h index 4a31f7c5d..eed1f7643 100644 --- a/src/emsesp.h +++ b/src/emsesp.h @@ -251,10 +251,10 @@ class EMSESP { static constexpr uint8_t EMS_WAIT_KM_TIMEOUT = 60; // wait one minute struct Device_record { - uint8_t product_id; - EMSdevice::DeviceType device_type; - const __FlashStringHelper * name; - uint8_t flags; + uint8_t product_id; + EMSdevice::DeviceType device_type; + const char * name; + uint8_t flags; }; static std::vector device_library_; diff --git a/src/emsfactory.h b/src/emsfactory.h index a7542cce0..8b8145d33 100644 --- a/src/emsfactory.h +++ b/src/emsfactory.h @@ -55,12 +55,12 @@ class EMSFactory { } // Construct derived class returning an unique ptr - static auto add(const uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, std::string & name, uint8_t flags, uint8_t brand) + static auto add(const uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) -> std::unique_ptr { return std::unique_ptr(EMSFactory::makeRaw(device_type, device_id, product_id, version, name, flags, brand)); } - virtual auto construct(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, std::string & name, uint8_t flags, uint8_t brand) const + virtual auto construct(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) const -> EMSdevice * = 0; private: @@ -72,7 +72,7 @@ class EMSFactory { // Construct derived class returning a raw pointer // find which EMS device it is and use that class - static auto makeRaw(const uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, std::string & name, uint8_t flags, uint8_t brand) + static auto makeRaw(const uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) -> EMSdevice * { auto it = EMSFactory::getRegister().find(device_type); if (it != EMSFactory::getRegister().end()) { @@ -90,7 +90,7 @@ class ConcreteEMSFactory : EMSFactory { EMSFactory::registerFactory(device_type, this); } - auto construct(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, std::string & name, uint8_t flags, uint8_t brand) const + auto construct(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) const -> EMSdevice * { return new DerivedClass(device_type, device_id, product_id, version, name, flags, brand); } diff --git a/src/locale_translations.h b/src/locale_translations.h index fb8f9c17a..2160e3f7e 100644 --- a/src/locale_translations.h +++ b/src/locale_translations.h @@ -26,9 +26,11 @@ #define EMSESP_LOCALE_PL "pl" #define EMSESP_LOCALE_NO "no" -// translations are in order en, de, nl, se, pl, no.... +// translations are in order en, de,nl, se.... // if there is no translation, it will default to en +// MAKE_PSTR_LIST2(on, "on", "an", "aan", "på") // TODO remove + // General MAKE_PSTR_LIST(on, F("on"), F("an"), F("aan"), F("på")) MAKE_PSTR_LIST(off, F("off"), F("aus"), F("uit"), F("av")) @@ -171,7 +173,7 @@ MAKE_PSTR_LIST(cyl2, F("cyl 2"), F("Zyl_2"), F("Cil 2"), F("Cyl 2")) // Entity translations // Boiler MAKE_PSTR_LIST(wwtapactivated, F("wwtapactivated"), F("turn on/off"), F("Durchlauferhitzer aktiv"), F("zet aan/uit"), F("sätt på/av")) -MAKE_PSTR_LIST(reset, F("reset"), F("Reset"), F("Reset"), F("Reset"), F("Nollställ")) +MAKE_PSTR_LIST(reset, F("reset"), F("Reset"), F("Reset"), F("Nollställ"), F("reset")) MAKE_PSTR_LIST(oilPreHeat, F("oilpreheat"), F("oil preheating"), F("Ölvorwärmung"), F("Olie voorverwarming"), F("Förvärmning olja")) MAKE_PSTR_LIST(heatingActive, F("heatingactive"), F("heating active"), F("Heizen aktiv"), F("Verwarming actief"), F("Uppvärmning aktiv")) MAKE_PSTR_LIST(tapwaterActive, F("tapwateractive"), F("tapwater active"), F("Warmwasser aktiv"), F("Warm water actief"), F("Varmvatten aktiv")) @@ -208,7 +210,7 @@ MAKE_PSTR_LIST(curFlowTemp, F("Aktuell flödestemperatur")) MAKE_PSTR_LIST(retTemp, F("rettemp"), F("return temperature"), F("Rücklauftemperatur"), F("Retourtemperatuur"), F("Returtemperatur")) MAKE_PSTR_LIST(switchTemp, F("switchtemp"), F("mixing switch temperature"), F("Mischer Schalttemperatur"), F("Mixer temperatuur"), F("Blandartemperatur")) -MAKE_PSTR_LIST(sysPress, F("syspress"), F("system pressure"), F("Systemdruck"), F("Systeemdruk"), F("Systemtryck")) +MAKE_PSTR_LIST(sysPress, F("syspress"), F("system pressure"), F("Systemdruck"), F("Systeemdruk"), F("systemtryck")) MAKE_PSTR_LIST(boilTemp, F("boiltemp"), F("actual boiler temperature"), F("Kesseltemperatur"), F("Keteltemperatuur"), F("Temperatur Värmepanna")) MAKE_PSTR_LIST(exhaustTemp, F("exhausttemp"), F("exhaust temperature"), F("Abgastemperatur"), F("Uitlaattemperatuur"), F("Avgastemperatur")) MAKE_PSTR_LIST(burnGas, F("burngas"), F("gas"), F("Gas"), F("Gas"), F("Gas")) @@ -257,13 +259,13 @@ MAKE_PSTR_LIST(heatWorkMin, F("heatworkmin"), F("total heat operating time"), F( MAKE_PSTR_LIST(UBAuptime, F("ubauptime"), F("total UBA operating time"), F("Anlagen-Gesamtlaufzeit"), F("totale looptijd branderautomaat (UBA)"), F("Total Tid")) MAKE_PSTR_LIST(lastCode, F("lastcode"), F("last error code"), F("Fehlerspeicher"), F("Laatste foutcode"), F("Senaste Felkod")) MAKE_PSTR_LIST(serviceCode, F("servicecode"), F("service code"), F("Statusmeldung"), F("Statuscode"), F("Servicekod")) -MAKE_PSTR_LIST(serviceCodeNumber, F("servicecodenumber"), F("service code number"), F("Statusmeldungsnummer"), F("Status codenummer"), F("Servicekod")) +MAKE_PSTR_LIST(serviceCodeNumber, F("servicecodenumber"), F("service code number"), F("Statusmeldungsnummer"), F("Status codenummer"), F("Servicekodsnummer")) MAKE_PSTR_LIST(maintenanceMessage, F("maintenancemessage"), F("maintenance message"), F("Wartungsmeldung"), F("Onderhoudsmelding"), F("Servicemeddelande")) MAKE_PSTR_LIST(maintenanceDate, F("maintenancedate"), F("next maintenance date"), F("Wartungsdatum"), F("Onderhoudsdatum"), F("Datum nästa Service")) MAKE_PSTR_LIST(maintenanceType, F("maintenance"), F("maintenance scheduled"), F("Wartungsplan"), F("Onderhoud gepland"), F("Underhåll schemlagt")) MAKE_PSTR_LIST(maintenanceTime, F("maintenancetime"), F("time to next maintenance"), F("Wartung in"), F("Onderhoud in"), F("Tid till nästa underhåll")) MAKE_PSTR_LIST(emergencyOps, F("emergencyops"), F("emergency operation"), F("Notoperation"), F("Noodoperatie"), F("Nöddrift")) -MAKE_PSTR_LIST(emergencyTemp, F("emergencytemp"), F("emergency temperature"), F("Nottemperatur"), F("Noodtemperatuur"), F("Nöddrift temperatur")) +MAKE_PSTR_LIST(emergencyTemp, F("emergencytemp"), F("emergency temperature"), F("Nottemperatur"), F("Noodtemperatuur"), F("Nödtemperatur")) // heatpump/compress specific MAKE_PSTR_LIST(upTimeControl, F("uptimecontrol"), F("total operating time heat"), F("Betriebszeit Heizen gesamt"), F("Totale bedrijfstijd"), F("Total tid uppvärmning")) @@ -300,7 +302,7 @@ MAKE_PSTR_LIST(totalCompStarts, MAKE_PSTR_LIST(heatingStarts, F("heatingstarts"), F("heating control starts"), F("Heizen Starts"), F("Starts verwarmingsbedrijf"), F("Kompressorstarter Uppvärmning")) MAKE_PSTR_LIST(coolingStarts, F("coolingstarts"), F("cooling control starts"), F("Kühlen Starts"), F("Starts koelbedrijf"), F("Kompressorstarter Kyla")) MAKE_PSTR_LIST(poolStarts, F("poolstarts"), F("pool control starts"), F("Pool Starts"), F("Starts zwembadbedrijf"), F("Kompressorstarter Pool")) -MAKE_PSTR_LIST(nrgConsTotal, F("nrgconstotal"), F("total energy consumption"), F("Energieverbrauch gesamt"), F("Energieverbruik totaal"), F("Energiförbrukning Totalt")) +MAKE_PSTR_LIST(nrgConsTotal, F("nrgconstotal"), F("total energy consumption"), F("totaler Energieverbrauch"), F("Energieverbrauch gesamt"), F("Energieverbruik totaal")) MAKE_PSTR_LIST(nrgConsCompTotal, F("nrgconscomptotal"), F("total energy consumption compressor"), @@ -337,60 +339,60 @@ MAKE_PSTR_LIST(nrgSuppHeating, F("total energy supplied heating"), F("gesamte Energieabgabe heizen"), F("Opgewekte energie verwarmingsbedrijf"), - F("Tillförd energi uppvärmning")) + F("Tillförd energi Uppvärmning")) MAKE_PSTR_LIST(nrgSuppWw, F("nrgsuppww"), F("total energy warm supplied dhw"), F("gesamte Energieabgabe"), F("Opgewekte energie warmwaterbedrijf"), - F("Tillförd energi varmvatten")) + F("Tillförd energi Varmvatten")) MAKE_PSTR_LIST(nrgSuppCooling, F("nrgsuppcooling"), F("total energy supplied cooling"), F("gesamte Energieabgabe kühlen"), F("Opgewekte energie koelbedrijf"), - F("Tillförd energi kyla")) + F("Tillförd energi Kyla")) MAKE_PSTR_LIST(nrgSuppPool, F("nrgsupppool"), F("total energy supplied pool"), F("gesamte Energieabgabe Pool"), F("Opgewekte energie zwembadbedrijf"), - F("TIllförd energi pool")) + F("TIllförd energi Pool")) MAKE_PSTR_LIST(auxElecHeatNrgConsTotal, F("auxelecheatnrgconstotal"), F("total auxiliary electrical heater energy consumption"), F("Energieverbrauch el. Zusatzheizung"), F("Totaal energieverbruik electrisch verwarmingselement"), - F("Energiförbrukning elpatron")) + F("Energiförbrukning Elpatron")) MAKE_PSTR_LIST(auxElecHeatNrgConsHeating, F("auxelecheatnrgconsheating"), F("auxiliary electrical heater energy consumption heating"), F("Energieverbrauch el. Zusatzheizung Heizen"), F("Energieverbruik electrisch verwarmingselement voor verwarmingsbedrijf"), - F("Energiförbrukning elpatron uppvärmning")) + F("Energiförbrukning Elpatron Uppvärmning")) MAKE_PSTR_LIST(auxElecHeatNrgConsWW, F("auxelecheatnrgconsww"), F("auxiliary electrical heater energy consumption dhw"), F("Energieverbrauch el. Zusatzheizung"), F("Energieverbruik electrisch verwarmingselement voor warmwaterbedrijf"), - F("Energiförbrukning elpatron varmvatten")) + F("Energiförbrukning Elpatron Varmvatten")) MAKE_PSTR_LIST(auxElecHeatNrgConsPool, F("auxelecheatnrgconspool"), F("auxiliary electrical heater energy consumption pool"), F("Energieverbrauch el. Zusatzheizung Pool"), F("Energieverbruik electrisch verwarmingselement voor zwembadbedrijf"), - F("Energiförbrukning elpatron pool")) + F("Energiförbrukning Elpatron Pool")) MAKE_PSTR_LIST(hpCompOn, F("hpcompon"), F("hp compressor"), F("WP Kompressor"), F("WP compressor"), F("VP Kompressor")) MAKE_PSTR_LIST(hpHeatingOn, F("hpheatingon"), F("hp heating"), F("WP Heizen"), F("WP verwarmingsbedrijf"), F("VP Uppvärmning")) MAKE_PSTR_LIST(hpCoolingOn, F("hpcoolingon"), F("hp cooling"), F("WP Kühlen"), F("WP koelbedrijf"), F("VP Kyla")) MAKE_PSTR_LIST(hpWwOn, F("hpwwon"), F("hp dhw"), F("WP Warmwasser"), F("WP warmwaterbedrijf"), F("VP Varmvatten")) MAKE_PSTR_LIST(hpPoolOn, F("hppoolon"), F("hp pool"), F("WP Pool"), F("WP zwembadbedrijf"), F("VP Pool")) -MAKE_PSTR_LIST(hpBrinePumpSpd, F("hpbrinepumpspd"), F("brine pump speed"), F("Solepumpen-Geschw."), F("Snelheid pekelpomp"), F("Hastighet brine-pump")) +MAKE_PSTR_LIST(hpBrinePumpSpd, F("hpbrinepumpspd"), F("brine pump speed"), F("Solepumpen-Geschw."), F("Snelheid pekelpomp"), F("Hastighet Brine-pump")) MAKE_PSTR_LIST(hpCompSpd, F("hpcompspd"), F("compressor speed"), F("Kompressor-Geschw."), F("Snelheid compressor"), F("Kompressorhastighet")) -MAKE_PSTR_LIST(hpCircSpd, F("hpcircspd"), F("circulation pump speed"), F("Zirkulationspumpen-Geschw."), F("Snelheid circulatiepomp"), F("Hastighet cirkulationspump")) -MAKE_PSTR_LIST(hpBrineIn, F("hpbrinein"), F("brine in/evaporator"), F("Sole in/Verdampfer"), F("pekel in/verdamper"), F("Brine in (förångare)")) -MAKE_PSTR_LIST(hpBrineOut, F("hpbrineout"), F("brine out/condenser"), F("Sole aus/Kondensator"), F("pekel uit/condensor"), F("Brine ut (kondensor)")) +MAKE_PSTR_LIST(hpCircSpd, F("hpcircspd"), F("circulation pump speed"), F("Zirkulationspumpen-Geschw."), F("Snelheid circulatiepomp"), F("Hastighet Cirkulationspump")) +MAKE_PSTR_LIST(hpBrineIn, F("hpbrinein"), F("brine in/evaporator"), F("Sole in/Verdampfer"), F("pekel in/verdamper"), F("Brine in/förångare")) +MAKE_PSTR_LIST(hpBrineOut, F("hpbrineout"), F("brine out/condenser"), F("Sole aus/Kondensator"), F("pekel uit/condensor"), F("Brine ut/kondensor")) MAKE_PSTR_LIST(hpSuctionGas, F("hpsuctiongas"), F("suction gas"), F("Gasansaugung"), F("Gasaanzuiging"), F("Gasintag")) MAKE_PSTR_LIST(hpHotGas, F("hphotgas"), F("hot gas/compressed"), F("Heißgas/verdichtet"), F("heet gas/samengeperst"), F("Hetgas/komprimerad")) MAKE_PSTR_LIST(hpSwitchValve, F("hpswitchvalve"), F("switch valve"), F("Schaltventil"), F("schakelklep"), F("Växelventil")) @@ -650,14 +652,14 @@ MAKE_PSTR_LIST(wwOneTime, F("wwonetime"), F("one time charging"), F("Einmalladun MAKE_PSTR_LIST(wwDisinfecting, F("wwdisinfecting"), F("disinfecting"), F("Desinfizieren"), F("Desinfectie"), F("Desinficerar")) MAKE_PSTR_LIST(wwCharging, F("wwcharging"), F("charging"), F("Laden"), F("Laden"), F("Laddar")) MAKE_PSTR_LIST(wwChargeOptimization, F("wwchargeoptimization"), F("charge optimization"), F("Ladungsoptimierung"), F("laadoptimalisatie"), F("Laddningsoptimering")) -MAKE_PSTR_LIST(wwRecharging, F("wwrecharging"), F("recharging"), F("Nachladen"), F("herladen"), F("Laddar om")) +MAKE_PSTR_LIST(wwRecharging, F("wwrecharging"), F("recharging"), F("Nachladen"), F("herladen"), F("Omladdar")) MAKE_PSTR_LIST(wwTempOK, F("wwtempok"), F("temperature ok"), F("Temperatur ok"), F("Temperatuur OK"), F("Temperatur OK")) MAKE_PSTR_LIST(wwActive, F("wwactive"), F("active"), F("aktiv"), F("Actief"), F("Aktiv")) -MAKE_PSTR_LIST(ww3wayValve, F("ww3wayvalve"), F("3-way valve active"), F("3-Wegeventil aktiv"), F("3-wegklep actief"), F("Trevägsventil aktiv")) +MAKE_PSTR_LIST(ww3wayValve, F("ww3wayvalve"), F("3-way valve active"), F("3-Wegeventil aktiv"), F("3-wegklep actief"), F("Trevägsventil Aktiv")) MAKE_PSTR_LIST(wwSetPumpPower, F("wwsetpumppower"), F("set pump power"), F("Soll Pumpenleistung"), F("Streefwaarde pompvermogen"), F("Vald pumpeffekt")) MAKE_PSTR_LIST(wwMixerTemp, F("wwmixertemp"), F("mixer temperature"), F("Mischertemperatur"), F("Mixertemperatuur"), F("Blandningsventil-tempertur")) -MAKE_PSTR_LIST(wwStarts, F("wwstarts"), F("starts"), F("Anzahl Starts"), F("Aantal starts"), F("Antal starter")) -MAKE_PSTR_LIST(wwStarts2, F("wwstarts2"), F("control starts2"), F("Kreis 2 Anzahl Starts"), F("Aantal starts circuit 2"), F("Antal starter Krets 2")) +MAKE_PSTR_LIST(wwStarts, F("wwstarts"), F("starts"), F("Anzahl Starts"), F("Aantal starts"), F("Antal Starter")) +MAKE_PSTR_LIST(wwStarts2, F("wwstarts2"), F("control starts2"), F("Kreis 2 Anzahl Starts"), F("Aantal starts circuit 2"), F("Antal Starter Krets 2")) MAKE_PSTR_LIST(wwWorkM, F("wwworkm"), F("active time"), F("aktive Zeit"), F("Actieve tijd"), F("Aktiv Tid")) MAKE_PSTR_LIST(wwHystOn, F("wwhyston"), @@ -707,7 +709,7 @@ MAKE_PSTR_LIST(damping, F("damping outdoor temperature"), F("Dämpfung der Außentemperatur"), F("Demping buitentemperatuur"), - F("Utomhustemperatur dämpning")) + F("Dämpning Utomhustemperatur")) MAKE_PSTR_LIST(tempsensor1, F("inttemp1"), F("temperature sensor 1"), F("Temperatursensor 1"), F("Temperatuursensor 1"), F("Temperatursensor 1")) MAKE_PSTR_LIST(tempsensor2, F("inttemp2"), F("temperature sensor 2"), F("Temperatursensor 2"), F("Temperatuursensor 2"), F("Temperatursensor 2")) MAKE_PSTR_LIST(dampedoutdoortemp, @@ -715,7 +717,7 @@ MAKE_PSTR_LIST(dampedoutdoortemp, F("damped outdoor temperature"), F("gedämpfte Außentemperatur"), F("Gedempte buitentemperatuur"), - F("Utomhustemperatur dämpad")) + F("Dämpad Utomhustemperatur")) MAKE_PSTR_LIST(floordrystatus, F("floordry"), F("floor drying"), F("Estrichtrocknung"), F("Vloerdroogprogramma"), F("Golvtorkning")) MAKE_PSTR_LIST(floordrytemp, F("floordrytemp"), @@ -774,7 +776,7 @@ MAKE_PSTR_LIST(heattemp, F("heattemp"), F("heat temperature"), F("Heizen Tempera MAKE_PSTR_LIST(nighttemp, F("nighttemp"), F("night temperature"), F("Nachttemperatur"), F("Nachttemperatuur"), F("Nattemperatur")) MAKE_PSTR_LIST(nighttemp2, F("nighttemp"), F("night temperature T1"), F("Nachttemperatur T1"), F("Nachttemperatuur T1"), F("Nattemperatur T1")) MAKE_PSTR_LIST(ecotemp, F("ecotemp"), F("eco temperature"), F("eco Temperatur"), F("Temperatuur eco"), F("Eko-temperatur")) -MAKE_PSTR_LIST(manualtemp, F("manualtemp"), F("manual temperature"), F("manuelle Temperatur"), F("temperatuur handmatig"), F("Temperatur manuell styrning")) +MAKE_PSTR_LIST(manualtemp, F("manualtemp"), F("manual temperature"), F("manuelle Temperatur"), F("temperatuur handmatig"), F("Temperatur Manuell")) MAKE_PSTR_LIST(tempautotemp, F("tempautotemp"), F("temporary set temperature automode"), @@ -803,7 +805,7 @@ MAKE_PSTR_LIST(targetflowtemp, F("berechnete Vorlauftemperatur"), F("Berekende aanvoertemperatuur"), F("Målvärde Flödestemperatur")) -MAKE_PSTR_LIST(heatingtype, F("heatingtype"), F("heating type"), F("Heizungstyp"), F("Verwarmingstype"), F("Värmesystem")) +MAKE_PSTR_LIST(heatingtype, F("heatingtype"), F("heating type"), F("Heizungstyp"), F("Verwarmingstype"), F("Uppvärmningstyp")) MAKE_PSTR_LIST(summersetmode, F("summersetmode"), F("set summer mode"), F("Einstellung Sommerbetrieb"), F("Instelling zomerbedrijf"), F("Aktivera Sommarläge")) MAKE_PSTR_LIST(hpoperatingmode, F("hpoperatingmode"), diff --git a/src/mqtt.cpp b/src/mqtt.cpp index c5f930993..0ed29ea09 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -546,9 +546,9 @@ void Mqtt::on_connect() { StaticJsonDocument doc; // first time to connect if (connectcount_ == 1) { - doc["event"] = FJSON("start"); + doc["event"] = "start"; } else { - doc["event"] = FJSON("reconnect"); + doc["event"] = "reconnect"; } doc["version"] = EMSESP_APP_VERSION; @@ -620,20 +620,20 @@ void Mqtt::on_connect() { void Mqtt::ha_status() { StaticJsonDocument doc; - doc["uniq_id"] = FJSON("ems-esp-system"); + doc["uniq_id"] = "ems-esp-system"; doc["~"] = mqtt_base_; // default ems-esp - // doc["avty_t"] = FJSON("~/status"); // commented out, as it causes errors in HA sometimes - // doc["json_attr_t"] = FJSON("~/heartbeat"); // store also as HA attributes - doc["stat_t"] = FJSON("~/heartbeat"); - doc["object_id"] = FJSON("ems_esp_status"); - doc["name"] = FJSON("EMS-ESP status"); + // doc["avty_t"] = "~/status"; // commented out, as it causes errors in HA sometimes + // doc["json_attr_t"] = "~/heartbeat"; // store also as HA attributes + doc["stat_t"] = "~/heartbeat"; + doc["object_id"] = "ems_esp_status"; + doc["name"] = "EMS-ESP status"; doc["ic"] = F_(icondevice); - doc["val_tpl"] = FJSON("{{value_json['bus_status']}}"); + doc["val_tpl"] = "{{value_json['bus_status']}}"; JsonObject dev = doc.createNestedObject("dev"); dev["name"] = F_(EMSESP); // "EMS-ESP" dev["sw"] = "v" + std::string(EMSESP_APP_VERSION); - dev["mf"] = FJSON("proddy"); + dev["mf"] = "proddy"; dev["mdl"] = F_(EMSESP); // "EMS-ESP" JsonArray ids = dev.createNestedArray("ids"); ids.add("ems-esp"); diff --git a/src/shower.cpp b/src/shower.cpp index b9f537c4f..a481cf281 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -151,10 +151,10 @@ void Shower::set_shower_state(bool state, bool force) { ha_configdone_ = true; StaticJsonDocument doc; - doc["name"] = FJSON("Shower Active"); - doc["uniq_id"] = FJSON("shower_active"); + doc["name"] = "Shower Active"; + doc["uniq_id"] = "shower_active"; doc["~"] = Mqtt::base(); - doc["stat_t"] = FJSON("~/shower_active"); + doc["stat_t"] = "~/shower_active"; // always render boolean as strings for HA char result[10]; diff --git a/src/system.cpp b/src/system.cpp index 9498358f3..27008e1ae 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -528,11 +528,11 @@ void System::loop() { bool System::heartbeat_json(JsonObject & output) { uint8_t bus_status = EMSESP::bus_status(); if (bus_status == EMSESP::BUS_STATUS_TX_ERRORS) { - output["bus_status"] = FJSON("txerror"); + output["bus_status"] = "txerror"; } else if (bus_status == EMSESP::BUS_STATUS_CONNECTED) { - output["bus_status"] = FJSON("connected"); + output["bus_status"] = "connected"; } else { - output["bus_status"] = FJSON("disconnected"); + output["bus_status"] = "disconnected"; } output["uptime"] = uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3); @@ -1174,9 +1174,8 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp for (const auto & device_class : EMSFactory::device_handlers()) { for (const auto & emsdevice : EMSESP::emsdevices) { if (emsdevice && (emsdevice->device_type() == device_class.first)) { - JsonObject obj = devices.createNestedObject(); - obj["type"] = emsdevice->device_type_name(); - // obj["name"] = emsdevice->to_string(); + JsonObject obj = devices.createNestedObject(); + obj["type"] = emsdevice->device_type_name(); obj["name"] = emsdevice->name(); obj["device id"] = Helpers::hextoa(emsdevice->device_id()); obj["product id"] = emsdevice->product_id(); From 777c9db0f62e40d6e183feddde3cc6db2584e542 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 28 Sep 2022 15:47:27 +0200 Subject: [PATCH 02/28] remove flash --- lib/uuid-common/src/uuid/common.h | 3 +- lib/uuid-console/src/commands.cpp | 61 +- lib/uuid-console/src/shell.cpp | 34 +- lib/uuid-console/src/shell_log.cpp | 4 +- lib/uuid-console/src/uuid/console.h | 30 +- lib/uuid-log/src/format_level_lowercase.cpp | 22 +- lib/uuid-log/src/format_level_uppercase.cpp | 22 +- lib/uuid-log/src/format_timestamp_ms.cpp | 2 +- lib/uuid-log/src/log.cpp | 4 +- lib/uuid-log/src/uuid/log.h | 8 +- lib/uuid-syslog/src/syslog.cpp | 13 +- lib/uuid-telnet/src/telnet.cpp | 14 +- lib_standalone/Arduino.h | 5 +- src/analogsensor.cpp | 32 +- src/command.cpp | 48 +- src/command.h | 38 +- src/common.h | 18 +- src/console.cpp | 194 +-- src/dallassensor.cpp | 40 +- src/devices/boiler.cpp | 108 +- src/devices/controller.cpp | 2 +- src/devices/gateway.cpp | 2 +- src/devices/heatpump.cpp | 4 +- src/devices/mixer.cpp | 32 +- src/devices/solar.cpp | 56 +- src/devices/switch.cpp | 6 +- src/devices/thermostat.cpp | 146 +- src/emsdevice.cpp | 294 ++-- src/emsdevice.h | 146 +- src/emsdevicevalue.cpp | 46 +- src/emsdevicevalue.h | 71 +- src/emsesp.cpp | 141 +- src/helpers.cpp | 49 +- src/helpers.h | 15 +- src/locale_common.h | 84 +- src/locale_translations.h | 1718 ++++++++----------- src/mqtt.cpp | 206 ++- src/mqtt.h | 42 +- src/shower.cpp | 16 +- src/system.cpp | 208 ++- src/telegram.cpp | 46 +- src/test/test.cpp | 126 +- src/web/WebAPIService.cpp | 2 +- src/web/WebDataService.cpp | 4 +- src/web/WebStatusService.cpp | 22 +- 45 files changed, 1919 insertions(+), 2265 deletions(-) diff --git a/lib/uuid-common/src/uuid/common.h b/lib/uuid-common/src/uuid/common.h index 1a1ae18ea..578c3198a 100644 --- a/lib/uuid-common/src/uuid/common.h +++ b/lib/uuid-common/src/uuid/common.h @@ -85,7 +85,8 @@ std::string printable_to_string(const Printable & printable); * * @since 1.0.0 */ -using flash_string_vector = std::vector; + +using string_vector = std::vector; /** * Loop function that must be called regularly to detect a 32-bit diff --git a/lib/uuid-console/src/commands.cpp b/lib/uuid-console/src/commands.cpp index 1bd37b385..b611c1d73 100644 --- a/lib/uuid-console/src/commands.cpp +++ b/lib/uuid-console/src/commands.cpp @@ -42,30 +42,36 @@ namespace uuid { namespace console { -void Commands::add_command(const flash_string_vector & name, command_function function) { - add_command(0, 0, name, flash_string_vector{}, function, nullptr); +void Commands::add_command(const string_vector & name, command_function function) { + add_command(0, 0, name, string_vector{}, function, nullptr); } -void Commands::add_command(const flash_string_vector & name, const flash_string_vector & arguments, command_function function) { +void Commands::add_command(const string_vector & name, const string_vector & arguments, command_function function) { add_command(0, 0, name, arguments, function, nullptr); } -void Commands::add_command(const flash_string_vector & name, const flash_string_vector & arguments, command_function function, argument_completion_function arg_function) { +void Commands::add_command(const string_vector & name, const string_vector & arguments, command_function function, argument_completion_function arg_function) { add_command(0, 0, name, arguments, function, arg_function); } -void Commands::add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, command_function function) { - add_command(context, flags, name, flash_string_vector{}, function, nullptr); +void Commands::add_command(unsigned int context, unsigned int flags, const string_vector & name, command_function function) { + add_command(context, flags, name, string_vector{}, function, nullptr); } -void Commands::add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, const flash_string_vector & arguments, command_function function) { +void Commands::add_command(unsigned int context, unsigned int flags, const string_vector & name, const string_vector & arguments, command_function function) { add_command(context, flags, name, arguments, function, nullptr); } -void Commands::add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, const flash_string_vector & arguments, command_function function, argument_completion_function arg_function) { +void Commands::add_command(unsigned int context, + unsigned int flags, + const string_vector & name, + const string_vector & arguments, + command_function function, + argument_completion_function arg_function) { commands_.emplace(std::piecewise_construct, std::forward_as_tuple(context), std::forward_as_tuple(flags, name, arguments, function, arg_function)); } + // added by proddy // note we should really iterate and free up the lambda code and any flashstrings void Commands::remove_all_commands() { @@ -139,7 +145,7 @@ bool Commands::find_longest_common_prefix(const std::multimapsecond->name_.begin(), length))) { + if ((*std::next(first.begin(), length)) != (*std::next(command_it->second->name_.begin(), length))) { all_match = false; break; } @@ -152,7 +158,7 @@ bool Commands::find_longest_common_prefix(const std::multimap(first) + length) != pgm_read_byte(reinterpret_cast(*std::next(command_it->second->name_.begin(), component_prefix)) + length)) { + if (pgm_read_byte(reinterpret_cast(first) + length) + != pgm_read_byte(reinterpret_cast(*std::next(command_it->second->name_.begin(), component_prefix)) + length)) { all_match = false; break; } @@ -179,7 +186,8 @@ bool Commands::find_longest_common_prefix(const std::multimap 0) { - longest_name.push_back(std::move(read_flash_string(first).substr(0, chars_prefix))); + // TODO fix, no more PGM + longest_name.push_back(std::string(first).substr(0, chars_prefix)); return false; } } @@ -243,7 +251,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine } if (!temp_command_name.empty() && command_line.total_size() <= temp_command_name.size()) { - temp_command = std::make_unique(0, flash_string_vector{}, flash_string_vector{}, nullptr, nullptr); + temp_command = std::make_unique(0, string_vector{}, string_vector{}, nullptr, nullptr); count = 1; match = commands.partial.end(); result.replacement.trailing_space = whole_components; @@ -259,10 +267,11 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine auto & matching_command = match->second; for (auto & name : matching_command->name_) { - result.replacement->push_back(std::move(read_flash_string(name))); + result.replacement->push_back(std::move((name))); } - if (command_line.total_size() > result.replacement->size() && command_line.total_size() <= matching_command->name_.size() + matching_command->maximum_arguments()) { + if (command_line.total_size() > result.replacement->size() + && command_line.total_size() <= matching_command->name_.size() + matching_command->maximum_arguments()) { // Try to auto-complete arguments std::vector arguments{std::next(command_line->cbegin(), result.replacement->size()), command_line->cend()}; @@ -332,7 +341,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine remaining_help.escape_initial_parameters(); for (auto it = std::next(matching_command->arguments_.cbegin(), current_args_count); it != matching_command->arguments_.cend(); it++) { - remaining_help->push_back(std::move(read_flash_string(*it))); + remaining_help->push_back(std::move((*it))); } } @@ -380,7 +389,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine } for (; flash_name_it != command_it->second->name_.cend(); flash_name_it++) { - std::string name = read_flash_string(*flash_name_it); + std::string name = (*flash_name_it); // Skip parts of the command name that match the command line if (line_it != command_line->cend()) { @@ -403,7 +412,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine continue; } - help->push_back(std::move(read_flash_string(argument))); + help->push_back(std::move((argument))); } result.help.push_back(std::move(help)); @@ -416,7 +425,7 @@ Commands::Completion Commands::complete_command(Shell & shell, const CommandLine if (commands.exact.count(longest->first) == 1) { for (auto & name : longest->second->name_) { - result.replacement->push_back(std::move(read_flash_string(name))); + result.replacement->push_back(std::move((name))); // TODO remove all moves? } // Add a space because there are sub-commands for a command that has matched exactly @@ -449,7 +458,7 @@ Commands::Match Commands::find_command(Shell & shell, const CommandLine & comman auto line_it = command_line->cbegin(); for (; name_it != command.name_.cend() && line_it != command_line->cend(); name_it++, line_it++) { - std::string name = read_flash_string(*name_it); + std::string name = (*name_it); size_t found = name.rfind(*line_it, 0); if (found == std::string::npos) { @@ -499,12 +508,12 @@ void Commands::for_each_available_command(Shell & shell, apply_function f) const name.reserve(command_it->second.name_.size()); for (auto flash_name : command_it->second.name_) { - name.push_back(std::move(read_flash_string(flash_name))); + name.push_back(std::move((flash_name))); } arguments.reserve(command_it->second.arguments_.size()); for (auto flash_argument : command_it->second.arguments_) { - arguments.push_back(std::move(read_flash_string(flash_argument))); + arguments.push_back(std::move((flash_argument))); } f(name, arguments); @@ -512,7 +521,11 @@ void Commands::for_each_available_command(Shell & shell, apply_function f) const } } -Commands::Command::Command(unsigned int flags, const flash_string_vector name, const flash_string_vector arguments, command_function function, argument_completion_function arg_function) +Commands::Command::Command(unsigned int flags, + const string_vector name, + const string_vector arguments, + command_function function, + argument_completion_function arg_function) : flags_(flags) , name_(name) , arguments_(arguments) @@ -524,7 +537,7 @@ Commands::Command::~Command() { } size_t Commands::Command::minimum_arguments() const { - return std::count_if(arguments_.cbegin(), arguments_.cend(), [](const __FlashStringHelper * argument) { return pgm_read_byte(argument) == '<'; }); + return std::count_if(arguments_.cbegin(), arguments_.cend(), [](const char * argument) { return pgm_read_byte(argument) == '<'; }); } } // namespace console diff --git a/lib/uuid-console/src/shell.cpp b/lib/uuid-console/src/shell.cpp index f5ee26322..54d2f2079 100644 --- a/lib/uuid-console/src/shell.cpp +++ b/lib/uuid-console/src/shell.cpp @@ -135,8 +135,8 @@ void Shell::loop_one() { } } -void Shell::set_command_str(const __FlashStringHelper * str) { - line_buffer_ = read_flash_string(str); +void Shell::set_command_str(const char * str) { + line_buffer_ = (str); erase_current_line(); prompt_displayed_ = false; display_prompt(); @@ -262,30 +262,32 @@ void Shell::loop_normal() { } else if (esc_ == 1) { // pos1 cursor_ = line_buffer_.length(); } else if (esc_ == 11) { // F1 - set_command_str(F("help")); + + // TODO use flash here? + set_command_str(("help")); } else if (esc_ == 12) { // F2 - set_command_str(F("show")); + set_command_str(("show")); } else if (esc_ == 13) { // F3 - set_command_str(F("log notice")); + set_command_str(("log notice")); } else if (esc_ == 14) { // F4 - set_command_str(F("log info")); + set_command_str(("log info")); } else if (esc_ == 15) { // F5 - set_command_str(F("log debug")); + set_command_str(("log debug")); } else if (esc_ == 17) { // F6 - set_command_str(F("watch off")); + set_command_str(("watch off")); } else if (esc_ == 18) { // F7 - set_command_str(F("watch on")); + set_command_str(("watch on")); } else if (esc_ == 19) { // F8 - set_command_str(F("watch raw")); + set_command_str(("watch raw")); } else if (esc_ == 20) { // F9 - set_command_str(F("call system info")); + set_command_str(("call system info")); } else if (esc_ == 21) { // F10 - set_command_str(F("call system settings")); + set_command_str(("call system settings")); } else if (esc_ == 23) { // F11 - line_buffer_ = read_flash_string(F("call send \"0B \"")); + line_buffer_ = (("call send \"0B \"")); cursor_ = 1; } else if (esc_ == 24) { // F12 - set_command_str(F("log debug; watch raw")); + set_command_str(("log debug; watch raw")); } esc_ = 0; } else if (c >= '0' && (c <= '9')) { // numbers @@ -320,7 +322,7 @@ void Shell::loop_normal() { idle_time_ = uuid::get_uptime_ms(); } -Shell::PasswordData::PasswordData(const __FlashStringHelper * password_prompt, password_function && password_function) +Shell::PasswordData::PasswordData(const char * password_prompt, password_function && password_function) : password_prompt_(password_prompt) , password_function_(std::move(password_function)) { } @@ -452,7 +454,7 @@ void Shell::loop_blocking() { } } -void Shell::enter_password(const __FlashStringHelper * prompt, password_function function) { +void Shell::enter_password(const char * prompt, password_function function) { if (mode_ == Mode::NORMAL) { mode_ = Mode::PASSWORD; mode_data_ = std::make_unique(prompt, std::move(function)); diff --git a/lib/uuid-console/src/shell_log.cpp b/lib/uuid-console/src/shell_log.cpp index f9a38400e..3349270c0 100644 --- a/lib/uuid-console/src/shell_log.cpp +++ b/lib/uuid-console/src/shell_log.cpp @@ -30,8 +30,8 @@ namespace uuid { namespace console { -static const char __pstr__logger_name[] __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "shell"; -const uuid::log::Logger Shell::logger_{reinterpret_cast(__pstr__logger_name), uuid::log::Facility::LPR}; +static const char __pstr__logger_name[] = "shell"; +const uuid::log::Logger Shell::logger_{(__pstr__logger_name), uuid::log::Facility::LPR}; Shell::QueuedLogMessage::QueuedLogMessage(unsigned long id, std::shared_ptr && content) : id_(id) diff --git a/lib/uuid-console/src/uuid/console.h b/lib/uuid-console/src/uuid/console.h index 85e4a3031..d2c8a3727 100644 --- a/lib/uuid-console/src/uuid/console.h +++ b/lib/uuid-console/src/uuid/console.h @@ -335,7 +335,7 @@ class Shell : public std::enable_shared_from_this, public uuid::log::Hand * execution. * @since 0.1.0 */ - void enter_password(const __FlashStringHelper * prompt, password_function function); + void enter_password(const char * prompt, password_function function); /** * Stop executing anything on this shell for a period of time. @@ -682,10 +682,10 @@ class Shell : public std::enable_shared_from_this, public uuid::log::Hand * execution. * @since 0.1.0 */ - PasswordData(const __FlashStringHelper * password_prompt, password_function && password_function); + PasswordData(const char * password_prompt, password_function && password_function); ~PasswordData() override = default; - const __FlashStringHelper * password_prompt_; /*!< Prompt requesting password input. @since 0.1.0 */ + const char * password_prompt_; /*!< Prompt requesting password input. @since 0.1.0 */ password_function password_function_; /*!< Function to execute after password entry. @since 0.1.0 */ }; @@ -893,7 +893,7 @@ class Shell : public std::enable_shared_from_this, public uuid::log::Hand * @since 0.1.0 */ size_t vprintf(const __FlashStringHelper * format, va_list ap); - void set_command_str(const __FlashStringHelper * str); + void set_command_str(const char * str); static const uuid::log::Logger logger_; /*!< uuid::log::Logger instance for shells. @since 0.1.0 */ static std::set> shells_; /*!< Registered running shells to be executed. @since 0.1.0 */ @@ -1188,7 +1188,7 @@ class Commands { * executed. * @since 0.2.0 */ - void add_command(const flash_string_vector & name, command_function function); + void add_command(const string_vector & name, command_function function); /** * Add a command with arguments to the list of commands in this * container. @@ -1205,7 +1205,7 @@ class Commands { * executed. * @since 0.2.0 */ - void add_command(const flash_string_vector & name, const flash_string_vector & arguments, command_function function); + void add_command(const string_vector & name, const string_vector & arguments, command_function function); /** * Add a command with arguments and automatic argument completion * to the list of commands in this container. @@ -1224,7 +1224,7 @@ class Commands { * completions for this command. * @since 0.2.0 */ - void add_command(const flash_string_vector & name, const flash_string_vector & arguments, command_function function, argument_completion_function arg_function); + void add_command(const string_vector & name, const string_vector & arguments, command_function function, argument_completion_function arg_function); /** * Add a command with no arguments to the list of commands in this * container. @@ -1239,7 +1239,7 @@ class Commands { * executed. * @since 0.1.0 */ - void add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, command_function function); + void add_command(unsigned int context, unsigned int flags, const string_vector & name, command_function function); /** * Add a command with arguments to the list of commands in this * container. @@ -1257,7 +1257,7 @@ class Commands { * executed. * @since 0.1.0 */ - void add_command(unsigned int context, unsigned int flags, const flash_string_vector & name, const flash_string_vector & arguments, command_function function); + void add_command(unsigned int context, unsigned int flags, const string_vector & name, const string_vector & arguments, command_function function); /** * Add a command with arguments and automatic argument completion * to the list of commands in this container. @@ -1279,8 +1279,8 @@ class Commands { */ void add_command(unsigned int context, unsigned int flags, - const flash_string_vector & name, - const flash_string_vector & arguments, + const string_vector & name, + const string_vector & arguments, command_function function, argument_completion_function arg_function); @@ -1345,8 +1345,8 @@ class Commands { * @since 0.1.0 */ Command(unsigned int flags, - const flash_string_vector name, - const flash_string_vector arguments, + const string_vector name, + const string_vector arguments, command_function function, argument_completion_function arg_function); ~Command(); @@ -1372,8 +1372,8 @@ class Commands { } unsigned int flags_; /*!< Shell flags that must be set for this command to be available. @since 0.1.0 */ - const flash_string_vector name_; /*!< Name of the command as a std::vector of flash strings. @since 0.1.0 */ - const flash_string_vector arguments_; /*!< Help text for arguments that the command accepts as a std::vector of flash strings. @since 0.1.0 */ + const string_vector name_; /*!< Name of the command as a std::vector of flash strings. @since 0.1.0 */ + const string_vector arguments_; /*!< Help text for arguments that the command accepts as a std::vector of flash strings. @since 0.1.0 */ command_function function_; /*!< Function to be used when the command is executed. @since 0.1.0 */ argument_completion_function arg_function_; /*!< Function to be used to perform argument completions for this command. @since 0.1.0 */ diff --git a/lib/uuid-log/src/format_level_lowercase.cpp b/lib/uuid-log/src/format_level_lowercase.cpp index 03b386a13..159b24072 100644 --- a/lib/uuid-log/src/format_level_lowercase.cpp +++ b/lib/uuid-log/src/format_level_lowercase.cpp @@ -26,17 +26,17 @@ namespace uuid { namespace log { -static constexpr const char * pstr_level_lowercase_off __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "off"; -static constexpr const char * pstr_level_lowercase_emerg __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "emerg"; -static constexpr const char * pstr_level_lowercase_crit __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "crit"; -static constexpr const char * pstr_level_lowercase_alert __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "alert"; -static constexpr const char * pstr_level_lowercase_err __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "err"; -static constexpr const char * pstr_level_lowercase_warning __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "warning"; -static constexpr const char * pstr_level_lowercase_notice __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "notice"; -static constexpr const char * pstr_level_lowercase_info __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "info"; -static constexpr const char * pstr_level_lowercase_debug __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "debug"; -static constexpr const char * pstr_level_lowercase_trace __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "trace"; -static constexpr const char * pstr_level_lowercase_all __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "all"; +static constexpr const char * pstr_level_lowercase_off = "off"; +static constexpr const char * pstr_level_lowercase_emerg = "emerg"; +static constexpr const char * pstr_level_lowercase_crit = "crit"; +static constexpr const char * pstr_level_lowercase_alert = "alert"; +static constexpr const char * pstr_level_lowercase_err = "err"; +static constexpr const char * pstr_level_lowercase_warning = "warning"; +static constexpr const char * pstr_level_lowercase_notice = "notice"; +static constexpr const char * pstr_level_lowercase_info = "info"; +static constexpr const char * pstr_level_lowercase_debug = "debug"; +static constexpr const char * pstr_level_lowercase_trace = "trace"; +static constexpr const char * pstr_level_lowercase_all = "all"; static const __FlashStringHelper * log_level_lowercase[(int)Level::ALL - (int)Level::OFF + 1] __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = {reinterpret_cast(pstr_level_lowercase_off), diff --git a/lib/uuid-log/src/format_level_uppercase.cpp b/lib/uuid-log/src/format_level_uppercase.cpp index ca0d66677..259ea3dc3 100644 --- a/lib/uuid-log/src/format_level_uppercase.cpp +++ b/lib/uuid-log/src/format_level_uppercase.cpp @@ -26,17 +26,17 @@ namespace uuid { namespace log { -static constexpr const char * pstr_level_uppercase_off __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "OFF"; -static constexpr const char * pstr_level_uppercase_emerg __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "EMERG"; -static constexpr const char * pstr_level_uppercase_crit __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "CRIT"; -static constexpr const char * pstr_level_uppercase_alert __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "ALERT"; -static constexpr const char * pstr_level_uppercase_err __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "ERR"; -static constexpr const char * pstr_level_uppercase_warning __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "WARNING"; -static constexpr const char * pstr_level_uppercase_notice __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "NOTICE"; -static constexpr const char * pstr_level_uppercase_info __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "INFO"; -static constexpr const char * pstr_level_uppercase_debug __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "DEBUG"; -static constexpr const char * pstr_level_uppercase_trace __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "TRACE"; -static constexpr const char * pstr_level_uppercase_all __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "ALL"; +static constexpr const char * pstr_level_uppercase_off = "OFF"; +static constexpr const char * pstr_level_uppercase_emerg = "EMERG"; +static constexpr const char * pstr_level_uppercase_crit = "CRIT"; +static constexpr const char * pstr_level_uppercase_alert = "ALERT"; +static constexpr const char * pstr_level_uppercase_err = "ERR"; +static constexpr const char * pstr_level_uppercase_warning = "WARNING"; +static constexpr const char * pstr_level_uppercase_notice = "NOTICE"; +static constexpr const char * pstr_level_uppercase_info = "INFO"; +static constexpr const char * pstr_level_uppercase_debug = "DEBUG"; +static constexpr const char * pstr_level_uppercase_trace = "TRACE"; +static constexpr const char * pstr_level_uppercase_all = "ALL"; static const __FlashStringHelper * log_level_uppercase[(int)Level::ALL - (int)Level::OFF + 1] __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = {reinterpret_cast(pstr_level_uppercase_off), diff --git a/lib/uuid-log/src/format_timestamp_ms.cpp b/lib/uuid-log/src/format_timestamp_ms.cpp index 0c59c1ffa..3169980ca 100644 --- a/lib/uuid-log/src/format_timestamp_ms.cpp +++ b/lib/uuid-log/src/format_timestamp_ms.cpp @@ -47,7 +47,7 @@ std::string format_timestamp_ms(uint64_t timestamp_ms, unsigned int days_width) static std::vector text(10 + 1 /* days */ + 2 + 1 /* hours */ + 2 + 1 /* minutes */ + 2 + 1 /* seconds */ + 3 /* milliseconds */ + 1); - snprintf_P(text.data(), text.size(), PSTR("%0*lu+%02u:%02u:%02u.%03u"), std::min(days_width, 10U), days, hours, minutes, seconds, milliseconds); + snprintf(text.data(), text.size(), ("%0*lu+%02u:%02u:%02u.%03u"), std::min(days_width, 10U), days, hours, minutes, seconds, milliseconds); return text.data(); } diff --git a/lib/uuid-log/src/log.cpp b/lib/uuid-log/src/log.cpp index 72ca20e76..3b0fd926a 100644 --- a/lib/uuid-log/src/log.cpp +++ b/lib/uuid-log/src/log.cpp @@ -36,7 +36,7 @@ namespace log { std::map Logger::handlers_; Level Logger::level_ = Level::OFF; -Message::Message(uint64_t uptime_ms, Level level, Facility facility, const __FlashStringHelper * name, const std::string && text) +Message::Message(uint64_t uptime_ms, Level level, Facility facility, const char * name, const std::string && text) : uptime_ms(uptime_ms) , level(level) , facility(facility) @@ -44,7 +44,7 @@ Message::Message(uint64_t uptime_ms, Level level, Facility facility, const __Fla , text(std::move(text)) { } -Logger::Logger(const __FlashStringHelper * name, Facility facility) +Logger::Logger(const char * name, Facility facility) : name_(name) , facility_(facility){ diff --git a/lib/uuid-log/src/uuid/log.h b/lib/uuid-log/src/uuid/log.h index a0dba494d..956e4615f 100644 --- a/lib/uuid-log/src/uuid/log.h +++ b/lib/uuid-log/src/uuid/log.h @@ -231,7 +231,7 @@ struct Message { * @param[in] text Log message text. * @since 1.0.0 */ - Message(uint64_t uptime_ms, Level level, Facility facility, const __FlashStringHelper * name, const std::string && text); + Message(uint64_t uptime_ms, Level level, Facility facility, const char * name, const std::string && text); ~Message() = default; /** @@ -261,7 +261,7 @@ struct Message { * * @since 1.0.0 */ - const __FlashStringHelper * name; + const char * name; /** * Formatted log message text. @@ -331,7 +331,7 @@ class Logger { * * @since 1.0.0 */ - Logger(const __FlashStringHelper * name, Facility facility = Facility::LOCAL0); + Logger(const char * name, Facility facility = Facility::LOCAL0); ~Logger() = default; /** @@ -626,7 +626,7 @@ class Logger { static std::map handlers_; /*!< Registered log handlers. @since 1.0.0 */ static Level level_; /*!< Minimum global log level across all handlers. @since 1.0.0 */ - const __FlashStringHelper * name_; /*!< Logger name (flash string). @since 1.0.0 */ + const char * name_; /*!< Logger name (flash string). @since 1.0.0 */ const Facility facility_; /*!< Default logging facility for messages. @since 1.0.0 */ }; diff --git a/lib/uuid-syslog/src/syslog.cpp b/lib/uuid-syslog/src/syslog.cpp index 7f2c28b5a..2d9bcd4e8 100644 --- a/lib/uuid-syslog/src/syslog.cpp +++ b/lib/uuid-syslog/src/syslog.cpp @@ -82,13 +82,13 @@ #include #include -static const char __pstr__logger_name[] __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "syslog"; +static const char __pstr__logger_name[] = "syslog"; namespace uuid { namespace syslog { -uuid::log::Logger SyslogService::logger_{FPSTR(__pstr__logger_name), uuid::log::Facility::SYSLOG}; +uuid::log::Logger SyslogService::logger_{__pstr__logger_name, uuid::log::Facility::SYSLOG}; bool SyslogService::QueuedLogMessage::time_good_ = false; SyslogService::~SyslogService() { @@ -116,7 +116,7 @@ void SyslogService::remove_queued_messages(uuid::log::Level level) { } } - log_message_id_ -= offset; + log_message_id_ -= offset; log_message_fails_ += offset; } @@ -269,8 +269,8 @@ void SyslogService::loop() { operator<<(std::make_shared(uuid::get_uptime_ms(), uuid::log::Level::INFO, uuid::log::Facility::SYSLOG, - reinterpret_cast(__pstr__logger_name), - uuid::read_flash_string(F("-- MARK --")))); + (__pstr__logger_name), + (F("-- MARK --")))); } } } @@ -443,7 +443,8 @@ bool SyslogService::transmit(const QueuedLogMessage & message) { udp_.print('-'); } - udp_.printf_P(PSTR(" %s %s - - - "), hostname_.c_str(), uuid::read_flash_string(message.content_->name).c_str()); + // TODO should use flash? + udp_.printf_P(PSTR(" %s %s - - - "), hostname_.c_str(), (message.content_->name)); char id_c_str[15]; snprintf_P(id_c_str, sizeof(id_c_str), PSTR(" %lu: "), message.id_); diff --git a/lib/uuid-telnet/src/telnet.cpp b/lib/uuid-telnet/src/telnet.cpp index a1fc74a59..e40bc51d9 100644 --- a/lib/uuid-telnet/src/telnet.cpp +++ b/lib/uuid-telnet/src/telnet.cpp @@ -54,22 +54,20 @@ #endif #endif -static const char __pstr__logger_name[] __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = "telnet"; - namespace uuid { namespace telnet { -uuid::log::Logger TelnetService::logger_{FPSTR(__pstr__logger_name), uuid::log::Facility::DAEMON}; +uuid::log::Logger TelnetService::logger_{"telnet", uuid::log::Facility::DAEMON}; TelnetService::TelnetService(std::shared_ptr commands, unsigned int context, unsigned int flags) : TelnetService(DEFAULT_PORT, commands, context, flags) { } TelnetService::TelnetService(uint16_t port, std::shared_ptr commands, unsigned int context, unsigned int flags) - : TelnetService(port, [commands, context, flags](Stream & stream, const IPAddress & addr __attribute__((unused)), uint16_t port __attribute__((unused))) -> std::shared_ptr { - return std::make_shared(commands, stream, context, flags); - }) { + : TelnetService(port, + [commands, context, flags](Stream & stream, const IPAddress & addr __attribute__((unused)), uint16_t port __attribute__((unused))) + -> std::shared_ptr { return std::make_shared(commands, stream, context, flags); }) { } TelnetService::TelnetService(shell_factory_function shell_factory) @@ -145,7 +143,9 @@ void TelnetService::loop() { if (client) { if (connections_.size() >= maximum_connections_) { #if UUID_TELNET_HAVE_WIFICLIENT_REMOTE - logger_.info(F("New connection from [%s]:%u rejected (connection limit reached)"), uuid::printable_to_string(client.remoteIP()).c_str(), client.remotePort()); + logger_.info(F("New connection from [%s]:%u rejected (connection limit reached)"), + uuid::printable_to_string(client.remoteIP()).c_str(), + client.remotePort()); #else logger_.info(F("New connection rejected (connection limit reached)")); #endif diff --git a/lib_standalone/Arduino.h b/lib_standalone/Arduino.h index 85a750400..9f12a6f9b 100644 --- a/lib_standalone/Arduino.h +++ b/lib_standalone/Arduino.h @@ -68,11 +68,10 @@ void ledcWrite(uint8_t chan, uint32_t duty); #define PROGMEM #define PGM_P const char * -#define PSTR(s) s class __FlashStringHelper; #define FPSTR(string_literal) (reinterpret_cast(string_literal)) -#define F(string_literal) (FPSTR(PSTR(string_literal))) +#define F(string_literal) (FPSTR((string_literal))) int snprintf_P(char * str, size_t size, const char * format, ...); int vsnprintf_P(char * str, size_t size, const char * format, va_list ap); @@ -97,7 +96,7 @@ class Print { virtual size_t write(uint8_t c) = 0; virtual size_t write(const uint8_t * buffer, size_t size) = 0; size_t print(char c) { - return write((uint8_t)c); + return write((uint8_t)c); } size_t print(const char * data) { return write(reinterpret_cast(data), strlen(data)); diff --git a/src/analogsensor.cpp b/src/analogsensor.cpp index 7d066cc33..531e7a339 100644 --- a/src/analogsensor.cpp +++ b/src/analogsensor.cpp @@ -32,7 +32,7 @@ void AnalogSensor::start() { analogSetAttenuation(ADC_2_5db); // for all channels 1.5V - LOG_INFO(F("Starting Analog sensor service")); + LOG_INFO(("Starting Analog sensor service")); // Add API call for /info Command::add( @@ -44,7 +44,7 @@ void AnalogSensor::start() { EMSdevice::DeviceType::ANALOGSENSOR, F_(setvalue), [&](const char * value, const int8_t id) { return command_setvalue(value, id); }, - F("set io value"), // TODO this needs translating + ("set io value"), // TODO translate this CommandFlag::ADMIN_ONLY); Command::add( EMSdevice::DeviceType::ANALOGSENSOR, @@ -123,12 +123,12 @@ void AnalogSensor::reload() { for (auto & sensor : sensors_) { sensor.ha_registered = false; // force HA configs to be re-created if (sensor.type() == AnalogType::ADC) { - LOG_DEBUG(F("Adding analog ADC sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG(("Adding analog ADC sensor on GPIO%d"), sensor.gpio()); // analogSetPinAttenuation does not work with analogReadMilliVolts sensor.analog_ = 0; // initialize sensor.last_reading_ = 0; } else if (sensor.type() == AnalogType::COUNTER) { - LOG_DEBUG(F("Adding analog I/O Counter sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG(("Adding analog I/O Counter sensor on GPIO%d"), sensor.gpio()); pinMode(sensor.gpio(), INPUT_PULLUP); #ifndef ARDUINO_LOLIN_C3_MINI if (sensor.gpio() == 25 || sensor.gpio() == 26) { @@ -139,7 +139,7 @@ void AnalogSensor::reload() { sensor.poll_ = digitalRead(sensor.gpio()); publish_sensor(sensor); } else if (sensor.type() == AnalogType::TIMER || sensor.type() == AnalogType::RATE) { - LOG_DEBUG(F("Adding analog Timer/Rate sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG(("Adding analog Timer/Rate sensor on GPIO%d"), sensor.gpio()); pinMode(sensor.gpio(), INPUT_PULLUP); sensor.polltime_ = uuid::get_uptime(); sensor.last_polltime_ = uuid::get_uptime(); @@ -148,7 +148,7 @@ void AnalogSensor::reload() { sensor.set_value(0); publish_sensor(sensor); } else if (sensor.type() == AnalogType::DIGITAL_IN) { - LOG_DEBUG(F("Adding analog Read sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG(("Adding analog Read sensor on GPIO%d"), sensor.gpio()); pinMode(sensor.gpio(), INPUT_PULLUP); sensor.set_value(digitalRead(sensor.gpio())); // initial value sensor.set_uom(0); // no uom, just for safe measures @@ -156,7 +156,7 @@ void AnalogSensor::reload() { sensor.poll_ = digitalRead(sensor.gpio()); publish_sensor(sensor); } else if (sensor.type() == AnalogType::DIGITAL_OUT) { - LOG_DEBUG(F("Adding analog Write sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG(("Adding analog Write sensor on GPIO%d"), sensor.gpio()); pinMode(sensor.gpio(), OUTPUT); if (sensor.gpio() == 25 || sensor.gpio() == 26) { if (sensor.offset() > 255) { @@ -175,7 +175,7 @@ void AnalogSensor::reload() { sensor.set_uom(0); // no uom, just for safe measures publish_sensor(sensor); } else if (sensor.type() >= AnalogType::PWM_0) { - LOG_DEBUG(F("Adding PWM output sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG(("Adding PWM output sensor on GPIO%d"), sensor.gpio()); uint channel = sensor.type() - AnalogType::PWM_0; ledcSetup(channel, sensor.factor(), 13); ledcAttachPin(sensor.gpio(), channel); @@ -277,7 +277,7 @@ bool AnalogSensor::update(uint8_t gpio, const std::string & name, float offset, found_sensor = true; // found the record // see if it's marked for deletion if (type == AnalogType::MARK_DELETED) { - LOG_DEBUG(F("Removing analog sensor GPIO %d"), gpio); + LOG_DEBUG(("Removing analog sensor GPIO %d"), gpio); settings.analogCustomizations.remove(AnalogCustomization); } else { // update existing record @@ -286,7 +286,7 @@ bool AnalogSensor::update(uint8_t gpio, const std::string & name, float offset, AnalogCustomization.factor = factor; AnalogCustomization.uom = uom; AnalogCustomization.type = type; - LOG_DEBUG(F("Customizing existing analog GPIO %d"), gpio); + LOG_DEBUG(("Customizing existing analog GPIO %d"), gpio); } return StateUpdateResult::CHANGED; // persist the change } @@ -312,7 +312,7 @@ bool AnalogSensor::update(uint8_t gpio, const std::string & name, float offset, newSensor.uom = uom; newSensor.type = type; settings.analogCustomizations.push_back(newSensor); - LOG_DEBUG(F("Adding new customization for analog sensor GPIO %d"), gpio); + LOG_DEBUG(("Adding new customization for analog sensor GPIO %d"), gpio); return StateUpdateResult::CHANGED; // persist the change }, "local"); @@ -338,9 +338,9 @@ void AnalogSensor::publish_sensor(const Sensor & sensor) const { if (Mqtt::publish_single()) { char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; if (Mqtt::publish_single2cmd()) { - snprintf(topic, sizeof(topic), "%s/%s", read_flash_string(F_(analogsensor)).c_str(), sensor.name().c_str()); + snprintf(topic, sizeof(topic), "%s/%s", (F_(analogsensor)), sensor.name().c_str()); } else { - snprintf(topic, sizeof(topic), "%s%s/%s", read_flash_string(F_(analogsensor)).c_str(), "_data", sensor.name().c_str()); + snprintf(topic, sizeof(topic), "%s%s/%s", (F_(analogsensor)), "_data", sensor.name().c_str()); } char payload[10]; Mqtt::publish(topic, Helpers::render_value(payload, sensor.value(), 2)); // always publish as floats @@ -353,7 +353,7 @@ void AnalogSensor::remove_ha_topic(const uint8_t gpio) const { return; } #ifdef EMSESP_DEBUG - LOG_DEBUG(F("Removing HA config for analog sensor GPIO %d"), gpio); + LOG_DEBUG(("Removing HA config for analog sensor GPIO %d"), gpio); #endif char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; snprintf(topic, sizeof(topic), "sensor/%s/analogsensor_%d/config", Mqtt::basename().c_str(), gpio); @@ -403,7 +403,7 @@ void AnalogSensor::publish_values(const bool force) { // create HA config if (Mqtt::ha_enabled() && (!sensor.ha_registered || force)) { - LOG_DEBUG(F("Recreating HA config for analog sensor GPIO %d"), sensor.gpio()); + LOG_DEBUG(("Recreating HA config for analog sensor GPIO %d"), sensor.gpio()); StaticJsonDocument config; @@ -447,7 +447,7 @@ void AnalogSensor::publish_values(const bool force) { } } - Mqtt::publish(F("analogsensor_data"), doc.as()); + Mqtt::publish(("analogsensor_data"), doc.as()); } // called from emsesp.cpp, similar to the emsdevice->get_value_info diff --git a/src/command.cpp b/src/command.cpp index cae119bec..277c6135e 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -82,7 +82,7 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec // validate the device, make sure it exists uint8_t device_type = EMSdevice::device_name_2_device_type(device_s); if (!device_has_commands(device_type)) { - LOG_DEBUG(F("Command failed: unknown device '%s'"), device_s); + LOG_DEBUG(("Command failed: unknown device '%s'"), device_s); return message(CommandRet::ERROR, "unknown device", output); } @@ -170,15 +170,15 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec std::string Command::return_code_string(const uint8_t return_code) { switch (return_code) { case CommandRet::ERROR: - return read_flash_string(F("Error")); + return ("Error"); case CommandRet::OK: - return read_flash_string(F("OK")); + return ("OK"); case CommandRet::NOT_FOUND: - return read_flash_string(F("Not Found")); + return ("Not Found"); case CommandRet::NOT_ALLOWED: - return read_flash_string(F("Not Authorized")); + return ("Not Authorized"); case CommandRet::FAIL: - return read_flash_string(F("Failed")); + return ("Failed"); default: break; } @@ -248,7 +248,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * if ((device_type > EMSdevice::DeviceType::SYSTEM) && (!value || !strlen(value))) { if (!cf || !cf->cmdfunction_json_) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] Calling %s command '%s' to retrieve attributes"), dname.c_str(), cmd); + LOG_DEBUG(("[DEBUG] Calling %s command '%s' to retrieve attributes"), dname.c_str(), cmd); #endif return EMSESP::get_device_value_info(output, cmd, id, device_type) ? CommandRet::OK : CommandRet::ERROR; // entity = cmd } @@ -264,15 +264,15 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * if ((value == nullptr) || (strlen(value) == 0)) { if (EMSESP::system_.readonly_mode()) { - LOG_INFO(F("[readonly] Calling command '%s/%s' (%s)"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str()); + LOG_INFO(("[readonly] Calling command '%s/%s' (%s)"), dname.c_str(), cmd, cf->description_); } else { - LOG_DEBUG(F("Calling command '%s/%s' (%s)"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str()); + LOG_DEBUG(("Calling command '%s/%s' (%s)"), dname.c_str(), cmd, (cf->description_)); } } else { if (EMSESP::system_.readonly_mode()) { - LOG_INFO(F("[readonly] Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str(), value); + LOG_INFO(("[readonly] Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, cf->description_, value); } else { - LOG_DEBUG(F("Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, read_flash_string(cf->description_).c_str(), value); + LOG_DEBUG(("Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, (cf->description_), value); } } @@ -294,14 +294,14 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * } // we didn't find the command and its not an endpoint, report error - LOG_DEBUG(F("Command failed: invalid command '%s'"), cmd); + LOG_DEBUG(("Command failed: invalid command '%s'"), cmd); return message(CommandRet::NOT_FOUND, "invalid command", output); } // add a command to the list, which does not return json -void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, const cmd_function_p cb, const __FlashStringHelper * description, uint8_t flags) { +void Command::add(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * description, uint8_t flags) { // if the command already exists for that device type don't add it - if (find_command(device_type, read_flash_string(cmd).c_str()) != nullptr) { + if (find_command(device_type, cmd) != nullptr) { return; } @@ -314,9 +314,9 @@ void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, co } // add a command to the list, which does return a json object as output -void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, const cmd_json_function_p cb, const __FlashStringHelper * description, uint8_t flags) { +void Command::add(const uint8_t device_type, const char * cmd, const cmd_json_function_p cb, const char * description, uint8_t flags) { // if the command already exists for that device type don't add it - if (find_command(device_type, read_flash_string(cmd).c_str()) != nullptr) { + if (find_command(device_type, cmd) != nullptr) { return; } @@ -338,7 +338,7 @@ Command::CmdFunction * Command::find_command(const uint8_t device_type, const ch } for (auto & cf : cmdfunctions_) { - if (!strcmp(lowerCmd, Helpers::toLower(read_flash_string(cf.cmd_)).c_str()) && (cf.device_type_ == device_type)) { + if (!strcmp(lowerCmd, cf.cmd_) && (cf.device_type_ == device_type)) { return &cf; } } @@ -357,14 +357,14 @@ bool Command::list(const uint8_t device_type, JsonObject & output) { std::list sorted_cmds; for (const auto & cf : cmdfunctions_) { if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN)) { - sorted_cmds.push_back(read_flash_string(cf.cmd_)); + sorted_cmds.push_back((cf.cmd_)); } } sorted_cmds.sort(); for (const auto & cl : sorted_cmds) { for (const auto & cf : cmdfunctions_) { - if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == read_flash_string(cf.cmd_))) { + if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == std::string(cf.cmd_))) { output[cl] = cf.description_; } } @@ -376,7 +376,7 @@ bool Command::list(const uint8_t device_type, JsonObject & output) { // output list of all commands to console for a specific DeviceType void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbose) { if (cmdfunctions_.empty()) { - shell.println(F("No commands available")); + shell.println(("No commands available")); return; } @@ -384,7 +384,7 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo std::list sorted_cmds; for (const auto & cf : cmdfunctions_) { if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN)) { - sorted_cmds.push_back(read_flash_string(cf.cmd_)); + sorted_cmds.push_back((cf.cmd_)); } } sorted_cmds.sort(); @@ -404,7 +404,7 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo for (const auto & cl : sorted_cmds) { // find and print the description for (const auto & cf : cmdfunctions_) { - if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == read_flash_string(cf.cmd_))) { + if ((cf.device_type_ == device_type) && !cf.has_flags(CommandFlag::HIDDEN) && cf.description_ && (cl == std::string(cf.cmd_))) { uint8_t i = cl.length(); shell.print(" "); if (cf.has_flags(MQTT_SUB_FLAG_HC)) { @@ -424,7 +424,7 @@ void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbo shell.print(EMSdevice::tag_to_string(DeviceValueTAG::TAG_DEVICE_DATA_WW)); shell.print(' '); } - shell.print(read_flash_string(cf.description_).c_str()); + shell.print((cf.description_)); if (!cf.has_flags(CommandFlag::ADMIN_ONLY)) { shell.print(' '); shell.print(COLOR_BRIGHT_RED); @@ -497,7 +497,7 @@ void Command::show_devices(uuid::console::Shell & shell) { // output list of all commands to console // calls show with verbose mode set void Command::show_all(uuid::console::Shell & shell) { - shell.println(F("Available commands (*=do not need authorization): ")); + shell.println(("Available commands (*=do not need authorization): ")); // show system first shell.print(COLOR_BOLD_ON); diff --git a/src/command.h b/src/command.h index e12eab87a..8fe24a8b8 100644 --- a/src/command.h +++ b/src/command.h @@ -54,19 +54,19 @@ using cmd_json_function_p = std::function; #ifdef FPSTR #undef FPSTR @@ -40,20 +40,14 @@ using uuid::read_flash_string; // clang-format off -#define MAKE_STR(string_name, string_literal) static constexpr const char * __str__##string_name = string_literal; - -#define FPSTR(pstr_pointer) (reinterpret_cast(pstr_pointer)) -#define F_(string_name) FPSTR(__pstr__##string_name) - +#define FPSTR(pstr_pointer) pstr_pointer #define MAKE_PSTR(string_name, string_literal) static const char __pstr__##string_name[] = string_literal; #define MAKE_PSTR_WORD(string_name) MAKE_PSTR(string_name, #string_name) +#define F_(string_name) (__pstr__##string_name) #define FL_(list_name) (__pstr__L_##list_name) -#define MAKE_PSTR_LIST(list_name, ...) static const __FlashStringHelper * const __pstr__L_##list_name[] = {__VA_ARGS__, nullptr}; -#define MAKE_PSTR_ENUM(enum_name, ...) static const __FlashStringHelper * const * __pstr__L_##enum_name[] = {__VA_ARGS__, nullptr}; - -// #define MAKE_PSTR_LIST2(list_name, ...) static const char * const __pstr__L_##list_name2[] = {__VA_ARGS__, nullptr}; - +#define MAKE_PSTR_LIST(list_name, ...) static const char * const __pstr__L_##list_name[] = {__VA_ARGS__, nullptr}; +#define MAKE_PSTR_ENUM(enum_name, ...) static const char * const * __pstr__L_##enum_name[] = {__VA_ARGS__, nullptr}; // clang-format on diff --git a/src/console.cpp b/src/console.cpp index afce647ab..18880809e 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -45,26 +45,26 @@ EMSESPShell::EMSESPShell() } void EMSESPShell::started() { - logger().log(LogLevel::DEBUG, LogFacility::CONSOLE, F("User session opened on console %s"), console_name().c_str()); + logger().log(LogLevel::DEBUG, LogFacility::CONSOLE, ("User session opened on console %s"), console_name().c_str()); } void EMSESPShell::stopped() { if (has_flags(CommandFlags::ADMIN)) { - logger().log(LogLevel::DEBUG, LogFacility::AUTH, F("su session closed on console %s"), console_name().c_str()); + logger().log(LogLevel::DEBUG, LogFacility::AUTH, ("su session closed on console %s"), console_name().c_str()); } - logger().log(LogLevel::DEBUG, LogFacility::CONSOLE, F("User session closed on console %s"), console_name().c_str()); + logger().log(LogLevel::DEBUG, LogFacility::CONSOLE, ("User session closed on console %s"), console_name().c_str()); } // show welcome banner // this is one of the first functions called when the shell is started void EMSESPShell::display_banner() { println(); - printfln(F("┌──────────────────────────────────────┐")); - printfln(F("│ %sEMS-ESP version %-10s%s │"), COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF); - printfln(F("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │"), COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET); - printfln(F("│ │")); - printfln(F("│ type %shelp%s to show available commands │"), COLOR_UNDERLINE, COLOR_RESET); - printfln(F("└──────────────────────────────────────┘")); + printfln(("┌──────────────────────────────────────┐")); + printfln(("│ %sEMS-ESP version %-10s%s │"), COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF); + printfln(("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │"), COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET); + printfln(("│ │")); + printfln(("│ type %shelp%s to show available commands │"), COLOR_UNDERLINE, COLOR_RESET); + printfln(("└──────────────────────────────────────┘")); println(); // set console name @@ -100,9 +100,9 @@ void EMSESPShell::add_console_commands() { commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(show)}, + string_vector{F_(show)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { - shell.printfln(F("%s%sEMS-ESP version %s%s"), COLOR_BRIGHT_GREEN, COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_RESET); + shell.printfln(("%s%sEMS-ESP version %s%s"), COLOR_BRIGHT_GREEN, COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_RESET); shell.println(); EMSESP::show_device_values(shell); EMSESP::show_sensor_values(shell); @@ -110,36 +110,36 @@ void EMSESPShell::add_console_commands() { commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(show), F_(devices)}, + string_vector{F_(show), F_(devices)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { EMSESP::show_devices(shell); }); commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(show), F_(ems)}, + string_vector{F_(show), F_(ems)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { EMSESP::show_ems(shell); }); commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(show), F_(values)}, + string_vector{F_(show), F_(values)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { EMSESP::show_device_values(shell); }); commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(show), F_(mqtt)}, + string_vector{F_(show), F_(mqtt)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { Mqtt::show_mqtt(shell); }); commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(show), F_(commands)}, + string_vector{F_(show), F_(commands)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { Command::show_all(shell); }); commands->add_command( ShellContext::MAIN, CommandFlags::ADMIN, - flash_string_vector{F_(set), F_(bus_id)}, - flash_string_vector{F_(deviceid_mandatory)}, + string_vector{F_(set), F_(bus_id)}, + string_vector{F_(deviceid_mandatory)}, [](Shell & shell, const std::vector & arguments) { uint8_t device_id = Helpers::hextoint(arguments.front().c_str()); if ((device_id == 0x0B) || (device_id == 0x0D) || (device_id == 0x0A) || (device_id == 0x0F) || (device_id == 0x12)) { @@ -151,24 +151,24 @@ void EMSESPShell::add_console_commands() { }, "local"); } else { - shell.println(F("Must be 0B, 0D, 0A, 0F or 12")); + shell.println(("Must be 0B, 0D, 0A, 0F or 12")); } }, [](Shell & shell __attribute__((unused)), const std::vector & arguments __attribute__((unused))) -> const std::vector { return std::vector{ - read_flash_string(F("0B")), - read_flash_string(F("0D")), - read_flash_string(F("0A")), - read_flash_string(F("0F")), - read_flash_string(F("12")), + (("0B")), + (("0D")), + (("0A")), + (("0F")), + (("12")), }; }); commands->add_command(ShellContext::MAIN, CommandFlags::ADMIN, - flash_string_vector{F_(set), F_(tx_mode)}, - flash_string_vector{F_(n_mandatory)}, + string_vector{F_(set), F_(tx_mode)}, + string_vector{F_(n_mandatory)}, [](Shell & shell, const std::vector & arguments) { uint8_t tx_mode = std::strtol(arguments[0].c_str(), nullptr, 10); // save the tx_mode @@ -183,13 +183,13 @@ void EMSESPShell::add_console_commands() { commands->add_command(ShellContext::MAIN, CommandFlags::ADMIN, - flash_string_vector{F_(scan), F_(devices)}, - flash_string_vector{F_(deep_optional)}, + string_vector{F_(scan), F_(devices)}, + string_vector{F_(deep_optional)}, [](Shell & shell, const std::vector & arguments) { if (arguments.size() == 0) { EMSESP::scan_devices(); } else { - shell.printfln(F("Performing a deep scan...")); + shell.printfln(("Performing a deep scan...")); EMSESP::clear_all_devices(); std::vector Device_Ids; @@ -222,10 +222,10 @@ void EMSESPShell::add_console_commands() { commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(set)}, + string_vector{F_(set)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { EMSESP::webSettingsService.read([&](WebSettings & settings) { - shell.printfln(F("Language: %s"), settings.locale.c_str()); + shell.printfln(("Language: %s"), settings.locale.c_str()); shell.printfln(F_(tx_mode_fmt), settings.tx_mode); shell.printfln(F_(bus_id_fmt), settings.ems_bus_id); shell.printfln(F_(board_profile_fmt), settings.board_profile.c_str()); @@ -234,13 +234,13 @@ void EMSESPShell::add_console_commands() { commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(read)}, - flash_string_vector{F_(deviceid_mandatory), F_(typeid_mandatory), F_(offset_optional), F_(length_optional)}, + string_vector{F_(read)}, + string_vector{F_(deviceid_mandatory), F_(typeid_mandatory), F_(offset_optional), F_(length_optional)}, [=](Shell & shell __attribute__((unused)), const std::vector & arguments) { uint8_t device_id = Helpers::hextoint(arguments.front().c_str()); if (!EMSESP::valid_device(device_id)) { - shell.printfln(F("Invalid deviceID")); + shell.printfln(("Invalid deviceID")); return; } @@ -261,31 +261,31 @@ void EMSESPShell::add_console_commands() { #ifndef EMSESP_STANDALONE commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(set), F_(timeout)}, - flash_string_vector{F_(n_mandatory)}, + string_vector{F_(set), F_(timeout)}, + string_vector{F_(n_mandatory)}, [](Shell & shell, const std::vector & arguments) { uint16_t value = Helpers::atoint(arguments.front().c_str()); telnet_.initial_idle_timeout(value * 60); - shell.printfln(F("Telnet timeout set to %d minutes"), value); + shell.printfln(("Telnet timeout set to %d minutes"), value); }); #endif commands->add_command(ShellContext::MAIN, CommandFlags::USER, - flash_string_vector{F_(watch)}, - flash_string_vector{F_(watch_format_optional), F_(watchid_optional)}, + string_vector{F_(watch)}, + string_vector{F_(watch_format_optional), F_(watchid_optional)}, [](Shell & shell, const std::vector & arguments) { uint16_t watch_id = WATCH_ID_NONE; if (!arguments.empty()) { // get raw/pretty - if (arguments[0] == read_flash_string(F_(raw))) { + if (arguments[0] == (F_(raw))) { EMSESP::watch(EMSESP::WATCH_RAW); // raw - } else if (arguments[0] == Helpers::translated_word(FL_(on), true) || arguments[0] == read_flash_string(FL_(on)[0])) { + } else if (arguments[0] == Helpers::translated_word(FL_(on), true) || arguments[0] == (FL_(on)[0])) { EMSESP::watch(EMSESP::WATCH_ON); // on - } else if (arguments[0] == Helpers::translated_word(FL_(off), true) || arguments[0] == read_flash_string(FL_(off)[0])) { + } else if (arguments[0] == Helpers::translated_word(FL_(off), true) || arguments[0] == (FL_(off)[0])) { EMSESP::watch(EMSESP::WATCH_OFF); // off - } else if (arguments[0] == Helpers::translated_word(FL_(unknown), true) || arguments[0] == read_flash_string(FL_(unknown)[0])) { + } else if (arguments[0] == Helpers::translated_word(FL_(unknown), true) || arguments[0] == (FL_(unknown)[0])) { EMSESP::watch(EMSESP::WATCH_UNKNOWN); // unknown watch_id = WATCH_ID_NONE; } else { @@ -305,43 +305,43 @@ void EMSESPShell::add_console_commands() { EMSESP::watch_id(watch_id); } else { - shell.printfln(F("Invalid: use watch raw|on|off|unknown|id [id]")); + shell.printfln(("Invalid: use watch raw|on|off|unknown|id [id]")); return; } uint8_t watch = EMSESP::watch(); if (watch == EMSESP::WATCH_OFF) { - shell.printfln(F("Watching telegrams is off")); + shell.printfln(("Watching telegrams is off")); return; } // if logging is off, the watch won't show anything, show force it back to NOTICE if (shell.log_level() < Level::NOTICE) { shell.log_level(Level::NOTICE); - shell.printfln(F("Setting log level to Notice")); + shell.printfln(("Setting log level to Notice")); } if (watch == EMSESP::WATCH_ON) { - shell.printfln(F("Watching incoming telegrams, displayed in decoded format")); + shell.printfln(("Watching incoming telegrams, displayed in decoded format")); } else if (watch == EMSESP::WATCH_RAW) { - shell.printfln(F("Watching incoming telegrams, displayed as raw bytes")); // WATCH_RAW + shell.printfln(("Watching incoming telegrams, displayed as raw bytes")); // WATCH_RAW } else { - shell.printfln(F("Watching unknown telegrams")); // WATCH_UNKNOWN + shell.printfln(("Watching unknown telegrams")); // WATCH_UNKNOWN } watch_id = EMSESP::watch_id(); if (watch_id > 0x80) { - shell.printfln(F("Filtering only telegrams that match a telegram type of 0x%02X"), watch_id); + shell.printfln(("Filtering only telegrams that match a telegram type of 0x%02X"), watch_id); } else if (watch_id != WATCH_ID_NONE) { - shell.printfln(F("Filtering only telegrams that match a deviceID or telegram type of 0x%02X"), watch_id); + shell.printfln(("Filtering only telegrams that match a deviceID or telegram type of 0x%02X"), watch_id); } }); commands->add_command( ShellContext::MAIN, CommandFlags::ADMIN, - flash_string_vector{F_(call)}, - flash_string_vector{F_(device_type_optional), F_(cmd_optional), F_(data_optional), F_(id_optional)}, + string_vector{F_(call)}, + string_vector{F_(device_type_optional), F_(cmd_optional), F_(data_optional), F_(id_optional)}, [&](Shell & shell, const std::vector & arguments) { if (arguments.empty()) { Command::show_all(shell); // list options @@ -351,7 +351,7 @@ void EMSESPShell::add_console_commands() { // validate the device_type uint8_t device_type = EMSdevice::device_name_2_device_type(arguments[0].c_str()); if (!Command::device_has_commands(device_type)) { - shell.print(F("Invalid device. Available devices are: ")); + shell.print(("Invalid device. Available devices are: ")); Command::show_devices(shell); return; } @@ -359,7 +359,7 @@ void EMSESPShell::add_console_commands() { // validate that a command is present if (arguments.size() < 2) { - shell.print(F("Missing command. Available commands are: ")); + shell.print(("Missing command. Available commands are: ")); Command::show(shell, device_type, false); // non-verbose mode return; } @@ -399,11 +399,11 @@ void EMSESPShell::add_console_commands() { } if (return_code == CommandRet::NOT_FOUND) { - shell.println(F("Unknown command")); - shell.print(F("Available commands are: ")); + shell.println(("Unknown command")); + shell.print(("Available commands are: ")); Command::show(shell, device_type, false); // non-verbose mode } else if (return_code != CommandRet::OK) { - shell.printfln(F("Bad syntax (error code %d)"), return_code); + shell.printfln(("Bad syntax (error code %d)"), return_code); } }, [&](Shell & shell __attribute__((unused)), const std::vector & arguments) -> std::vector { @@ -424,7 +424,7 @@ void EMSESPShell::add_console_commands() { if (Command::device_has_commands(device_type)) { for (const auto & cf : Command::commands()) { if (cf.device_type_ == device_type) { - command_list.emplace_back(read_flash_string(cf.cmd_)); + command_list.emplace_back((cf.cmd_)); } } return command_list; @@ -448,8 +448,8 @@ void Console::load_standard_commands(unsigned int context) { // create commands test and t EMSESPShell::commands->add_command(context, CommandFlags::USER, - flash_string_vector{F("test")}, - flash_string_vector{F_(name_optional), F_(data_optional)}, + string_vector{("test")}, + string_vector{F_(name_optional), F_(data_optional)}, [](Shell & shell, const std::vector & arguments) { if (arguments.empty()) { Test::run_test(shell, "default"); @@ -460,7 +460,7 @@ void Console::load_standard_commands(unsigned int context) { } }); - EMSESPShell::commands->add_command(context, CommandFlags::USER, flash_string_vector{F("t")}, [](Shell & shell, const std::vector & arguments) { + EMSESPShell::commands->add_command(context, CommandFlags::USER, string_vector{("t")}, [](Shell & shell, const std::vector & arguments) { Test::run_test(shell, "default"); }); #endif @@ -468,8 +468,8 @@ void Console::load_standard_commands(unsigned int context) { #if defined(EMSESP_DEBUG) EMSESPShell::commands->add_command(context, CommandFlags::USER, - flash_string_vector{F_(debug)}, - flash_string_vector{F_(name_optional)}, + string_vector{F_(debug)}, + string_vector{F_(name_optional)}, [](Shell & shell, const std::vector & arguments) { if (arguments.empty()) { Test::debug(shell, "default"); @@ -482,8 +482,8 @@ void Console::load_standard_commands(unsigned int context) { EMSESPShell::commands->add_command( context, CommandFlags::USER, - flash_string_vector{F_(log)}, - flash_string_vector{F_(log_level_optional)}, + string_vector{F_(log)}, + string_vector{F_(log_level_optional)}, [](Shell & shell, const std::vector & arguments) { if (!arguments.empty()) { uuid::log::Level level; @@ -494,7 +494,7 @@ void Console::load_standard_commands(unsigned int context) { return; } } else { - shell.print(F("levels: ")); + shell.print(("levels: ")); std::vector v = uuid::log::levels_lowercase(); size_t i = v.size(); while (i--) { @@ -511,22 +511,22 @@ void Console::load_standard_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::USER, - flash_string_vector{F_(help)}, + string_vector{F_(help)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { shell.print_all_available_commands(); }); EMSESPShell::commands->add_command(context, CommandFlags::USER, - flash_string_vector{F_(exit)}, + string_vector{F_(exit)}, [=](Shell & shell, const std::vector & arguments __attribute__((unused))) { shell.stop(); }); EMSESPShell::commands->add_command(context, CommandFlags::USER, - flash_string_vector{F_(su)}, + string_vector{F_(su)}, [=](Shell & shell, const std::vector & arguments __attribute__((unused))) { auto become_admin = [](Shell & shell) { - shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, F("su session opened on console")); + shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, ("su session opened on console")); shell.add_flags(CommandFlags::ADMIN); }; @@ -542,8 +542,8 @@ void Console::load_standard_commands(unsigned int context) { become_admin(shell); } else { shell.delay_until(now + INVALID_PASSWORD_DELAY_MS, [](Shell & shell) { - shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, F("Invalid su password on console")); - shell.println(F("su: incorrect password")); + shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, ("Invalid su password on console")); + shell.println(("su: incorrect password")); }); } }); @@ -557,21 +557,21 @@ void Console::load_standard_commands(unsigned int context) { void Console::load_system_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(restart)}, + string_vector{F_(restart)}, [](Shell & shell __attribute__((unused)), const std::vector & arguments __attribute__((unused))) { EMSESP::system_.system_restart(); }); EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(wifi), F_(reconnect)}, + string_vector{F_(wifi), F_(reconnect)}, [](Shell & shell __attribute__((unused)), const std::vector & arguments __attribute__((unused))) { EMSESP::system_.wifi_reconnect(); }); EMSESPShell::commands->add_command(ShellContext::MAIN, CommandFlags::ADMIN, - flash_string_vector{F_(format)}, + string_vector{F_(format)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { shell.enter_password(F_(password_prompt), [=](Shell & shell, bool completed, const std::string & password) { if (completed) { @@ -579,7 +579,7 @@ void Console::load_system_commands(unsigned int context) { if (securitySettings.jwtSecret.equals(password.c_str())) { EMSESP::system_.format(shell); } else { - shell.println(F("incorrect password")); + shell.println(("incorrect password")); } }); } @@ -588,7 +588,7 @@ void Console::load_system_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(passwd)}, + string_vector{F_(passwd)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { shell.enter_password(F_(new_password_prompt1), [](Shell & shell, bool completed, const std::string & password1) { if (completed) { @@ -602,9 +602,9 @@ void Console::load_system_commands(unsigned int context) { return StateUpdateResult::CHANGED; }, "local"); - shell.println(F("su password updated")); + shell.println(("su password updated")); } else { - shell.println(F("Passwords do not match")); + shell.println(("Passwords do not match")); } } }); @@ -614,7 +614,7 @@ void Console::load_system_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::USER, - flash_string_vector{F_(show), F_(system)}, + string_vector{F_(show), F_(system)}, [=](Shell & shell, const std::vector & arguments __attribute__((unused))) { EMSESP::system_.show_system(shell); shell.println(); @@ -622,8 +622,8 @@ void Console::load_system_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(set), F_(hostname)}, - flash_string_vector{F_(name_mandatory)}, + string_vector{F_(set), F_(hostname)}, + string_vector{F_(name_mandatory)}, [](Shell & shell, const std::vector & arguments) { shell.println("The network connection will be reset..."); Shell::loop_all(); @@ -638,8 +638,8 @@ void Console::load_system_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(set), F_(wifi), F_(ssid)}, - flash_string_vector{F_(name_mandatory)}, + string_vector{F_(set), F_(wifi), F_(ssid)}, + string_vector{F_(name_mandatory)}, [](Shell & shell, const std::vector & arguments) { EMSESP::esp8266React.getNetworkSettingsService()->updateWithoutPropagation([&](NetworkSettings & networkSettings) { networkSettings.ssid = arguments.front().c_str(); @@ -651,8 +651,8 @@ void Console::load_system_commands(unsigned int context) { // added by mvdp EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F("mqtt"), F("subscribe")}, - flash_string_vector{F("")}, + string_vector{("mqtt"), ("subscribe")}, + string_vector{("")}, [](Shell & shell, const std::vector & arguments) { Mqtt::subscribe(arguments.front()); shell.println("subscribing"); @@ -660,7 +660,7 @@ void Console::load_system_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(set), F_(wifi), F_(password)}, + string_vector{F_(set), F_(wifi), F_(password)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { shell.enter_password(F_(new_password_prompt1), [](Shell & shell, bool completed, const std::string & password1) { if (completed) { @@ -675,7 +675,7 @@ void Console::load_system_commands(unsigned int context) { }); shell.println("Use `wifi reconnect` to save and apply the new settings"); } else { - shell.println(F("Passwords do not match")); + shell.println(("Passwords do not match")); } } }); @@ -685,13 +685,13 @@ void Console::load_system_commands(unsigned int context) { EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(set), F_(board_profile)}, - flash_string_vector{F_(name_mandatory)}, + string_vector{F_(set), F_(board_profile)}, + string_vector{F_(name_mandatory)}, [](Shell & shell, const std::vector & arguments) { std::vector data; // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode std::string board_profile = Helpers::toUpper(arguments.front()); if (!EMSESP::system_.load_board_profile(data, board_profile)) { - shell.println(F("Invalid board profile (S32, E32, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, CUSTOM)")); + shell.println(("Invalid board profile (S32, E32, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, CUSTOM)")); return; } EMSESP::webSettingsService.update( @@ -714,7 +714,7 @@ void Console::load_system_commands(unsigned int context) { }); EMSESPShell::commands->add_command(context, CommandFlags::ADMIN, - flash_string_vector{F_(show), F_(users)}, + string_vector{F_(show), F_(users)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { EMSESP::system_.show_users(shell); }); @@ -730,14 +730,14 @@ std::string EMSESPShell::prompt_suffix() { } void EMSESPShell::end_of_transmission() { - invoke_command(read_flash_string(F_(exit))); + invoke_command((F_(exit))); } EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, bool local) : uuid::console::Shell(commands, ShellContext::MAIN, local ? (CommandFlags::USER | CommandFlags::LOCAL) : CommandFlags::USER) , uuid::console::StreamConsole(stream) , EMSESPShell() - , name_(read_flash_string(F("Serial"))) + , name_((("Serial"))) , pty_(SIZE_MAX) , addr_() , port_(0) { @@ -763,14 +763,14 @@ EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, const IPAddress & addr snprintf(text.data(), text.size(), "pty%u", (uint16_t)pty_); name_ = text.data(); #ifndef EMSESP_STANDALONE - logger().info(F("Allocated console %s for connection from [%s]:%u"), name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); + logger().info(("Allocated console %s for connection from [%s]:%u"), name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); #endif } EMSESPStreamConsole::~EMSESPStreamConsole() { if (pty_ != SIZE_MAX) { #ifndef EMSESP_STANDALONE - logger().info(F("Shutdown console %s for connection from [%s]:%u"), name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); + logger().info(("Shutdown console %s for connection from [%s]:%u"), name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); #endif ptys_[pty_] = false; ptys_.shrink_to_fit(); diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index d02a8e8d0..32635c748 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -42,7 +42,7 @@ void DallasSensor::start() { #ifndef EMSESP_STANDALONE bus_.begin(dallas_gpio_); - LOG_INFO(F("Starting Dallas sensor service")); + LOG_INFO(("Starting Dallas sensor service")); #endif // Add API calls @@ -84,7 +84,7 @@ void DallasSensor::loop() { if (state_ == State::IDLE) { if (time_now - last_activity_ >= READ_INTERVAL_MS) { #ifdef EMSESP_DEBUG_SENSOR - LOG_DEBUG(F("[DEBUG] Read sensor temperature")); + LOG_DEBUG(("[DEBUG] Read sensor temperature")); #endif if (bus_.reset() || parasite_) { YIELD; @@ -99,7 +99,7 @@ void DallasSensor::loop() { if (++scanretry_ > SCAN_MAX) { // every 30 sec scanretry_ = 0; #ifdef EMSESP_DEBUG_SENSOR - LOG_ERROR(F("Bus reset failed")); + LOG_ERROR(("Bus reset failed")); #endif for (auto & sensor : sensors_) { sensor.temperature_c = EMS_VALUE_SHORT_NOTSET; @@ -112,13 +112,13 @@ void DallasSensor::loop() { } else if (state_ == State::READING) { if (temperature_convert_complete() && (time_now - last_activity_ > CONVERSION_MS)) { #ifdef EMSESP_DEBUG_SENSOR - LOG_DEBUG(F("Scanning for sensors")); + LOG_DEBUG(("Scanning for sensors")); #endif bus_.reset_search(); state_ = State::SCANNING; } else if (time_now - last_activity_ > READ_TIMEOUT_MS) { #ifdef EMSESP_DEBUG_SENSOR - LOG_WARNING(F("Dallas sensor read timeout")); + LOG_WARNING(("Dallas sensor read timeout")); #endif state_ = State::IDLE; sensorfails_++; @@ -126,7 +126,7 @@ void DallasSensor::loop() { } else if (state_ == State::SCANNING) { if (time_now - last_activity_ > SCAN_TIMEOUT_MS) { #ifdef EMSESP_DEBUG_SENSOR - LOG_ERROR(F("Dallas sensor scan timeout")); + LOG_ERROR(("Dallas sensor scan timeout")); #endif state_ = State::IDLE; sensorfails_++; @@ -181,12 +181,12 @@ void DallasSensor::loop() { default: sensorfails_++; - LOG_ERROR(F("Unknown dallas sensor %s"), Sensor(addr).id().c_str()); + LOG_ERROR(("Unknown dallas sensor %s"), Sensor(addr).id().c_str()); break; } } else { sensorfails_++; - LOG_ERROR(F("Invalid dallas sensor %s"), Sensor(addr).id().c_str()); + LOG_ERROR(("Invalid dallas sensor %s"), Sensor(addr).id().c_str()); } } else { if (!parasite_) { @@ -204,7 +204,7 @@ void DallasSensor::loop() { scancnt_ = 0; } else if (scancnt_ == SCAN_START + 1) { // startup firstscan_ = sensors_.size(); - // LOG_DEBUG(F("Adding %d dallas sensor(s) from first scan"), firstscan_); + // LOG_DEBUG(("Adding %d dallas sensor(s) from first scan"), firstscan_); } else if ((scancnt_ <= 0) && (firstscan_ != sensors_.size())) { // check 2 times for no change of sensor # scancnt_ = SCAN_START; sensors_.clear(); // restart scaning and clear to get correct numbering @@ -230,7 +230,7 @@ bool DallasSensor::temperature_convert_complete() { int16_t DallasSensor::get_temperature_c(const uint8_t addr[]) { #ifndef EMSESP_STANDALONE if (!bus_.reset()) { - LOG_ERROR(F("Bus reset failed before reading scratchpad from %s"), Sensor(addr).id().c_str()); + LOG_ERROR(("Bus reset failed before reading scratchpad from %s"), Sensor(addr).id().c_str()); return EMS_VALUE_SHORT_NOTSET; } YIELD; @@ -242,13 +242,13 @@ int16_t DallasSensor::get_temperature_c(const uint8_t addr[]) { YIELD; if (!bus_.reset()) { - LOG_ERROR(F("Bus reset failed after reading scratchpad from %s"), Sensor(addr).id().c_str()); + LOG_ERROR(("Bus reset failed after reading scratchpad from %s"), Sensor(addr).id().c_str()); return EMS_VALUE_SHORT_NOTSET; } YIELD; if (bus_.crc8(scratchpad, SCRATCHPAD_LEN - 1) != scratchpad[SCRATCHPAD_LEN - 1]) { - LOG_WARNING(F("Invalid scratchpad CRC: %02X%02X%02X%02X%02X%02X%02X%02X%02X from sensor %s"), + LOG_WARNING(("Invalid scratchpad CRC: %02X%02X%02X%02X%02X%02X%02X%02X%02X from sensor %s"), scratchpad[0], scratchpad[1], scratchpad[2], @@ -315,7 +315,7 @@ bool DallasSensor::update(const std::string & id, const std::string & name, int1 SensorCustomization.name = name; SensorCustomization.offset = offset; found = true; - LOG_DEBUG(F("Customizing existing sensor ID %s"), id.c_str()); + LOG_DEBUG(("Customizing existing sensor ID %s"), id.c_str()); break; } } @@ -325,7 +325,7 @@ bool DallasSensor::update(const std::string & id, const std::string & name, int1 newSensor.name = name; newSensor.offset = offset; settings.sensorCustomizations.push_back(newSensor); - LOG_DEBUG(F("Adding new customization for sensor ID %s"), id.c_str()); + LOG_DEBUG(("Adding new customization for sensor ID %s"), id.c_str()); } sensor.ha_registered = false; // it's changed so we may need to recreate the HA config return StateUpdateResult::CHANGED; @@ -426,9 +426,9 @@ void DallasSensor::publish_sensor(const Sensor & sensor) { if (Mqtt::publish_single()) { char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; if (Mqtt::publish_single2cmd()) { - snprintf(topic, sizeof(topic), "%s/%s", read_flash_string(F_(dallassensor)).c_str(), sensor.name().c_str()); + snprintf(topic, sizeof(topic), "%s/%s", (F_(dallassensor)), sensor.name().c_str()); } else { - snprintf(topic, sizeof(topic), "%s%s/%s", read_flash_string(F_(dallassensor)).c_str(), "_data", sensor.name().c_str()); + snprintf(topic, sizeof(topic), "%s%s/%s", (F_(dallassensor)), "_data", sensor.name().c_str()); } char payload[10]; Mqtt::publish(topic, Helpers::render_value(payload, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); @@ -441,7 +441,7 @@ void DallasSensor::remove_ha_topic(const std::string & id) { return; } #ifdef EMSESP_DEBUG - LOG_DEBUG(F("Removing HA config for temperature sensor ID %s"), id.c_str()); + LOG_DEBUG(("Removing HA config for temperature sensor ID %s"), id.c_str()); #endif // use '_' as HA doesn't like '-' in the topic name std::string sensorid = id; @@ -483,7 +483,7 @@ void DallasSensor::publish_values(const bool force) { // to e.g. homeassistant/sensor/ems-esp/dallassensor_28-233D-9497-0C03/config if (Mqtt::ha_enabled()) { if (!sensor.ha_registered || force) { - LOG_DEBUG(F("Recreating HA config for sensor ID %s"), sensor.id().c_str()); + LOG_DEBUG(("Recreating HA config for sensor ID %s"), sensor.id().c_str()); StaticJsonDocument config; config["dev_cla"] = "temperature"; @@ -530,7 +530,7 @@ void DallasSensor::publish_values(const bool force) { } } - Mqtt::publish(F("dallassensor_data"), doc.as()); + Mqtt::publish(("dallassensor_data"), doc.as()); } @@ -574,7 +574,7 @@ bool DallasSensor::Sensor::apply_customization() { if (!sensors.empty()) { for (const auto & sensor : sensors) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("Loading customization for dallas sensor %s"), sensor.id.c_str()); + LOG_DEBUG(("Loading customization for dallas sensor %s"), sensor.id.c_str()); #endif if (id_ == sensor.id) { set_name(sensor.name); diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 6b1b2cb93..def57f8c4 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -29,11 +29,11 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const // alternative heatsource special messages if (device_id == EMSdevice::EMS_DEVICE_ID_AM200) { - register_telegram_type(0x54D, F("AmTemperatures"), false, MAKE_PF_CB(process_amTempMessage)); - register_telegram_type(0x54E, F("AmStatus"), false, MAKE_PF_CB(process_amStatusMessage)); - register_telegram_type(0x54F, F("AmCommand"), false, MAKE_PF_CB(process_amCommandMessage)); // not broadcasted, but actually not used - register_telegram_type(0x550, F("AmExtra"), false, MAKE_PF_CB(process_amExtraMessage)); - register_telegram_type(0x54C, F("AmSettings"), true, MAKE_PF_CB(process_amSettingMessage)); // not broadcasted + register_telegram_type(0x54D, ("AmTemperatures"), false, MAKE_PF_CB(process_amTempMessage)); + register_telegram_type(0x54E, ("AmStatus"), false, MAKE_PF_CB(process_amStatusMessage)); + register_telegram_type(0x54F, ("AmCommand"), false, MAKE_PF_CB(process_amCommandMessage)); // not broadcasted, but actually not used + register_telegram_type(0x550, ("AmExtra"), false, MAKE_PF_CB(process_amExtraMessage)); + register_telegram_type(0x54C, ("AmSettings"), true, MAKE_PF_CB(process_amSettingMessage)); // not broadcasted register_device_value(DeviceValueTAG::TAG_AHS, &curFlowTemp_, @@ -113,12 +113,12 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const if (device_id >= EMSdevice::EMS_DEVICE_ID_BOILER_1) { uint8_t hs = device_id - EMSdevice::EMS_DEVICE_ID_BOILER_1; // heating source id, count from 0 // Runtime of each heatingsource in 0x06DC, ff - register_telegram_type(0x6DC + hs, F("CascadeMessage"), false, MAKE_PF_CB(process_CascadeMessage)); + register_telegram_type(0x6DC + hs, ("CascadeMessage"), false, MAKE_PF_CB(process_CascadeMessage)); register_device_value(DeviceValueTAG::TAG_HS1 + hs, &burnWorkMin_, DeviceValueType::TIME, FL_(burnWorkMin), DeviceValueUOM::MINUTES); // selBurnpower in D2 and E4 - // register_telegram_type(0xD2, F("CascadePowerMessage"), false, MAKE_PF_CB(process_CascadePowerMessage)); + // register_telegram_type(0xD2, ("CascadePowerMessage"), false, MAKE_PF_CB(process_CascadePowerMessage)); // individual Flowtemps and powervalues for each heatingsource in E4 - register_telegram_type(0xE4, F("UBAMonitorFastPlus"), false, MAKE_PF_CB(process_UBAMonitorFastPlus)); + register_telegram_type(0xE4, ("UBAMonitorFastPlus"), false, MAKE_PF_CB(process_UBAMonitorFastPlus)); register_device_value(DeviceValueTAG::TAG_HS1 + hs, &selFlowTemp_, DeviceValueType::UINT, FL_(selFlowTemp), DeviceValueUOM::DEGREES); register_device_value(DeviceValueTAG::TAG_HS1 + hs, &selBurnPow_, DeviceValueType::UINT, FL_(selBurnPow), DeviceValueUOM::PERCENT); register_device_value(DeviceValueTAG::TAG_HS1 + hs, @@ -136,48 +136,48 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const // the telegram handlers... // common for all boilers - register_telegram_type(0xBF, F("ErrorMessage"), false, MAKE_PF_CB(process_ErrorMessage)); - register_telegram_type(0x10, F("UBAErrorMessage1"), false, MAKE_PF_CB(process_UBAErrorMessage)); - register_telegram_type(0x11, F("UBAErrorMessage2"), false, MAKE_PF_CB(process_UBAErrorMessage)); - register_telegram_type(0xC2, F("UBAErrorMessage3"), false, MAKE_PF_CB(process_UBAErrorMessage2)); - register_telegram_type(0x14, F("UBATotalUptime"), true, MAKE_PF_CB(process_UBATotalUptime)); - register_telegram_type(0x15, F("UBAMaintenanceData"), false, MAKE_PF_CB(process_UBAMaintenanceData)); - register_telegram_type(0x1C, F("UBAMaintenanceStatus"), false, MAKE_PF_CB(process_UBAMaintenanceStatus)); + register_telegram_type(0xBF, ("ErrorMessage"), false, MAKE_PF_CB(process_ErrorMessage)); + register_telegram_type(0x10, ("UBAErrorMessage1"), false, MAKE_PF_CB(process_UBAErrorMessage)); + register_telegram_type(0x11, ("UBAErrorMessage2"), false, MAKE_PF_CB(process_UBAErrorMessage)); + register_telegram_type(0xC2, ("UBAErrorMessage3"), false, MAKE_PF_CB(process_UBAErrorMessage2)); + register_telegram_type(0x14, ("UBATotalUptime"), true, MAKE_PF_CB(process_UBATotalUptime)); + register_telegram_type(0x15, ("UBAMaintenanceData"), false, MAKE_PF_CB(process_UBAMaintenanceData)); + register_telegram_type(0x1C, ("UBAMaintenanceStatus"), false, MAKE_PF_CB(process_UBAMaintenanceStatus)); // EMS1.0 and maybe EMS+? - register_telegram_type(0x18, F("UBAMonitorFast"), false, MAKE_PF_CB(process_UBAMonitorFast)); - register_telegram_type(0x19, F("UBAMonitorSlow"), false, MAKE_PF_CB(process_UBAMonitorSlow)); - register_telegram_type(0x1A, F("UBASetPoints"), false, MAKE_PF_CB(process_UBASetPoints)); - register_telegram_type(0x35, F("UBAFlags"), false, MAKE_PF_CB(process_UBAFlags)); + register_telegram_type(0x18, ("UBAMonitorFast"), false, MAKE_PF_CB(process_UBAMonitorFast)); + register_telegram_type(0x19, ("UBAMonitorSlow"), false, MAKE_PF_CB(process_UBAMonitorSlow)); + register_telegram_type(0x1A, ("UBASetPoints"), false, MAKE_PF_CB(process_UBASetPoints)); + register_telegram_type(0x35, ("UBAFlags"), false, MAKE_PF_CB(process_UBAFlags)); // only EMS 1.0 - register_telegram_type(0x16, F("UBAParameters"), true, MAKE_PF_CB(process_UBAParameters)); - register_telegram_type(0x33, F("UBAParameterWW"), true, MAKE_PF_CB(process_UBAParameterWW)); - register_telegram_type(0x34, F("UBAMonitorWW"), false, MAKE_PF_CB(process_UBAMonitorWW)); + register_telegram_type(0x16, ("UBAParameters"), true, MAKE_PF_CB(process_UBAParameters)); + register_telegram_type(0x33, ("UBAParameterWW"), true, MAKE_PF_CB(process_UBAParameterWW)); + register_telegram_type(0x34, ("UBAMonitorWW"), false, MAKE_PF_CB(process_UBAMonitorWW)); // not ems1.0, but HT3 if (model() != EMSdevice::EMS_DEVICE_FLAG_EMS) { - register_telegram_type(0x26, F("UBASettingsWW"), true, MAKE_PF_CB(process_UBASettingsWW)); - register_telegram_type(0x2A, F("MC110Status"), false, MAKE_PF_CB(process_MC110Status)); + register_telegram_type(0x26, ("UBASettingsWW"), true, MAKE_PF_CB(process_UBASettingsWW)); + register_telegram_type(0x2A, ("MC110Status"), false, MAKE_PF_CB(process_MC110Status)); } // only EMS+ if (model() != EMSdevice::EMS_DEVICE_FLAG_EMS && model() != EMSdevice::EMS_DEVICE_FLAG_HT3 && model() != EMSdevice::EMS_DEVICE_FLAG_HYBRID) { - register_telegram_type(0xD1, F("UBAOutdoorTemp"), false, MAKE_PF_CB(process_UBAOutdoorTemp)); - register_telegram_type(0xE3, F("UBAMonitorSlowPlus2"), false, MAKE_PF_CB(process_UBAMonitorSlowPlus2)); - register_telegram_type(0xE4, F("UBAMonitorFastPlus"), false, MAKE_PF_CB(process_UBAMonitorFastPlus)); - register_telegram_type(0xE5, F("UBAMonitorSlowPlus"), false, MAKE_PF_CB(process_UBAMonitorSlowPlus)); - register_telegram_type(0xE6, F("UBAParametersPlus"), true, MAKE_PF_CB(process_UBAParametersPlus)); - register_telegram_type(0xE9, F("UBAMonitorWWPlus"), false, MAKE_PF_CB(process_UBAMonitorWWPlus)); - register_telegram_type(0xEA, F("UBAParameterWWPlus"), true, MAKE_PF_CB(process_UBAParameterWWPlus)); + register_telegram_type(0xD1, ("UBAOutdoorTemp"), false, MAKE_PF_CB(process_UBAOutdoorTemp)); + register_telegram_type(0xE3, ("UBAMonitorSlowPlus2"), false, MAKE_PF_CB(process_UBAMonitorSlowPlus2)); + register_telegram_type(0xE4, ("UBAMonitorFastPlus"), false, MAKE_PF_CB(process_UBAMonitorFastPlus)); + register_telegram_type(0xE5, ("UBAMonitorSlowPlus"), false, MAKE_PF_CB(process_UBAMonitorSlowPlus)); + register_telegram_type(0xE6, ("UBAParametersPlus"), true, MAKE_PF_CB(process_UBAParametersPlus)); + register_telegram_type(0xE9, ("UBAMonitorWWPlus"), false, MAKE_PF_CB(process_UBAMonitorWWPlus)); + register_telegram_type(0xEA, ("UBAParameterWWPlus"), true, MAKE_PF_CB(process_UBAParameterWWPlus)); } if (model() == EMSdevice::EMS_DEVICE_FLAG_HEATPUMP) { - register_telegram_type(0x494, F("UBAEnergySupplied"), false, MAKE_PF_CB(process_UBAEnergySupplied)); - register_telegram_type(0x495, F("UBAInformation"), false, MAKE_PF_CB(process_UBAInformation)); - register_telegram_type(0x48D, F("HpPower"), true, MAKE_PF_CB(process_HpPower)); - register_telegram_type(0x48F, F("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor)); - register_telegram_type(0x48A, F("HpPool"), true, MAKE_PF_CB(process_HpPool)); + register_telegram_type(0x494, ("UBAEnergySupplied"), false, MAKE_PF_CB(process_UBAEnergySupplied)); + register_telegram_type(0x495, ("UBAInformation"), false, MAKE_PF_CB(process_UBAInformation)); + register_telegram_type(0x48D, ("HpPower"), true, MAKE_PF_CB(process_HpPower)); + register_telegram_type(0x48F, ("HpOutdoor"), false, MAKE_PF_CB(process_HpOutdoor)); + register_telegram_type(0x48A, ("HpPool"), true, MAKE_PF_CB(process_HpPool)); } /* @@ -186,7 +186,7 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const * enable settings here if no thermostat is used in system * if (model() == EMSdevice::EMS_DEVICE_FLAG_HYBRID) { - register_telegram_type(0xBB, F("HybridHp"), true, MAKE_PF_CB(process_HybridHp)); + register_telegram_type(0xBB, ("HybridHp"), true, MAKE_PF_CB(process_HybridHp)); } */ @@ -2081,11 +2081,11 @@ bool Boiler::set_ww_circulation_mode(const char * value, const int8_t id) { } if (v < 7) { - // LOG_INFO(F("Setting dhw circulation mode %dx3min"), v); + // LOG_INFO(("Setting dhw circulation mode %dx3min"), v); } else if (v == 7) { - // LOG_INFO(F("Setting dhw circulation mode continuous")); + // LOG_INFO(("Setting dhw circulation mode continuous")); } else { - // LOG_WARNING(F("Set dhw circulation mode: Invalid value")); + // LOG_WARNING(("Set dhw circulation mode: Invalid value")); return false; } @@ -2109,12 +2109,12 @@ bool Boiler::set_reset(const char * value, const int8_t id) { } if (num == 1) { - // LOG_INFO(F("Reset boiler maintenance message")); + // LOG_INFO(("Reset boiler maintenance message")); write_command(0x05, 0x08, 0xFF, 0x1C); has_update(&reset_); return true; } else if (num == 2) { - // LOG_INFO(F("Reset boiler error message")); + // LOG_INFO(("Reset boiler error message")); write_command(0x05, 0x00, 0x5A); // error reset has_update(&reset_); return true; @@ -2131,7 +2131,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { std::string s; if (Helpers::value2string(value, s)) { if (s == Helpers::translated_word(FL_(reset))) { - // LOG_INFO(F("Reset boiler maintenance message")); + // LOG_INFO(("Reset boiler maintenance message")); write_command(0x05, 0x08, 0xFF, 0x1C); return true; } @@ -2142,11 +2142,11 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { uint8_t month = (value[3] - '0') * 10 + (value[4] - '0'); uint8_t year = (uint8_t)(Helpers::atoint(&value[6]) - 2000); if (day > 0 && day < 32 && month > 0 && month < 13) { - LOG_INFO(F("Setting maintenance date to %02d.%02d.%04d"), day, month, year + 2000); + LOG_INFO(("Setting maintenance date to %02d.%02d.%04d"), day, month, year + 2000); uint8_t data[5] = {2, (uint8_t)(maintenanceTime_ / 100), day, month, year}; write_command(0x15, 0, data, 5, 0x15); } else { - LOG_WARNING(F("Setting maintenance: wrong format %d.%d.%d"), day, month, year + 2000); + LOG_WARNING(("Setting maintenance: wrong format %d.%d.%d"), day, month, year + 2000); return false; } return true; @@ -2155,7 +2155,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { int hrs; if (Helpers::value2number(value, hrs)) { if (hrs > 99 && hrs < 25600) { - LOG_INFO(F("Setting maintenance time %d hours"), hrs); + LOG_INFO(("Setting maintenance time %d hours"), hrs); uint8_t data[2] = {1, (uint8_t)(hrs / 100)}; write_command(0x15, 0, data, 2, 0x15); return true; @@ -2164,12 +2164,12 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { uint8_t num; if (Helpers::value2enum(value, num, FL_(enum_off_time_date_manual))) { - LOG_INFO(F("Setting maintenance type to %s"), value); + LOG_INFO(("Setting maintenance type to %s"), value); write_command(0x15, 0, num, 0x15); return true; } - LOG_WARNING(F("Setting maintenance: wrong format")); + LOG_WARNING(("Setting maintenance: wrong format")); return false; } //maintenance @@ -2177,13 +2177,13 @@ bool Boiler::set_maintenancetime(const char * value, const int8_t id) { int hrs; if (Helpers::value2number(value, hrs)) { if (hrs > 99 && hrs < 25600) { - LOG_INFO(F("Setting maintenance time %d hours"), hrs); + LOG_INFO(("Setting maintenance time %d hours"), hrs); uint8_t data[2] = {1, (uint8_t)(hrs / 100)}; write_command(0x15, 0, data, 2, 0x15); return true; } } - LOG_WARNING(F("Setting maintenance: wrong format")); + LOG_WARNING(("Setting maintenance: wrong format")); return false; } @@ -2194,17 +2194,17 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) { uint8_t month = (value[3] - '0') * 10 + (value[4] - '0'); uint8_t year = (uint8_t)(Helpers::atoint(&value[6]) - 2000); if (day > 0 && day < 32 && month > 0 && month < 13) { - LOG_INFO(F("Setting maintenance date to %02d.%02d.%04d"), day, month, year + 2000); + LOG_INFO(("Setting maintenance date to %02d.%02d.%04d"), day, month, year + 2000); uint8_t data[5] = {2, (uint8_t)(maintenanceTime_ / 100), day, month, year}; write_command(0x15, 0, data, 5, 0x15); } else { - LOG_WARNING(F("Setting maintenance: wrong format %d.%d.%d"), day, month, year + 2000); + LOG_WARNING(("Setting maintenance: wrong format %d.%d.%d"), day, month, year + 2000); return false; } return true; } - LOG_WARNING(F("Setting maintenance: wrong format")); + LOG_WARNING(("Setting maintenance: wrong format")); return false; } @@ -2215,7 +2215,7 @@ bool Boiler::set_pool_temp(const char * value, const int8_t id) { return false; } uint8_t v2 = ((v * 2) + 0.5); - // LOG_INFO(F("Setting pool temperature to %d.%d C"), v2 >> 1, (v2 & 0x01) * 5); + // LOG_INFO(("Setting pool temperature to %d.%d C"), v2 >> 1, (v2 & 0x01) * 5); write_command(0x48A, 1, v2, 0x48A); return true; diff --git a/src/devices/controller.cpp b/src/devices/controller.cpp index 3dad2e8c1..3e1b74c0c 100644 --- a/src/devices/controller.cpp +++ b/src/devices/controller.cpp @@ -26,7 +26,7 @@ Controller::Controller(uint8_t device_type, uint8_t device_id, uint8_t product_i : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // IVT broadcasts Thermostat time from controller (0x09) if display is off. if ((flags & 0x0F) == EMS_DEVICE_FLAG_IVT) { - register_telegram_type(0x06, F("RCTime"), false, MAKE_PF_CB(process_dateTime)); + register_telegram_type(0x06, ("RCTime"), false, MAKE_PF_CB(process_dateTime)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, FL_(dateTime), DeviceValueUOM::NONE); } } diff --git a/src/devices/gateway.cpp b/src/devices/gateway.cpp index b4d5b38e8..74ac1a627 100644 --- a/src/devices/gateway.cpp +++ b/src/devices/gateway.cpp @@ -22,7 +22,7 @@ namespace emsesp { REGISTER_FACTORY(Gateway, EMSdevice::DeviceType::GATEWAY); -Gateway::Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char *name, uint8_t flags, uint8_t brand) +Gateway::Gateway(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { } diff --git a/src/devices/heatpump.cpp b/src/devices/heatpump.cpp index 399452a90..de49f3be0 100644 --- a/src/devices/heatpump.cpp +++ b/src/devices/heatpump.cpp @@ -25,8 +25,8 @@ REGISTER_FACTORY(Heatpump, EMSdevice::DeviceType::HEATPUMP); Heatpump::Heatpump(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // telegram handlers - register_telegram_type(0x042B, F("HP1"), false, MAKE_PF_CB(process_HPMonitor1)); - register_telegram_type(0x047B, F("HP2"), false, MAKE_PF_CB(process_HPMonitor2)); + register_telegram_type(0x042B, ("HP1"), false, MAKE_PF_CB(process_HPMonitor1)); + register_telegram_type(0x047B, ("HP2"), false, MAKE_PF_CB(process_HPMonitor2)); // device values register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &airHumidity_, DeviceValueType::UINT, FL_(airHumidity), DeviceValueUOM::PERCENT); diff --git a/src/devices/mixer.cpp b/src/devices/mixer.cpp index fff55c6ad..d68a12d85 100644 --- a/src/devices/mixer.cpp +++ b/src/devices/mixer.cpp @@ -28,7 +28,7 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // Pool module if (flags == EMSdevice::EMS_DEVICE_FLAG_MP) { - register_telegram_type(0x5BA, F("HpPoolStatus"), true, MAKE_PF_CB(process_HpPoolStatus)); + register_telegram_type(0x5BA, ("HpPoolStatus"), true, MAKE_PF_CB(process_HpPoolStatus)); type_ = Type::MP; register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &poolTemp_, @@ -43,8 +43,8 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c // EMS+ if (flags == EMSdevice::EMS_DEVICE_FLAG_MMPLUS) { if (device_id >= 0x20 && device_id <= 0x27) { - register_telegram_type(device_id - 0x20 + 0x02D7, F("MMPLUSStatusMessage_HC"), false, MAKE_PF_CB(process_MMPLUSStatusMessage_HC)); - // register_telegram_type(device_id - 0x20 + 0x02E1, F("MMPLUSStetMessage_HC"), true, MAKE_PF_CB(process_MMPLUSSetMessage_HC)); + register_telegram_type(device_id - 0x20 + 0x02D7, ("MMPLUSStatusMessage_HC"), false, MAKE_PF_CB(process_MMPLUSStatusMessage_HC)); + // register_telegram_type(device_id - 0x20 + 0x02E1, ("MMPLUSStetMessage_HC"), true, MAKE_PF_CB(process_MMPLUSSetMessage_HC)); type_ = Type::HC; hc_ = device_id - 0x20 + 1; uint8_t tag = DeviceValueTAG::TAG_HC1 + hc_ - 1; @@ -53,9 +53,9 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c register_device_value(tag, &flowSetTemp_, DeviceValueType::UINT, FL_(flowSetTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_flowSetTemp)); register_device_value(tag, &pumpStatus_, DeviceValueType::BOOL, FL_(pumpStatus), DeviceValueUOM::NONE, MAKE_CF_CB(set_pump)); } else if (device_id >= 0x28 && device_id <= 0x29) { - register_telegram_type(device_id - 0x28 + 0x0331, F("MMPLUSStatusMessage_WWC"), false, MAKE_PF_CB(process_MMPLUSStatusMessage_WWC)); - register_telegram_type(device_id - 0x28 + 0x0313, F("MMPLUSConfigMessage_WWC"), true, MAKE_PF_CB(process_MMPLUSConfigMessage_WWC)); - // register_telegram_type(device_id - 0x28 + 0x033B, F("MMPLUSSetMessage_WWC"), true, MAKE_PF_CB(process_MMPLUSSetMessage_WWC)); + register_telegram_type(device_id - 0x28 + 0x0331, ("MMPLUSStatusMessage_WWC"), false, MAKE_PF_CB(process_MMPLUSStatusMessage_WWC)); + register_telegram_type(device_id - 0x28 + 0x0313, ("MMPLUSConfigMessage_WWC"), true, MAKE_PF_CB(process_MMPLUSConfigMessage_WWC)); + // register_telegram_type(device_id - 0x28 + 0x033B, ("MMPLUSSetMessage_WWC"), true, MAKE_PF_CB(process_MMPLUSSetMessage_WWC)); type_ = Type::WWC; hc_ = device_id - 0x28 + 1; uint8_t tag = DeviceValueTAG::TAG_WWC1 + hc_ - 1; @@ -85,9 +85,9 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c // EMS 1.0 if (flags == EMSdevice::EMS_DEVICE_FLAG_MM10) { - register_telegram_type(0x00AA, F("MMConfigMessage"), true, MAKE_PF_CB(process_MMConfigMessage)); - register_telegram_type(0x00AB, F("MMStatusMessage"), false, MAKE_PF_CB(process_MMStatusMessage)); - register_telegram_type(0x00AC, F("MMSetMessage"), false, MAKE_PF_CB(process_MMSetMessage)); + register_telegram_type(0x00AA, ("MMConfigMessage"), true, MAKE_PF_CB(process_MMConfigMessage)); + register_telegram_type(0x00AB, ("MMStatusMessage"), false, MAKE_PF_CB(process_MMStatusMessage)); + register_telegram_type(0x00AC, ("MMSetMessage"), false, MAKE_PF_CB(process_MMSetMessage)); type_ = Type::HC; hc_ = device_id - 0x20 + 1; uint8_t tag = DeviceValueTAG::TAG_HC1 + hc_ - 1; @@ -110,10 +110,10 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c // HT3 if (flags == EMSdevice::EMS_DEVICE_FLAG_IPM) { if (device_id >= 0x40) { // special DHW pos 10 - register_telegram_type(0x34, F("UBAMonitorWW"), false, MAKE_PF_CB(process_IPMMonitorWW)); - register_telegram_type(0x1E, F("HydrTemp"), false, MAKE_PF_CB(process_IPMHydrTemp)); - register_telegram_type(0x33, F("UBAParameterWW"), true, MAKE_PF_CB(process_IPMParameterWW)); - // register_telegram_type(0x10D, F("wwNTCStatus"), false, MAKE_PF_CB(process_wwNTCStatus)); + register_telegram_type(0x34, ("UBAMonitorWW"), false, MAKE_PF_CB(process_IPMMonitorWW)); + register_telegram_type(0x1E, ("HydrTemp"), false, MAKE_PF_CB(process_IPMHydrTemp)); + register_telegram_type(0x33, ("UBAParameterWW"), true, MAKE_PF_CB(process_IPMParameterWW)); + // register_telegram_type(0x10D, ("wwNTCStatus"), false, MAKE_PF_CB(process_wwNTCStatus)); type_ = Type::WWC; hc_ = device_id - 0x40 + 1; uint8_t tag = DeviceValueTAG::TAG_WWC9 + hc_ - 1; @@ -139,9 +139,9 @@ Mixer::Mixer(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c MAKE_CF_CB(set_wwCircPump)); register_device_value(tag, &wwCircMode_, DeviceValueType::ENUM, FL_(enum_wwCircMode), FL_(wwCircMode), DeviceValueUOM::NONE, MAKE_CF_CB(set_wwCircMode)); } else { - register_telegram_type(0x010C, F("IPMStatusMessage"), false, MAKE_PF_CB(process_IPMStatusMessage)); - register_telegram_type(0x011E, F("IPMTempMessage"), false, MAKE_PF_CB(process_IPMTempMessage)); - // register_telegram_type(0x0123, F("IPMSetMessage"), false, MAKE_PF_CB(process_IPMSetMessage)); + register_telegram_type(0x010C, ("IPMStatusMessage"), false, MAKE_PF_CB(process_IPMStatusMessage)); + register_telegram_type(0x011E, ("IPMTempMessage"), false, MAKE_PF_CB(process_IPMTempMessage)); + // register_telegram_type(0x0123, ("IPMSetMessage"), false, MAKE_PF_CB(process_IPMSetMessage)); type_ = Type::HC; hc_ = device_id - 0x20 + 1; uint8_t tag = DeviceValueTAG::TAG_HC1 + hc_ - 1; diff --git a/src/devices/solar.cpp b/src/devices/solar.cpp index af1b8096c..f4ab5b704 100644 --- a/src/devices/solar.cpp +++ b/src/devices/solar.cpp @@ -28,44 +28,44 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const c : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // telegram handlers if (flags == EMSdevice::EMS_DEVICE_FLAG_SM10) { - register_telegram_type(0x97, F("SM10Monitor"), false, MAKE_PF_CB(process_SM10Monitor)); - register_telegram_type(0x96, F("SM10Config"), true, MAKE_PF_CB(process_SM10Config)); + register_telegram_type(0x97, ("SM10Monitor"), false, MAKE_PF_CB(process_SM10Monitor)); + register_telegram_type(0x96, ("SM10Config"), true, MAKE_PF_CB(process_SM10Config)); EMSESP::send_read_request(0x97, device_id); } if (flags == EMSdevice::EMS_DEVICE_FLAG_SM100) { if (device_id == 0x2A) { // SM100 DHW - register_telegram_type(0x07D6, F("SM100wwTemperature"), false, MAKE_PF_CB(process_SM100wwTemperature)); - register_telegram_type(0x07AA, F("SM100wwStatus"), false, MAKE_PF_CB(process_SM100wwStatus)); - register_telegram_type(0x07AB, F("SM100wwCommand"), false, MAKE_PF_CB(process_SM100wwCommand)); - register_telegram_type(0x07A5, F("SM100wwCirc"), true, MAKE_PF_CB(process_SM100wwCirc)); - register_telegram_type(0x07A6, F("SM100wwParam"), true, MAKE_PF_CB(process_SM100wwParam)); - register_telegram_type(0x07AE, F("SM100wwKeepWarm"), true, MAKE_PF_CB(process_SM100wwKeepWarm)); - register_telegram_type(0x07E0, F("SM100wwStatus2"), true, MAKE_PF_CB(process_SM100wwStatus2)); + register_telegram_type(0x07D6, ("SM100wwTemperature"), false, MAKE_PF_CB(process_SM100wwTemperature)); + register_telegram_type(0x07AA, ("SM100wwStatus"), false, MAKE_PF_CB(process_SM100wwStatus)); + register_telegram_type(0x07AB, ("SM100wwCommand"), false, MAKE_PF_CB(process_SM100wwCommand)); + register_telegram_type(0x07A5, ("SM100wwCirc"), true, MAKE_PF_CB(process_SM100wwCirc)); + register_telegram_type(0x07A6, ("SM100wwParam"), true, MAKE_PF_CB(process_SM100wwParam)); + register_telegram_type(0x07AE, ("SM100wwKeepWarm"), true, MAKE_PF_CB(process_SM100wwKeepWarm)); + register_telegram_type(0x07E0, ("SM100wwStatus2"), true, MAKE_PF_CB(process_SM100wwStatus2)); } else { // F9 is not a telegram type, it's a flag for configure - // register_telegram_type(0xF9, F("ParamCfg"), false, MAKE_PF_CB(process_SM100ParamCfg)); - register_telegram_type(0x0358, F("SM100SystemConfig"), true, MAKE_PF_CB(process_SM100SystemConfig)); - register_telegram_type(0x035A, F("SM100CircuitConfig"), true, MAKE_PF_CB(process_SM100CircuitConfig)); - register_telegram_type(0x035D, F("SM100Circuit2Config"), true, MAKE_PF_CB(process_SM100Circuit2Config)); - register_telegram_type(0x0362, F("SM100Monitor"), false, MAKE_PF_CB(process_SM100Monitor)); - register_telegram_type(0x0363, F("SM100Monitor2"), false, MAKE_PF_CB(process_SM100Monitor2)); - register_telegram_type(0x0366, F("SM100Config"), false, MAKE_PF_CB(process_SM100Config)); - register_telegram_type(0x0364, F("SM100Status"), false, MAKE_PF_CB(process_SM100Status)); - register_telegram_type(0x036A, F("SM100Status2"), false, MAKE_PF_CB(process_SM100Status2)); - register_telegram_type(0x0380, F("SM100CollectorConfig"), true, MAKE_PF_CB(process_SM100CollectorConfig)); - register_telegram_type(0x038E, F("SM100Energy"), true, MAKE_PF_CB(process_SM100Energy)); - register_telegram_type(0x0391, F("SM100Time"), true, MAKE_PF_CB(process_SM100Time)); - register_telegram_type(0x035F, F("SM100Config1"), true, MAKE_PF_CB(process_SM100Config1)); - register_telegram_type(0x035C, F("SM100HeatAssist"), true, MAKE_PF_CB(process_SM100HeatAssist)); - register_telegram_type(0x0361, F("SM100Differential"), true, MAKE_PF_CB(process_SM100Differential)); + // register_telegram_type(0xF9, ("ParamCfg"), false, MAKE_PF_CB(process_SM100ParamCfg)); + register_telegram_type(0x0358, ("SM100SystemConfig"), true, MAKE_PF_CB(process_SM100SystemConfig)); + register_telegram_type(0x035A, ("SM100CircuitConfig"), true, MAKE_PF_CB(process_SM100CircuitConfig)); + register_telegram_type(0x035D, ("SM100Circuit2Config"), true, MAKE_PF_CB(process_SM100Circuit2Config)); + register_telegram_type(0x0362, ("SM100Monitor"), false, MAKE_PF_CB(process_SM100Monitor)); + register_telegram_type(0x0363, ("SM100Monitor2"), false, MAKE_PF_CB(process_SM100Monitor2)); + register_telegram_type(0x0366, ("SM100Config"), false, MAKE_PF_CB(process_SM100Config)); + register_telegram_type(0x0364, ("SM100Status"), false, MAKE_PF_CB(process_SM100Status)); + register_telegram_type(0x036A, ("SM100Status2"), false, MAKE_PF_CB(process_SM100Status2)); + register_telegram_type(0x0380, ("SM100CollectorConfig"), true, MAKE_PF_CB(process_SM100CollectorConfig)); + register_telegram_type(0x038E, ("SM100Energy"), true, MAKE_PF_CB(process_SM100Energy)); + register_telegram_type(0x0391, ("SM100Time"), true, MAKE_PF_CB(process_SM100Time)); + register_telegram_type(0x035F, ("SM100Config1"), true, MAKE_PF_CB(process_SM100Config1)); + register_telegram_type(0x035C, ("SM100HeatAssist"), true, MAKE_PF_CB(process_SM100HeatAssist)); + register_telegram_type(0x0361, ("SM100Differential"), true, MAKE_PF_CB(process_SM100Differential)); } } if (flags == EMSdevice::EMS_DEVICE_FLAG_ISM) { - register_telegram_type(0x0103, F("ISM1StatusMessage"), true, MAKE_PF_CB(process_ISM1StatusMessage)); - register_telegram_type(0x0101, F("ISM1Set"), true, MAKE_PF_CB(process_ISM1Set)); - register_telegram_type(0x0104, F("ISM2StatusMessage"), false, MAKE_PF_CB(process_ISM2StatusMessage)); + register_telegram_type(0x0103, ("ISM1StatusMessage"), true, MAKE_PF_CB(process_ISM1StatusMessage)); + register_telegram_type(0x0101, ("ISM1Set"), true, MAKE_PF_CB(process_ISM1Set)); + register_telegram_type(0x0104, ("ISM2StatusMessage"), false, MAKE_PF_CB(process_ISM2StatusMessage)); } // device values... @@ -664,7 +664,7 @@ void Solar::process_SM100ParamCfg(std::shared_ptr telegram) { telegram->read_value(max, 13); telegram->read_value(cur, 17); - // LOG_DEBUG(F("SM100ParamCfg param=0x%04X, offset=%d, min=%d, default=%d, max=%d, current=%d"), t_id, of, min, def, max, cur)); + // LOG_DEBUG(("SM100ParamCfg param=0x%04X, offset=%d, min=%d, default=%d, max=%d, current=%d"), t_id, of, min, def, max, cur)); } /* diff --git a/src/devices/switch.cpp b/src/devices/switch.cpp index 0309b0fcd..4f2edd589 100644 --- a/src/devices/switch.cpp +++ b/src/devices/switch.cpp @@ -25,9 +25,9 @@ REGISTER_FACTORY(Switch, EMSdevice::DeviceType::SWITCH); Switch::Switch(uint8_t device_type, uint8_t device_id, uint8_t product_id, const char * version, const char * name, uint8_t flags, uint8_t brand) : EMSdevice(device_type, device_id, product_id, version, name, flags, brand) { // WM10 module, device_id 0x11 - register_telegram_type(0x9C, F("WM10MonitorMessage"), false, MAKE_PF_CB(process_WM10MonitorMessage)); - register_telegram_type(0x9D, F("WM10SetMessage"), false, MAKE_PF_CB(process_WM10SetMessage)); - register_telegram_type(0x1E, F("WM10TempMessage"), false, MAKE_PF_CB(process_WM10TempMessage)); + register_telegram_type(0x9C, ("WM10MonitorMessage"), false, MAKE_PF_CB(process_WM10MonitorMessage)); + register_telegram_type(0x9D, ("WM10SetMessage"), false, MAKE_PF_CB(process_WM10SetMessage)); + register_telegram_type(0x1E, ("WM10TempMessage"), false, MAKE_PF_CB(process_WM10TempMessage)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &activated_, DeviceValueType::BOOL, FL_(activated), DeviceValueUOM::NONE); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 064194977..b67926910 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -30,31 +30,31 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i // RF remote sensor seen at 0x40, maybe this is also for different hc with id 0x40 - 0x47? emsesp.cpp maps only 0x40 if (device_id >= 0x40 && device_id <= 0x47) { - register_telegram_type(0x0435, F("RFTemp"), false, MAKE_PF_CB(process_RemoteTemp)); + register_telegram_type(0x0435, ("RFTemp"), false, MAKE_PF_CB(process_RemoteTemp)); return; } // remote thermostats with humidity: RC100H remote if (device_id >= 0x38 && device_id <= 0x3F) { - register_telegram_type(0x042B, F("RemoteTemp"), false, MAKE_PF_CB(process_RemoteTemp)); - register_telegram_type(0x047B, F("RemoteHumidity"), false, MAKE_PF_CB(process_RemoteHumidity)); - register_telegram_type(0x0273, F("RemoteCorrection"), true, MAKE_PF_CB(process_RemoteCorrection)); + register_telegram_type(0x042B, ("RemoteTemp"), false, MAKE_PF_CB(process_RemoteTemp)); + register_telegram_type(0x047B, ("RemoteHumidity"), false, MAKE_PF_CB(process_RemoteHumidity)); + register_telegram_type(0x0273, ("RemoteCorrection"), true, MAKE_PF_CB(process_RemoteCorrection)); register_device_values(); // register device values for common values (not heating circuit) return; // no values to add } // common telegram handlers - register_telegram_type(EMS_TYPE_RCOutdoorTemp, F("RCOutdoorTemp"), false, MAKE_PF_CB(process_RCOutdoorTemp)); - register_telegram_type(EMS_TYPE_RCTime, F("RCTime"), false, MAKE_PF_CB(process_RCTime)); - register_telegram_type(0xA2, F("RCError"), false, MAKE_PF_CB(process_RCError)); - register_telegram_type(0x12, F("RCErrorMessage"), false, MAKE_PF_CB(process_RCErrorMessage)); - register_telegram_type(0x13, F("RCErrorMessage2"), false, MAKE_PF_CB(process_RCErrorMessage)); + register_telegram_type(EMS_TYPE_RCOutdoorTemp, ("RCOutdoorTemp"), false, MAKE_PF_CB(process_RCOutdoorTemp)); + register_telegram_type(EMS_TYPE_RCTime, ("RCTime"), false, MAKE_PF_CB(process_RCTime)); + register_telegram_type(0xA2, ("RCError"), false, MAKE_PF_CB(process_RCError)); + register_telegram_type(0x12, ("RCErrorMessage"), false, MAKE_PF_CB(process_RCErrorMessage)); + register_telegram_type(0x13, ("RCErrorMessage2"), false, MAKE_PF_CB(process_RCErrorMessage)); // RC10 if (model == EMSdevice::EMS_DEVICE_FLAG_RC10) { monitor_typeids = {0xB1}; set_typeids = {0xB0}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("RC10Monitor"), false, MAKE_PF_CB(process_RC10Monitor)); - register_telegram_type(set_typeids[i], F("RC10Set"), false, MAKE_PF_CB(process_RC10Set)); + register_telegram_type(monitor_typeids[i], ("RC10Monitor"), false, MAKE_PF_CB(process_RC10Monitor)); + register_telegram_type(set_typeids[i], ("RC10Set"), false, MAKE_PF_CB(process_RC10Set)); } // RC35 @@ -64,15 +64,15 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i timer_typeids = {0x3F, 0x49, 0x53, 0x5D}; timer2_typeids = {0x42, 0x4C, 0x56, 0x60}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("RC35Monitor"), false, MAKE_PF_CB(process_RC35Monitor)); - register_telegram_type(set_typeids[i], F("RC35Set"), false, MAKE_PF_CB(process_RC35Set)); - register_telegram_type(timer_typeids[i], F("RC35Timer"), false, MAKE_PF_CB(process_RC35Timer)); - register_telegram_type(timer2_typeids[i], F("RC35Timer2"), false, MAKE_PF_CB(process_RC35Timer)); + register_telegram_type(monitor_typeids[i], ("RC35Monitor"), false, MAKE_PF_CB(process_RC35Monitor)); + register_telegram_type(set_typeids[i], ("RC35Set"), false, MAKE_PF_CB(process_RC35Set)); + register_telegram_type(timer_typeids[i], ("RC35Timer"), false, MAKE_PF_CB(process_RC35Timer)); + register_telegram_type(timer2_typeids[i], ("RC35Timer2"), false, MAKE_PF_CB(process_RC35Timer)); } - register_telegram_type(EMS_TYPE_IBASettings, F("IBASettings"), true, MAKE_PF_CB(process_IBASettings)); - register_telegram_type(EMS_TYPE_wwSettings, F("WWSettings"), true, MAKE_PF_CB(process_RC35wwSettings)); - register_telegram_type(0x38, F("WWTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); - register_telegram_type(0x39, F("WWCircTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); + register_telegram_type(EMS_TYPE_IBASettings, ("IBASettings"), true, MAKE_PF_CB(process_IBASettings)); + register_telegram_type(EMS_TYPE_wwSettings, ("WWSettings"), true, MAKE_PF_CB(process_RC35wwSettings)); + register_telegram_type(0x38, ("WWTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); + register_telegram_type(0x39, ("WWCircTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); // RC20 } else if (model == EMSdevice::EMS_DEVICE_FLAG_RC20) { @@ -81,22 +81,22 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i curve_typeids = {0x90}; timer_typeids = {0x8F}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("RC20Monitor"), false, MAKE_PF_CB(process_RC20Monitor)); - register_telegram_type(set_typeids[i], F("RC20Set"), false, MAKE_PF_CB(process_RC20Set)); - register_telegram_type(curve_typeids[i], F("RC20Temp"), false, MAKE_PF_CB(process_RC20Temp)); - register_telegram_type(timer_typeids[i], F("RC20Timer"), false, MAKE_PF_CB(process_RC20Timer)); + register_telegram_type(monitor_typeids[i], ("RC20Monitor"), false, MAKE_PF_CB(process_RC20Monitor)); + register_telegram_type(set_typeids[i], ("RC20Set"), false, MAKE_PF_CB(process_RC20Set)); + register_telegram_type(curve_typeids[i], ("RC20Temp"), false, MAKE_PF_CB(process_RC20Temp)); + register_telegram_type(timer_typeids[i], ("RC20Timer"), false, MAKE_PF_CB(process_RC20Timer)); } // remote thermostat uses only 0xAF - register_telegram_type(0xAF, F("RC20Remote"), false, MAKE_PF_CB(process_RC20Remote)); + register_telegram_type(0xAF, ("RC20Remote"), false, MAKE_PF_CB(process_RC20Remote)); // RC20 newer } else if ((model == EMSdevice::EMS_DEVICE_FLAG_RC20_N) || (model == EMSdevice::EMS_DEVICE_FLAG_RC25)) { monitor_typeids = {0xAE}; set_typeids = {0xAD}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("RC20Monitor"), false, MAKE_PF_CB(process_RC20Monitor_2)); - register_telegram_type(set_typeids[i], F("RC20Set"), false, MAKE_PF_CB(process_RC20Set_2)); + register_telegram_type(monitor_typeids[i], ("RC20Monitor"), false, MAKE_PF_CB(process_RC20Monitor_2)); + register_telegram_type(set_typeids[i], ("RC20Set"), false, MAKE_PF_CB(process_RC20Set_2)); } - register_telegram_type(0xAF, F("RC20Remote"), false, MAKE_PF_CB(process_RC20Remote)); + register_telegram_type(0xAF, ("RC20Remote"), false, MAKE_PF_CB(process_RC20Remote)); // RC30 } else if (model == EMSdevice::EMS_DEVICE_FLAG_RC30) { monitor_typeids = {0x41}; @@ -104,27 +104,27 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i curve_typeids = {0x40}; timer_typeids = {0x3F}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("RC30Monitor"), false, MAKE_PF_CB(process_RC30Monitor)); - register_telegram_type(set_typeids[i], F("RC30Set"), false, MAKE_PF_CB(process_RC30Set)); - register_telegram_type(curve_typeids[i], F("RC30Temp"), false, MAKE_PF_CB(process_RC30Temp)); - register_telegram_type(timer_typeids[i], F("RC30Timer"), false, MAKE_PF_CB(process_RC35Timer)); + register_telegram_type(monitor_typeids[i], ("RC30Monitor"), false, MAKE_PF_CB(process_RC30Monitor)); + register_telegram_type(set_typeids[i], ("RC30Set"), false, MAKE_PF_CB(process_RC30Set)); + register_telegram_type(curve_typeids[i], ("RC30Temp"), false, MAKE_PF_CB(process_RC30Temp)); + register_telegram_type(timer_typeids[i], ("RC30Timer"), false, MAKE_PF_CB(process_RC35Timer)); } - register_telegram_type(EMS_TYPE_RC30wwSettings, F("RC30WWSettings"), true, MAKE_PF_CB(process_RC30wwSettings)); - register_telegram_type(0x38, F("WWTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); - register_telegram_type(0x39, F("WWCircTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); + register_telegram_type(EMS_TYPE_RC30wwSettings, ("RC30WWSettings"), true, MAKE_PF_CB(process_RC30wwSettings)); + register_telegram_type(0x38, ("WWTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); + register_telegram_type(0x39, ("WWCircTimer"), true, MAKE_PF_CB(process_RC35wwTimer)); // EASY } else if (model == EMSdevice::EMS_DEVICE_FLAG_EASY) { monitor_typeids = {0x0A}; set_typeids = {}; - register_telegram_type(monitor_typeids[0], F("EasyMonitor"), true, MAKE_PF_CB(process_EasyMonitor)); + register_telegram_type(monitor_typeids[0], ("EasyMonitor"), true, MAKE_PF_CB(process_EasyMonitor)); // CRF } else if (model == EMSdevice::EMS_DEVICE_FLAG_CRF) { monitor_typeids = {0x02A5, 0x02A6, 0x02A7, 0x02A8}; set_typeids = {}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("CRFMonitor"), false, MAKE_PF_CB(process_CRFMonitor)); + register_telegram_type(monitor_typeids[i], ("CRFMonitor"), false, MAKE_PF_CB(process_CRFMonitor)); } // RC300/RC100 @@ -136,46 +136,46 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i curve_typeids = {0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x02A0, 0x02A1, 0x02A2}; summer2_typeids = {0x0471, 0x0472, 0x0473, 0x0474, 0x0475, 0x0476, 0x0477, 0x0478}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("RC300Monitor"), false, MAKE_PF_CB(process_RC300Monitor)); - register_telegram_type(set_typeids[i], F("RC300Set"), false, MAKE_PF_CB(process_RC300Set)); - register_telegram_type(summer_typeids[i], F("RC300Summer"), false, MAKE_PF_CB(process_RC300Summer)); - register_telegram_type(curve_typeids[i], F("RC300Curves"), false, MAKE_PF_CB(process_RC300Curve)); - register_telegram_type(summer2_typeids[i], F("RC300Summer2"), false, MAKE_PF_CB(process_RC300Summer2)); + register_telegram_type(monitor_typeids[i], ("RC300Monitor"), false, MAKE_PF_CB(process_RC300Monitor)); + register_telegram_type(set_typeids[i], ("RC300Set"), false, MAKE_PF_CB(process_RC300Set)); + register_telegram_type(summer_typeids[i], ("RC300Summer"), false, MAKE_PF_CB(process_RC300Summer)); + register_telegram_type(curve_typeids[i], ("RC300Curves"), false, MAKE_PF_CB(process_RC300Curve)); + register_telegram_type(summer2_typeids[i], ("RC300Summer2"), false, MAKE_PF_CB(process_RC300Summer2)); } for (uint8_t i = 0; i < set2_typeids.size(); i++) { - register_telegram_type(set2_typeids[i], F("RC300Set2"), false, MAKE_PF_CB(process_RC300Set2)); + register_telegram_type(set2_typeids[i], ("RC300Set2"), false, MAKE_PF_CB(process_RC300Set2)); } - register_telegram_type(0x2F5, F("RC300WWmode"), true, MAKE_PF_CB(process_RC300WWmode)); - register_telegram_type(0x31B, F("RC300WWtemp"), true, MAKE_PF_CB(process_RC300WWtemp)); - register_telegram_type(0x31D, F("RC300WWmode2"), false, MAKE_PF_CB(process_RC300WWmode2)); - register_telegram_type(0x31E, F("RC300WWmode2"), false, MAKE_PF_CB(process_RC300WWmode2)); - register_telegram_type(0x23A, F("RC300OutdoorTemp"), true, MAKE_PF_CB(process_RC300OutdoorTemp)); - register_telegram_type(0x267, F("RC300Floordry"), false, MAKE_PF_CB(process_RC300Floordry)); - register_telegram_type(0x240, F("RC300Settings"), true, MAKE_PF_CB(process_RC300Settings)); + register_telegram_type(0x2F5, ("RC300WWmode"), true, MAKE_PF_CB(process_RC300WWmode)); + register_telegram_type(0x31B, ("RC300WWtemp"), true, MAKE_PF_CB(process_RC300WWtemp)); + register_telegram_type(0x31D, ("RC300WWmode2"), false, MAKE_PF_CB(process_RC300WWmode2)); + register_telegram_type(0x31E, ("RC300WWmode2"), false, MAKE_PF_CB(process_RC300WWmode2)); + register_telegram_type(0x23A, ("RC300OutdoorTemp"), true, MAKE_PF_CB(process_RC300OutdoorTemp)); + register_telegram_type(0x267, ("RC300Floordry"), false, MAKE_PF_CB(process_RC300Floordry)); + register_telegram_type(0x240, ("RC300Settings"), true, MAKE_PF_CB(process_RC300Settings)); // JUNKERS/HT3 } else if (model == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { monitor_typeids = {0x016F, 0x0170, 0x0171, 0x0172}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(monitor_typeids[i], F("JunkersMonitor"), false, MAKE_PF_CB(process_JunkersMonitor)); + register_telegram_type(monitor_typeids[i], ("JunkersMonitor"), false, MAKE_PF_CB(process_JunkersMonitor)); } if (has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) { // FR120, FR100 set_typeids = {0x0179, 0x017A, 0x017B, 0x017C}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(set_typeids[i], F("JunkersSet"), false, MAKE_PF_CB(process_JunkersSet2)); + register_telegram_type(set_typeids[i], ("JunkersSet"), false, MAKE_PF_CB(process_JunkersSet2)); } } else { set_typeids = {0x0165, 0x0166, 0x0167, 0x0168}; for (uint8_t i = 0; i < monitor_typeids.size(); i++) { - register_telegram_type(set_typeids[i], F("JunkersSet"), false, MAKE_PF_CB(process_JunkersSet)); + register_telegram_type(set_typeids[i], ("JunkersSet"), false, MAKE_PF_CB(process_JunkersSet)); } } - register_telegram_type(0xBB, F("HybridSettings"), true, MAKE_PF_CB(process_JunkersHybridSettings)); - register_telegram_type(0x23, F("JunkersSetMixer"), true, MAKE_PF_CB(process_JunkersSetMixer)); - register_telegram_type(0x123, F("JunkersRemote"), false, MAKE_PF_CB(process_JunkersRemoteMonitor)); - register_telegram_type(0x1D3, F("JunkersDhw"), true, MAKE_PF_CB(process_JunkersWW)); + register_telegram_type(0xBB, ("HybridSettings"), true, MAKE_PF_CB(process_JunkersHybridSettings)); + register_telegram_type(0x23, ("JunkersSetMixer"), true, MAKE_PF_CB(process_JunkersSetMixer)); + register_telegram_type(0x123, ("JunkersRemote"), false, MAKE_PF_CB(process_JunkersRemoteMonitor)); + register_telegram_type(0x1D3, ("JunkersDhw"), true, MAKE_PF_CB(process_JunkersWW)); } // register device values for common values (not heating circuit) @@ -593,7 +593,7 @@ void Thermostat::process_RC20Timer(std::shared_ptr telegram) { uint8_t time = telegram->message_data[1]; // we use EN settings for the day abbreviation - std::string sday = read_flash_string(FL_(enum_dayOfWeek)[day][0]); + std::string sday = (FL_(enum_dayOfWeek)[day][0]); // std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]); if (day == 7) { @@ -794,7 +794,7 @@ void Thermostat::process_RC35wwTimer(std::shared_ptr telegram) { char data[sizeof(wwSwitchTime_)]; // we use EN settings for the day abbreviation - std::string sday = read_flash_string(FL_(enum_dayOfWeek)[day][0]); + std::string sday = (FL_(enum_dayOfWeek)[day][0]); // std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]); if (day == 7) { snprintf(data, sizeof(data), "%02d not_set", no); @@ -1272,7 +1272,7 @@ void Thermostat::process_RC35Timer(std::shared_ptr telegram) { uint8_t time = telegram->message_data[1]; // we use EN settings for the day abbreviation - std::string sday = read_flash_string(FL_(enum_dayOfWeek)[day][0]); + std::string sday = (FL_(enum_dayOfWeek)[day][0]); // std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]); if (day == 7) { snprintf(data, sizeof(data), "%02d not_set", no); @@ -1369,7 +1369,7 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { double difference = difftime(now, ttime); if (difference > 15 || difference < -15) { set_datetime("ntp", -1); // set from NTP - LOG_INFO(F("thermostat time correction from ntp")); + LOG_INFO(("thermostat time correction from ntp")); } } #ifndef EMSESP_STANDALONE @@ -1380,7 +1380,7 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { } struct timeval newnow = {.tv_sec = ttime}; settimeofday(&newnow, nullptr); - LOG_INFO(F("ems-esp time set from thermostat")); + LOG_INFO(("ems-esp time set from thermostat")); } #endif } @@ -1548,7 +1548,7 @@ bool Thermostat::set_calinttemp(const char * value, const int8_t id) { } auto t = (int8_t)(ct * 10); - LOG_DEBUG(F("Calibrating internal temperature to %d.%d C"), t / 10, t < 0 ? -t % 10 : t % 10); + LOG_DEBUG(("Calibrating internal temperature to %d.%d C"), t / 10, t < 0 ? -t % 10 : t % 10); if (model() == EMS_DEVICE_FLAG_RC10) { write_command(0xB0, 0, t, 0xB0); @@ -2132,7 +2132,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { return false; } if (!EMSESP::system_.ntp_connected()) { - LOG_WARNING(F("Set date: no valid NTP data, setting from ESP Clock")); + LOG_WARNING(("Set date: no valid NTP data, setting from ESP Clock")); } data[0] = tm_->tm_year - 100; // Bosch counts from 2000 @@ -2153,15 +2153,15 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { data[6] = (dt[20] - '0'); // day of week, Mo:0 data[7] = (dt[22] - '0') + 2; // DST and flag } else { - LOG_WARNING(F("Set date: invalid data, wrong length")); + LOG_WARNING(("Set date: invalid data, wrong length")); return false; } if (data[1] == 0 || data[1] > 12 || data[2] > 23 || data[3] == 0 || data[3] > 31 || data[4] > 59 || data[5] > 59 || data[6] > 6 || data[7] > 3) { - LOG_WARNING(F("Invalid date/time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); + LOG_WARNING(("Invalid date/time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); return false; } - // LOG_INFO(F("Setting date and time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); + // LOG_INFO(("Setting date and time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); write_command(EMS_TYPE_time, 0, data, 8, EMS_TYPE_time); return true; @@ -2634,7 +2634,7 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char day = 7; on = 7; time = 0x90; - // LOG_INFO(F("switchtime %02d cleared"), no); + // LOG_INFO(("switchtime %02d cleared"), no); } } else { if (strlen(value) > 1) { @@ -2651,7 +2651,7 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char if (strlen(value) > 4) { for (uint8_t i = 0; i < 7; i++) { // we use EN settings for the day abbreviation - if (!strncmp(&value[3], read_flash_string(FL_(enum_dayOfWeek)[i][0]).c_str(), 2)) { + if (!strncmp(&value[3], (FL_(enum_dayOfWeek)[i][0]), 2)) { day = i; } @@ -2675,7 +2675,7 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char day = 7; on = 7; time = 0x90; - // LOG_INFO(F("switchtime %02d cleared"), no); + // LOG_INFO(("switchtime %02d cleared"), no); } } uint8_t data[2] = {0xE7, 0x90}; // unset switchtime @@ -2691,20 +2691,20 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char max_on = 1; } if (no > 41 || time > 0x90 || ((on < min_on || on > max_on) && on != 7)) { - // LOG_WARNING(F("Setting switchtime: Invalid data: %s"), value); - // LOG_WARNING(F("Setting switchtime: Invalid data: %02d.%1d.0x%02X.%1d"), no, day, time, on); + // LOG_WARNING(("Setting switchtime: Invalid data: %s"), value); + // LOG_WARNING(("Setting switchtime: Invalid data: %02d.%1d.0x%02X.%1d"), no, day, time, on); return false; } if (data[0] != 0xE7) { // we use EN settings for the day abbreviation - std::string sday = read_flash_string(FL_(enum_dayOfWeek)[day][0]); + std::string sday = (FL_(enum_dayOfWeek)[day][0]); // std::string sday = Helpers::translated_word(FL_(enum_dayOfWeek)[day]); if (model() == EMS_DEVICE_FLAG_RC35 || model() == EMS_DEVICE_FLAG_RC30_N) { snprintf(out, len, "%02d %s %02d:%02d %s", no, sday.c_str(), time / 6, 10 * (time % 6), on ? "on" : "off"); } else if ((model() == EMS_DEVICE_FLAG_RC20) || (model() == EMS_DEVICE_FLAG_RC30)) { snprintf(out, len, "%02d %s %02d:%02d T%d", no, sday.c_str(), time / 6, 10 * (time % 6), on); } else { - std::string son = read_flash_string(FL_(enum_switchmode)[on][0]); + std::string son = (FL_(enum_switchmode)[on][0]); // std::string son = Helpers::translated_word(FL_(enum_switchmode)[on]); snprintf(out, len, "%02d %s %02d:%02d %s", no, sday.c_str(), time / 6, 10 * (time % 6), son.c_str()); } diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 2a8a8321d..d0f259d8d 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -44,39 +44,39 @@ bool EMSdevice::has_entities() const { } std::string EMSdevice::tag_to_string(uint8_t tag) { - return read_flash_string(DeviceValue::DeviceValueTAG_s[tag]); + return (DeviceValue::DeviceValueTAG_s[tag]); } std::string EMSdevice::tag_to_mqtt(uint8_t tag) { - return read_flash_string(DeviceValue::DeviceValueTAG_mqtt[tag]); + return (DeviceValue::DeviceValueTAG_mqtt[tag]); } // convert UOM to a string - these don't need translating std::string EMSdevice::uom_to_string(uint8_t uom) { if (EMSESP::system_.fahrenheit() && (uom == DeviceValueUOM::DEGREES || uom == DeviceValueUOM::DEGREES_R)) { - return read_flash_string(DeviceValue::DeviceValueUOM_s[DeviceValueUOM::FAHRENHEIT]); + return (DeviceValue::DeviceValueUOM_s[DeviceValueUOM::FAHRENHEIT]); } - return read_flash_string(DeviceValue::DeviceValueUOM_s[uom]); + return (DeviceValue::DeviceValueUOM_s[uom]); } std::string EMSdevice::brand_to_string() const { switch (brand_) { case EMSdevice::Brand::BOSCH: - return read_flash_string(F("Bosch")); + return (("Bosch")); case EMSdevice::Brand::JUNKERS: - return read_flash_string(F("Junkers")); + return (("Junkers")); case EMSdevice::Brand::BUDERUS: - return read_flash_string(F("Buderus")); + return (("Buderus")); case EMSdevice::Brand::NEFIT: - return read_flash_string(F("Nefit")); + return (("Nefit")); case EMSdevice::Brand::SIEGER: - return read_flash_string(F("Sieger")); + return (("Sieger")); case EMSdevice::Brand::WORCESTER: - return read_flash_string(F("Worcester")); + return (("Worcester")); case EMSdevice::Brand::IVT: - return read_flash_string(F("IVT")); + return (("IVT")); default: - return read_flash_string(F("")); + return (("")); } } @@ -84,29 +84,29 @@ std::string EMSdevice::brand_to_string() const { std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) { switch (device_type) { case DeviceType::SYSTEM: - return read_flash_string(F_(system)); + return (F_(system)); case DeviceType::BOILER: - return read_flash_string(F_(boiler)); + return (F_(boiler)); case DeviceType::THERMOSTAT: - return read_flash_string(F_(thermostat)); + return (F_(thermostat)); case DeviceType::HEATPUMP: - return read_flash_string(F_(heatpump)); + return (F_(heatpump)); case DeviceType::SOLAR: - return read_flash_string(F_(solar)); + return (F_(solar)); case DeviceType::CONNECT: - return read_flash_string(F_(connect)); + return (F_(connect)); case DeviceType::MIXER: - return read_flash_string(F_(mixer)); + return (F_(mixer)); case DeviceType::DALLASSENSOR: - return read_flash_string(F_(dallassensor)); + return (F_(dallassensor)); case DeviceType::ANALOGSENSOR: - return read_flash_string(F_(analogsensor)); + return (F_(analogsensor)); case DeviceType::CONTROLLER: - return read_flash_string(F_(controller)); + return (F_(controller)); case DeviceType::SWITCH: - return read_flash_string(F_(switch)); + return (F_(switch)); case DeviceType::GATEWAY: - return read_flash_string(F_(gateway)); + return (F_(gateway)); default: return Helpers::translated_word(FL_(unknown)); } @@ -215,7 +215,7 @@ std::string EMSdevice::to_string_short() const { // for each telegram that has the fetch value set (true) do a read request void EMSdevice::fetch_values() { - EMSESP::logger().debug(F("Fetching values for deviceID 0x%02X"), device_id()); + EMSESP::logger().debug(("Fetching values for deviceID 0x%02X"), device_id()); for (const auto & tf : telegram_functions_) { if (tf.fetch_) { @@ -226,7 +226,7 @@ void EMSdevice::fetch_values() { // toggle on/off automatic fetch for a telegramID void EMSdevice::toggle_fetch(uint16_t telegram_id, bool toggle) { - EMSESP::logger().debug(F("Toggling fetch for deviceID 0x%02X, telegramID 0x%02X to %d"), device_id(), telegram_id, toggle); + EMSESP::logger().debug(("Toggling fetch for deviceID 0x%02X, telegramID 0x%02X to %d"), device_id(), telegram_id, toggle); for (auto & tf : telegram_functions_) { if (tf.telegram_type_id_ == telegram_id) { @@ -264,9 +264,9 @@ void EMSdevice::list_device_entries(JsonObject & output) const { // if we have a tag prefix it char key[50]; if (!EMSdevice::tag_to_mqtt(dv.tag).empty()) { - snprintf(key, sizeof(key), "%s.%s", EMSdevice::tag_to_mqtt(dv.tag).c_str(), read_flash_string(dv.short_name).c_str()); + snprintf(key, sizeof(key), "%s.%s", EMSdevice::tag_to_mqtt(dv.tag).c_str(), (dv.short_name)); } else { - snprintf(key, sizeof(key), "%s", read_flash_string(dv.short_name).c_str()); + snprintf(key, sizeof(key), "%s", (dv.short_name)); } JsonArray details = output.createNestedArray(key); @@ -289,7 +289,7 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const { } /* // colored list of type-ids - shell.printf(F(" This %s will listen to telegram type IDs: "), device_type_name().c_str()); + shell.printf((" This %s will listen to telegram type IDs: "), device_type_name().c_str()); for (const auto & tf : telegram_functions_) { if (tf.received_ && !tf.fetch_) { shell.printf(COLOR_BRIGHT_GREEN); @@ -298,34 +298,34 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const { } else { shell.printf(COLOR_BRIGHT_RED); } - shell.printf(F("0x%02X "), tf.telegram_type_id_); + shell.printf(("0x%02X "), tf.telegram_type_id_); } shell.printf(COLOR_RESET); */ - shell.printf(F(" Received telegram type IDs: ")); + shell.printf((" Received telegram type IDs: ")); for (const auto & tf : telegram_functions_) { if (tf.received_ && !tf.fetch_) { - shell.printf(F("0x%02X "), tf.telegram_type_id_); + shell.printf(("0x%02X "), tf.telegram_type_id_); } } shell.println(); - shell.printf(F(" Fetched telegram type IDs: ")); + shell.printf((" Fetched telegram type IDs: ")); for (const auto & tf : telegram_functions_) { if (tf.fetch_) { - shell.printf(F("0x%02X "), tf.telegram_type_id_); + shell.printf(("0x%02X "), tf.telegram_type_id_); } } shell.println(); - shell.printf(F(" Pending telegram type IDs: ")); + shell.printf((" Pending telegram type IDs: ")); for (const auto & tf : telegram_functions_) { if (!tf.received_ && !tf.fetch_) { - shell.printf(F("0x%02X "), tf.telegram_type_id_); + shell.printf(("0x%02X "), tf.telegram_type_id_); } } shell.println(); - shell.printf(F(" Ignored telegram type IDs: ")); + shell.printf((" Ignored telegram type IDs: ")); for (auto handlers : handlers_ignored_) { - shell.printf(F("0x%02X "), handlers); + shell.printf(("0x%02X "), handlers); } shell.println(); } @@ -379,7 +379,7 @@ void EMSdevice::show_mqtt_handlers(uuid::console::Shell & shell) const { } // register a callback function for a specific telegram type -void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, const process_function_p f) { +void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, const process_function_p f) { telegram_functions_.emplace_back(telegram_type_id, telegram_type_name, fetch, false, f); } @@ -397,21 +397,21 @@ void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const __ // has_cmd: true if this is an associated command // min: min allowed value // max: max allowed value -void EMSdevice::add_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * options_single, - int8_t numeric_operator, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max) { +void EMSdevice::add_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const ** options, + const char * const * options_single, + int8_t numeric_operator, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max) { bool has_cmd = (f != nullptr); - auto short_name = name[0]; - const class __FlashStringHelper * const * fullname = &name[1]; // translations start at index 1 + auto short_name = name[0]; + auto fullname = &name[1]; // translations start at index 1 // initialize the device value depending on it's type if (type == DeviceValueType::STRING) { @@ -440,7 +440,7 @@ void EMSdevice::add_device_value(uint8_t tag, EMSESP::webCustomizationService.read([&](WebCustomization & settings) { for (EntityCustomization entityCustomization : settings.entityCustomizations) { if ((entityCustomization.product_id == product_id()) && (entityCustomization.device_id == device_id())) { - std::string entity = tag < DeviceValueTAG::TAG_HC1 ? read_flash_string(short_name) : tag_to_string(tag) + "/" + read_flash_string(short_name); + std::string entity = tag < DeviceValueTAG::TAG_HC1 ? (short_name) : tag_to_string(tag) + "/" + (short_name); for (std::string entity_id : entityCustomization.entity_ids) { // if there is an appended custom name, strip it to get the true entity name // and extract the new custom name @@ -490,107 +490,102 @@ void EMSdevice::add_device_value(uint8_t tag, // add the command to our library // cmd is the short_name and the description is the fullname (not the custom fullname) - Command::add(device_type_, short_name, f, Helpers::translated_fword(fullname), flags); + Command::add(device_type_, short_name, f, Helpers::translated_word(fullname).c_str(), flags); } // single list of options -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const * options_single, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f) { +void EMSdevice::register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const * options_single, + const char * const * name, + uint8_t uom, + const cmd_function_p f) { // create a multi-list from the options add_device_value(tag, value_p, type, nullptr, options_single, 0, name, uom, f, 0, 0); }; // single list of options, with no translations, with min and max -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const * options_single, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max) { +void EMSdevice::register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const * options_single, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max) { // create a multi-list from the options add_device_value(tag, value_p, type, nullptr, options_single, 0, name, uom, f, min, max); }; -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - int8_t numeric_operator, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f) { +void EMSdevice::register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + int8_t numeric_operator, + const char * const * name, + uint8_t uom, + const cmd_function_p f) { add_device_value(tag, value_p, type, nullptr, nullptr, numeric_operator, name, uom, f, 0, 0); } -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - int8_t numeric_operator, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max) { +void EMSdevice::register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + int8_t numeric_operator, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max) { add_device_value(tag, value_p, type, nullptr, nullptr, numeric_operator, name, uom, f, min, max); } // no options, no function -void EMSdevice::register_device_value(uint8_t tag, void * value_p, uint8_t type, const __FlashStringHelper * const * name, uint8_t uom, const cmd_function_p f) { +void EMSdevice::register_device_value(uint8_t tag, void * value_p, uint8_t type, const char * const * name, uint8_t uom, const cmd_function_p f) { add_device_value(tag, value_p, type, nullptr, nullptr, 0, name, uom, f, 0, 0); }; // no options, with min/max -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max) { +void EMSdevice::register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max) { add_device_value(tag, value_p, type, nullptr, nullptr, 0, name, uom, f, min, max); }; // function with min and max values // adds a new command to the command list // in this function we separate out the short and long names and take any translations -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max) { +void EMSdevice::register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const ** options, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max) { add_device_value(tag, value_p, type, options, nullptr, 0, name, uom, f, min, max); } // function with no min and max values (set to 0) -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f) { +void EMSdevice::register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const ** options, + const char * const * name, + uint8_t uom, + const cmd_function_p f) { add_device_value(tag, value_p, type, options, nullptr, 0, name, uom, f, 0, 0); } // no associated command function, or min/max values -void EMSdevice::register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * name, - uint8_t uom) { +void EMSdevice::register_device_value(uint8_t tag, void * value_p, uint8_t type, const char * const ** options, const char * const * name, uint8_t uom) { add_device_value(tag, value_p, type, options, nullptr, 0, name, uom, nullptr, 0, 0); } @@ -609,7 +604,7 @@ bool EMSdevice::is_readonly(const std::string & cmd, const int8_t id) const { uint8_t tag = id > 0 ? DeviceValueTAG::TAG_HC1 + id - 1 : DeviceValueTAG::TAG_NONE; for (const auto & dv : devicevalues_) { // check command name and tag, id -1 is default hc and only checks name - if (dv.has_cmd && read_flash_string(dv.short_name) == cmd && (dv.tag < DeviceValueTAG::TAG_HC1 || dv.tag == tag || id == -1)) { + if (dv.has_cmd && std::string(dv.short_name) == cmd && (dv.tag < DeviceValueTAG::TAG_HC1 || dv.tag == tag || id == -1)) { return dv.has_state(DeviceValueState::DV_READONLY); } } @@ -637,24 +632,14 @@ void EMSdevice::publish_value(void * value_p) const { char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; if (Mqtt::publish_single2cmd()) { if (dv.tag >= DeviceValueTAG::TAG_HC1) { - snprintf(topic, - sizeof(topic), - "%s/%s/%s", - device_type_2_device_name(device_type_).c_str(), - tag_to_mqtt(dv.tag).c_str(), - read_flash_string(dv.short_name).c_str()); + snprintf(topic, sizeof(topic), "%s/%s/%s", device_type_2_device_name(device_type_).c_str(), tag_to_mqtt(dv.tag).c_str(), (dv.short_name)); } else { - snprintf(topic, sizeof(topic), "%s/%s", device_type_2_device_name(device_type_).c_str(), read_flash_string(dv.short_name).c_str()); + snprintf(topic, sizeof(topic), "%s/%s", device_type_2_device_name(device_type_).c_str(), (dv.short_name)); } } else if (Mqtt::is_nested() && dv.tag >= DeviceValueTAG::TAG_HC1) { - snprintf(topic, - sizeof(topic), - "%s/%s/%s", - Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), - tag_to_mqtt(dv.tag).c_str(), - read_flash_string(dv.short_name).c_str()); + snprintf(topic, sizeof(topic), "%s/%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), tag_to_mqtt(dv.tag).c_str(), (dv.short_name)); } else { - snprintf(topic, sizeof(topic), "%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), read_flash_string(dv.short_name).c_str()); + snprintf(topic, sizeof(topic), "%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), (dv.short_name)); } int8_t num_op = dv.numeric_operator; @@ -724,11 +709,12 @@ std::string EMSdevice::get_value_uom(const char * key) const { char * key_p = new_key; for (uint8_t i = 0; i < DeviceValue::tag_count; i++) { - auto tag = read_flash_string(DeviceValue::DeviceValueTAG_s[i]); - if (!tag.empty()) { - std::string key2 = key; // copy char to a std::string - if ((key2.find(tag) != std::string::npos) && (key[tag.length()] == ' ')) { - key_p += tag.length() + 1; // remove the tag + auto tag = (DeviceValue::DeviceValueTAG_s[i]); + if (tag) { + std::string key2 = key; // copy char to a std::string + auto length = strlen(tag); // TODO check if this still works + if ((key2.find(tag) != std::string::npos) && (key[length] == ' ')) { + key_p += length + 1; // remove the tag break; } } @@ -823,7 +809,7 @@ void EMSdevice::generate_values_web(JsonObject & output) { if (dv.has_cmd && !dv.has_state(DeviceValueState::DV_READONLY)) { // add the name of the Command function if (dv.tag >= DeviceValueTAG::TAG_HC1) { - obj["c"] = tag_to_mqtt(dv.tag) + "/" + read_flash_string(dv.short_name); + obj["c"] = tag_to_mqtt(dv.tag) + "/" + (dv.short_name); } else { obj["c"] = dv.short_name; } @@ -938,9 +924,9 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) { // id holds the shortname and must always have a value for the WebUI table to work if (dv.tag >= DeviceValueTAG::TAG_HC1) { - obj["id"] = tag_to_string(dv.tag) + "/" + read_flash_string(dv.short_name); + obj["id"] = tag_to_string(dv.tag) + "/" + (dv.short_name); } else { - obj["id"] = read_flash_string(dv.short_name); + obj["id"] = (dv.short_name); } // n is the fullname, and can be optional @@ -974,8 +960,7 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) { // returns true if the entity has a mask set (not 0 the default) void EMSdevice::setCustomEntity(const std::string & entity_id) { for (auto & dv : devicevalues_) { - std::string entity_name = - dv.tag < DeviceValueTAG::TAG_HC1 ? read_flash_string(dv.short_name) : tag_to_string(dv.tag) + "/" + read_flash_string(dv.short_name); + std::string entity_name = dv.tag < DeviceValueTAG::TAG_HC1 ? (dv.short_name) : tag_to_string(dv.tag) + "/" + (dv.short_name); // extra shortname std::string shortname; @@ -1017,9 +1002,8 @@ void EMSdevice::setCustomEntity(const std::string & entity_id) { // populate a string vector with entities that have masks set or have a custom name void EMSdevice::getCustomEntities(std::vector & entity_ids) { for (const auto & dv : devicevalues_) { - std::string entity_name = - dv.tag < DeviceValueTAG::TAG_HC1 ? read_flash_string(dv.short_name) : tag_to_string(dv.tag) + "/" + read_flash_string(dv.short_name); - uint8_t mask = dv.state >> 4; + std::string entity_name = dv.tag < DeviceValueTAG::TAG_HC1 ? (dv.short_name) : tag_to_string(dv.tag) + "/" + (dv.short_name); + uint8_t mask = dv.state >> 4; if (mask || !dv.custom_fullname.empty()) { if (dv.custom_fullname.empty()) { @@ -1057,7 +1041,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 // search device value with this tag for (auto & dv : devicevalues_) { - if (strcmp(command_s, Helpers::toLower(read_flash_string(dv.short_name)).c_str()) == 0 && (tag <= 0 || tag == dv.tag)) { + if (!strcmp(command_s, dv.short_name) && (tag <= 0 || tag == dv.tag)) { int8_t num_op = dv.numeric_operator; uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; @@ -1144,7 +1128,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 json[value] = Helpers::render_boolean(s, value_b); } } - json[type] = F("boolean"); + json[type] = ("boolean"); break; case DeviceValueType::TIME: @@ -1158,7 +1142,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 if (Helpers::hasValue((char *)(dv.value_p))) { json[value] = (char *)(dv.value_p); } - json[type] = F("string"); + json[type] = ("string"); break; case DeviceValueType::CMD: @@ -1200,7 +1184,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 // if we're filtering on an attribute, go find it if (attribute_s) { #if defined(EMSESP_DEBUG) - EMSESP::logger().debug(F("[DEBUG] Attribute '%s'"), attribute_s); + EMSESP::logger().debug(("[DEBUG] Attribute '%s'"), attribute_s); #endif if (json.containsKey(attribute_s)) { JsonVariant data = json[attribute_s]; @@ -1275,7 +1259,7 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c strlcpy(name, fullname.c_str(), sizeof(name)); // use full name } } else { - strlcpy(name, read_flash_string(dv.short_name).c_str(), sizeof(name)); // use short name + strlcpy(name, (dv.short_name), sizeof(name)); // use short name // if we have a tag, and its different to the last one create a nested object. only for hc, wwc and hs if (dv.tag != old_tag) { @@ -1418,7 +1402,7 @@ void EMSdevice::mqtt_ha_entity_config_remove() { if (dv.has_state(DeviceValueState::DV_HA_CONFIG_CREATED) && ((dv.has_state(DeviceValueState::DV_API_MQTT_EXCLUDE)) || (!dv.has_state(DeviceValueState::DV_ACTIVE)))) { dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED); - if (dv.short_name == FL_(climate)[0]) { + if (strcmp(dv.short_name, FL_(climate)[0])) { Mqtt::publish_ha_climate_config(dv.tag, false, true); // delete topic (remove = true) } else { Mqtt::publish_ha_sensor_config(dv, "", "", true); // delete topic (remove = true) @@ -1483,14 +1467,14 @@ bool EMSdevice::has_telegram_id(uint16_t id) const { std::string EMSdevice::telegram_type_name(std::shared_ptr telegram) const { // see if it's one of the common ones, like Version if (telegram->type_id == EMS_TYPE_VERSION) { - return read_flash_string(F("Version")); + return (("Version")); } else if (telegram->type_id == EMS_TYPE_UBADevices) { - return read_flash_string(F("UBADevices")); + return (("UBADevices")); } for (const auto & tf : telegram_functions_) { if ((tf.telegram_type_id_ == telegram->type_id) && (telegram->type_id != 0xFF)) { - return read_flash_string(tf.telegram_type_name_); + return (tf.telegram_type_name_); } } @@ -1505,7 +1489,7 @@ bool EMSdevice::handle_telegram(std::shared_ptr telegram) { // if the data block is empty and we have not received data before, assume that this telegram // is not recognized by the bus master. So remove it from the automatic fetch list if (telegram->message_length == 0 && telegram->offset == 0 && !tf.received_) { - EMSESP::logger().debug(F("This telegram (%s) is not recognized by the EMS bus"), read_flash_string(tf.telegram_type_name_).c_str()); + EMSESP::logger().debug(("This telegram (%s) is not recognized by the EMS bus"), (tf.telegram_type_name_)); tf.fetch_ = false; return false; } diff --git a/src/emsdevice.h b/src/emsdevice.h index 1d21270bf..8a841e14a 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -192,7 +192,7 @@ class EMSdevice { using process_function_p = std::function)>; - void register_telegram_type(const uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, const process_function_p cb); + void register_telegram_type(const uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, const process_function_p cb); bool handle_telegram(std::shared_ptr telegram); std::string get_value_uom(const char * key) const; @@ -204,93 +204,77 @@ class EMSdevice { void generate_values_web(JsonObject & output); void generate_values_web_customization(JsonArray & output); - void add_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * options_single, - int8_t numeric_operator, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max); + void add_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const ** options, + const char * const * options_single, + int8_t numeric_operator, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max); - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max); + void register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const ** options, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max); - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f); + void + register_device_value(uint8_t tag, void * value_p, uint8_t type, const char * const ** options, const char * const * name, uint8_t uom, const cmd_function_p f); - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * name, - uint8_t uom); + void register_device_value(uint8_t tag, void * value_p, uint8_t type, const char * const ** options, const char * const * name, uint8_t uom); - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - int8_t numeric_operator, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f = nullptr); + void register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + int8_t numeric_operator, + const char * const * name, + uint8_t uom, + const cmd_function_p f = nullptr); - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - int8_t numeric_operator, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max); + void register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + int8_t numeric_operator, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max); // single list of options - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const * options_single, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f = nullptr); + void register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const * options_single, + const char * const * name, + uint8_t uom, + const cmd_function_p f = nullptr); // single list of options, with no translations, with min and max - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const * options_single, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max); + void register_device_value(uint8_t tag, + void * value_p, + uint8_t type, + const char * const * options_single, + const char * const * name, + uint8_t uom, + const cmd_function_p f, + int16_t min, + uint16_t max); // no options, optional function f - void register_device_value(uint8_t tag, void * value_p, uint8_t type, const __FlashStringHelper * const * name, uint8_t uom, const cmd_function_p f = nullptr); + void register_device_value(uint8_t tag, void * value_p, uint8_t type, const char * const * name, uint8_t uom, const cmd_function_p f = nullptr); // no options, with min/max - void register_device_value(uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const * name, - uint8_t uom, - const cmd_function_p f, - int16_t min, - uint16_t max); + void + register_device_value(uint8_t tag, void * value_p, uint8_t type, const char * const * name, uint8_t uom, const cmd_function_p f, int16_t min, uint16_t max); void write_command(const uint16_t type_id, const uint8_t offset, uint8_t * message_data, const uint8_t message_length, const uint16_t validate_typeid) const; void write_command(const uint16_t type_id, const uint8_t offset, const uint8_t value, const uint16_t validate_typeid) const; @@ -438,13 +422,13 @@ class EMSdevice { bool ha_config_firstrun_ = true; // this means a first setup of HA is needed after a restart struct TelegramFunction { - uint16_t telegram_type_id_; // it's type_id - const __FlashStringHelper * telegram_type_name_; // e.g. RC20Message - bool fetch_; // if this type_id be queried automatically - bool received_; - process_function_p process_function_; + uint16_t telegram_type_id_; // it's type_id + const char * telegram_type_name_; // e.g. RC20Message + bool fetch_; // if this type_id be queried automatically + bool received_; + process_function_p process_function_; - TelegramFunction(uint16_t telegram_type_id, const __FlashStringHelper * telegram_type_name, bool fetch, bool received, const process_function_p process_function) + TelegramFunction(uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, bool received, const process_function_p process_function) : telegram_type_id_(telegram_type_id) , telegram_type_name_(telegram_type_name) , fetch_(fetch) diff --git a/src/emsdevicevalue.cpp b/src/emsdevicevalue.cpp index 649d4fff8..0e369c6cd 100644 --- a/src/emsdevicevalue.cpp +++ b/src/emsdevicevalue.cpp @@ -23,21 +23,21 @@ namespace emsesp { // constructor -DeviceValue::DeviceValue(uint8_t device_type, - uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * options_single, - int8_t numeric_operator, - const __FlashStringHelper * const short_name, - const __FlashStringHelper * const * fullname, - std::string & custom_fullname, - uint8_t uom, - bool has_cmd, - int16_t min, - uint16_t max, - uint8_t state) +DeviceValue::DeviceValue(uint8_t device_type, + uint8_t tag, + void * value_p, + uint8_t type, + const char * const ** options, + const char * const * options_single, + int8_t numeric_operator, + const char * const short_name, + const char * const * fullname, + std::string & custom_fullname, + uint8_t uom, + bool has_cmd, + int16_t min, + uint16_t max, + uint8_t state) : device_type(device_type) , tag(tag) , value_p(value_p) @@ -63,7 +63,7 @@ DeviceValue::DeviceValue(uint8_t device_type, #ifdef EMSESP_STANDALONE // only added for debugging Serial.print("registering entity: "); - Serial.print(read_flash_string(short_name).c_str()); + Serial.print((short_name)); Serial.print("/"); if (!custom_fullname.empty()) { Serial.print(COLOR_BRIGHT_CYAN); @@ -83,13 +83,13 @@ DeviceValue::DeviceValue(uint8_t device_type, Serial.print(" option"); Serial.print(i + 1); Serial.print(":"); - auto str = Helpers::translated_fword(options[i]); - Serial.print(read_flash_string(str).c_str()); + auto str = Helpers::translated_word(options[i]); + Serial.print((str.c_str())); i++; } } else if (options_single != nullptr) { Serial.print("option1:!"); - Serial.print(read_flash_string(options_single[0]).c_str()); + Serial.print((options_single[0])); Serial.print("!"); } Serial.println(""); @@ -99,7 +99,7 @@ DeviceValue::DeviceValue(uint8_t device_type, // mapping of UOM, to match order in DeviceValueUOM enum emsdevice.h // also maps to DeviceValueUOM in interface/src/project/types.ts for the Web UI // must be an int of 4 bytes, 32bit aligned -const __FlashStringHelper * DeviceValue::DeviceValueUOM_s[] __attribute__((__aligned__(sizeof(uint32_t)))) PROGMEM = { +const char * DeviceValue::DeviceValueUOM_s[] = { F_(uom_blank), F_(uom_degrees), @@ -125,7 +125,7 @@ const __FlashStringHelper * DeviceValue::DeviceValueUOM_s[] __attribute__((__ali // mapping of TAGs, to match order in DeviceValueTAG enum in emsdevice.h // must be an int of 4 bytes, 32bit aligned -const __FlashStringHelper * const DeviceValue::DeviceValueTAG_s[] PROGMEM = { +const char * const DeviceValue::DeviceValueTAG_s[] = { F_(tag_none), // "" F_(tag_heartbeat), // "" @@ -171,7 +171,7 @@ const __FlashStringHelper * const DeviceValue::DeviceValueTAG_s[] PROGMEM = { }; // MQTT topics derived from tags -const __FlashStringHelper * const DeviceValue::DeviceValueTAG_mqtt[] PROGMEM = { +const char * const DeviceValue::DeviceValueTAG_mqtt[] = { F_(tag_none), // "" F_(heartbeat), // "heartbeat" @@ -217,7 +217,7 @@ const __FlashStringHelper * const DeviceValue::DeviceValueTAG_mqtt[] PROGMEM = { }; // count #tags once at compile time -size_t DeviceValue::tag_count = sizeof(DeviceValue::DeviceValueTAG_s) / sizeof(__FlashStringHelper *); +size_t DeviceValue::tag_count = sizeof(DeviceValue::DeviceValueTAG_s) / sizeof(char *); // checks whether the device value has an actual value // returns true if its valid diff --git a/src/emsdevicevalue.h b/src/emsdevicevalue.h index 6420692fa..2f6722ca8 100644 --- a/src/emsdevicevalue.h +++ b/src/emsdevicevalue.h @@ -25,7 +25,6 @@ #include "helpers.h" // for conversions #include "default_settings.h" // for enum types -#include // for read_flash_string namespace emsesp { @@ -143,38 +142,38 @@ class DeviceValue { DV_NUMOP_MUL15 = -15 }; - uint8_t device_type; // EMSdevice::DeviceType - uint8_t tag; // DeviceValueTAG::* - void * value_p; // pointer to variable of any type - uint8_t type; // DeviceValueType::* - const __FlashStringHelper * const ** options; // options as a flash char array - const __FlashStringHelper * const * options_single; // options are not translated - int8_t numeric_operator; - uint8_t options_size; // number of options in the char array, calculated - const __FlashStringHelper * const short_name; // used in MQTT and API - const __FlashStringHelper * const * fullname; // used in Web and Console, is translated - std::string custom_fullname; // optional, from customization - uint8_t uom; // DeviceValueUOM::* - bool has_cmd; // true if there is a Console/MQTT command which matches the short_name - int16_t min; // min range - uint16_t max; // max range - uint8_t state; // DeviceValueState::* + uint8_t device_type; // EMSdevice::DeviceType + uint8_t tag; // DeviceValueTAG::* + void * value_p; // pointer to variable of any type + uint8_t type; // DeviceValueType::* + const char * const ** options; // options as a flash char array + const char * const * options_single; // options are not translated + int8_t numeric_operator; + uint8_t options_size; // number of options in the char array, calculated + const char * const short_name; // used in MQTT and API + const char * const * fullname; // used in Web and Console, is translated + std::string custom_fullname; // optional, from customization + uint8_t uom; // DeviceValueUOM::* + bool has_cmd; // true if there is a Console/MQTT command which matches the short_name + int16_t min; // min range + uint16_t max; // max range + uint8_t state; // DeviceValueState::* - DeviceValue(uint8_t device_type, - uint8_t tag, - void * value_p, - uint8_t type, - const __FlashStringHelper * const ** options, - const __FlashStringHelper * const * options_single, - int8_t numeric_operator, - const __FlashStringHelper * const short_name, - const __FlashStringHelper * const * fullname, - std::string & custom_fullname, - uint8_t uom, - bool has_cmd, - int16_t min, - uint16_t max, - uint8_t state); + DeviceValue(uint8_t device_type, + uint8_t tag, + void * value_p, + uint8_t type, + const char * const ** options, + const char * const * options_single, + int8_t numeric_operator, + const char * const short_name, + const char * const * fullname, + std::string & custom_fullname, + uint8_t uom, + bool has_cmd, + int16_t min, + uint16_t max, + uint8_t state); bool hasValue() const; bool get_min_max(int16_t & dv_set_min, int16_t & dv_set_max); @@ -195,10 +194,10 @@ class DeviceValue { return state; } - static const __FlashStringHelper * DeviceValueUOM_s[]; - static const __FlashStringHelper * const DeviceValueTAG_s[]; - static const __FlashStringHelper * const DeviceValueTAG_mqtt[]; - static size_t tag_count; // # tags + static const char * DeviceValueUOM_s[]; + static const char * const DeviceValueTAG_s[]; + static const char * const DeviceValueTAG_mqtt[]; + static size_t tag_count; // # tags }; }; // namespace emsesp diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 51f2a6fe9..95b9a1bce 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -190,7 +190,7 @@ void EMSESP::uart_init() { if (System::is_valid_gpio(rx_gpio) && System::is_valid_gpio(tx_gpio)) { EMSuart::start(tx_mode, rx_gpio, tx_gpio); // start UART } else { - LOG_WARNING(F("Invalid UART Rx/Tx GPIOs. Check config.")); + LOG_WARNING(("Invalid UART Rx/Tx GPIOs. Check config.")); } txservice_.start(); // sends out request to EMS bus for all devices @@ -234,42 +234,42 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { // EMS bus information switch (bus_status()) { case BUS_STATUS_OFFLINE: - shell.printfln(F("EMS Bus is disconnected.")); + shell.printfln(("EMS Bus is disconnected.")); break; case BUS_STATUS_TX_ERRORS: - shell.printfln(F("EMS Bus is connected, but Tx is not stable.")); + shell.printfln(("EMS Bus is connected, but Tx is not stable.")); break; default: - shell.printfln(F("EMS Bus is connected.")); + shell.printfln(("EMS Bus is connected.")); break; } shell.println(); if (bus_status() != BUS_STATUS_OFFLINE) { - shell.printfln(F("EMS Bus info:")); - EMSESP::webSettingsService.read([&](WebSettings & settings) { shell.printfln(F(" Tx mode: %d"), settings.tx_mode); }); - shell.printfln(F(" Bus protocol: %s"), EMSbus::is_ht3() ? F("HT3") : F("Buderus")); - shell.printfln(F(" #recognized EMS devices: %d"), EMSESP::emsdevices.size()); - shell.printfln(F(" #telegrams received: %d"), rxservice_.telegram_count()); - shell.printfln(F(" #read requests sent: %d"), txservice_.telegram_read_count()); - shell.printfln(F(" #write requests sent: %d"), txservice_.telegram_write_count()); - shell.printfln(F(" #incomplete telegrams: %d"), rxservice_.telegram_error_count()); - shell.printfln(F(" #read fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_read_fail_count()); - shell.printfln(F(" #write fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_write_fail_count()); - shell.printfln(F(" Rx line quality: %d%%"), rxservice_.quality()); - shell.printfln(F(" Tx line quality: %d%%"), (txservice_.read_quality() + txservice_.read_quality()) / 2); + shell.printfln(("EMS Bus info:")); + EMSESP::webSettingsService.read([&](WebSettings & settings) { shell.printfln((" Tx mode: %d"), settings.tx_mode); }); + shell.printfln((" Bus protocol: %s"), EMSbus::is_ht3() ? ("HT3") : ("Buderus")); + shell.printfln((" #recognized EMS devices: %d"), EMSESP::emsdevices.size()); + shell.printfln((" #telegrams received: %d"), rxservice_.telegram_count()); + shell.printfln((" #read requests sent: %d"), txservice_.telegram_read_count()); + shell.printfln((" #write requests sent: %d"), txservice_.telegram_write_count()); + shell.printfln((" #incomplete telegrams: %d"), rxservice_.telegram_error_count()); + shell.printfln((" #read fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_read_fail_count()); + shell.printfln((" #write fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_write_fail_count()); + shell.printfln((" Rx line quality: %d%%"), rxservice_.quality()); + shell.printfln((" Tx line quality: %d%%"), (txservice_.read_quality() + txservice_.read_quality()) / 2); shell.println(); } // Rx queue auto rx_telegrams = rxservice_.queue(); if (rx_telegrams.empty()) { - shell.printfln(F("Rx Queue is empty")); + shell.printfln(("Rx Queue is empty")); } else { - shell.printfln(F("Rx Queue (%ld telegram%s):"), rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s"); + shell.printfln(("Rx Queue (%ld telegram%s):"), rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s"); for (const auto & it : rx_telegrams) { - shell.printfln(F(" [%02d] %s"), it.id_, pretty_telegram(it.telegram_).c_str()); + shell.printfln((" [%02d] %s"), it.id_, pretty_telegram(it.telegram_).c_str()); } } @@ -278,20 +278,20 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { // Tx queue auto tx_telegrams = txservice_.queue(); if (tx_telegrams.empty()) { - shell.printfln(F("Tx Queue is empty")); + shell.printfln(("Tx Queue is empty")); } else { - shell.printfln(F("Tx Queue (%ld telegram%s):"), tx_telegrams.size(), tx_telegrams.size() == 1 ? "" : "s"); + shell.printfln(("Tx Queue (%ld telegram%s):"), tx_telegrams.size(), tx_telegrams.size() == 1 ? "" : "s"); std::string op; for (const auto & it : tx_telegrams) { if ((it.telegram_->operation) == Telegram::Operation::TX_RAW) { - op = read_flash_string(F("RAW ")); + op = "RAW "; } else if ((it.telegram_->operation) == Telegram::Operation::TX_READ) { - op = read_flash_string(F("READ ")); + op = "READ "; } else if ((it.telegram_->operation) == Telegram::Operation::TX_WRITE) { - op = read_flash_string(F("WRITE")); + op = "WRITE"; } - shell.printfln(F(" [%02d%c] %s %s"), it.id_, ((it.retry_) ? '*' : ' '), op.c_str(), pretty_telegram(it.telegram_).c_str()); + shell.printfln((" [%02d%c] %s %s"), it.id_, ((it.retry_) ? '*' : ' '), op.c_str(), pretty_telegram(it.telegram_).c_str()); } } @@ -301,7 +301,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { // show EMS device values to the shell console void EMSESP::show_device_values(uuid::console::Shell & shell) { if (emsdevices.empty()) { - shell.printfln(F("No EMS devices detected.")); + shell.printfln(("No EMS devices detected.")); shell.println(); return; } @@ -311,7 +311,7 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) { for (const auto & emsdevice : emsdevices) { if (emsdevice && (emsdevice->device_type() == device_class.first)) { // print header - shell.printfln(F("%s: %s (%d)"), emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str(), emsdevice->count_entities()); + shell.printfln(("%s: %s (%d)"), emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str(), emsdevice->count_entities()); DynamicJsonDocument doc(EMSESP_JSON_SIZE_XXLARGE_DYN); // use max size JsonObject json = doc.to(); @@ -359,14 +359,14 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) { // show Dallas temperature sensors and Analog sensors void EMSESP::show_sensor_values(uuid::console::Shell & shell) { if (dallassensor_.have_sensors()) { - shell.printfln(F("Temperature sensors:")); + shell.printfln(("Temperature sensors:")); char s[10]; char s2[10]; uint8_t fahrenheit = EMSESP::system_.fahrenheit() ? 2 : 0; for (const auto & sensor : dallassensor_.sensors()) { if (Helpers::hasValue(sensor.temperature_c)) { - shell.printfln(F(" %s: %s%s °%c%s (offset %s, ID: %s)"), + shell.printfln((" %s: %s%s °%c%s (offset %s, ID: %s)"), sensor.name().c_str(), COLOR_BRIGHT_GREEN, Helpers::render_value(s, sensor.temperature_c, 10, fahrenheit), @@ -375,10 +375,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) { Helpers::render_value(s2, sensor.offset(), 10, fahrenheit), sensor.id().c_str()); } else { - shell.printfln(F(" %s (offset %s, ID: %s)"), - sensor.name().c_str(), - Helpers::render_value(s, sensor.offset(), 10, fahrenheit), - sensor.id().c_str()); + shell.printfln((" %s (offset %s, ID: %s)"), sensor.name().c_str(), Helpers::render_value(s, sensor.offset(), 10, fahrenheit), sensor.id().c_str()); } } shell.println(); @@ -387,11 +384,11 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) { if (analogsensor_.have_sensors()) { char s[10]; char s2[10]; - shell.printfln(F("Analog sensors:")); + shell.printfln(("Analog sensors:")); for (const auto & sensor : analogsensor_.sensors()) { switch (sensor.type()) { case AnalogSensor::AnalogType::ADC: - shell.printfln(F(" %s: %s%s %s%s (Type: ADC, Factor: %s, Offset: %d)"), + shell.printfln((" %s: %s%s %s%s (Type: ADC, Factor: %s, Offset: %d)"), sensor.name().c_str(), COLOR_BRIGHT_GREEN, Helpers::render_value(s, sensor.value(), 2), @@ -403,7 +400,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) { default: // case AnalogSensor::AnalogType::DIGITAL_IN: // case AnalogSensor::AnalogType::COUNTER: - shell.printfln(F(" %s: %s%d%s (Type: %s)"), + shell.printfln((" %s: %s%d%s (Type: %s)"), sensor.name().c_str(), COLOR_BRIGHT_GREEN, (uint16_t)sensor.value(), // as int @@ -540,7 +537,7 @@ void EMSESP::publish_device_values(uint8_t device_type) { } if (need_publish) { if (doc.overflowed()) { - LOG_WARNING(F("MQTT buffer overflow, please use individual topics")); + LOG_WARNING(("MQTT buffer overflow, please use individual topics")); } Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_NONE), json); } @@ -625,9 +622,9 @@ bool EMSESP::get_device_value_info(JsonObject & root, const char * cmd, const in // search for recognized device_ids : Me, All, otherwise print hex value std::string EMSESP::device_tostring(const uint8_t device_id) { if ((device_id & 0x7F) == rxservice_.ems_bus_id()) { - return read_flash_string(F("Me")); + return "Me"; } else if (device_id == 0x00) { - return read_flash_string(F("All")); + return "All"; } else { char buffer[5]; return Helpers::hextoa(buffer, device_id); @@ -672,14 +669,14 @@ std::string EMSESP::pretty_telegram(std::shared_ptr telegram) { // check for global/common types like Version & UBADevices if (telegram->type_id == EMSdevice::EMS_TYPE_VERSION) { - type_name = read_flash_string(F("Version")); + type_name = "Version"; } else if (telegram->type_id == EMSdevice::EMS_TYPE_UBADevices) { - type_name = read_flash_string(F("UBADevices")); + type_name = "UBADevices"; } // if we don't know the type show if (type_name.empty()) { - type_name = read_flash_string(F("?")); + type_name = "?"; } std::string str; @@ -728,7 +725,7 @@ void EMSESP::process_UBADevices(std::shared_ptr telegram) { // if we haven't already detected this device, request it's version details, unless its us (EMS-ESP) // when the version info is received, it will automagically add the device if ((device_id != EMSbus::ems_bus_id()) && !(EMSESP::device_exists(device_id))) { - LOG_DEBUG(F("New EMS device detected with ID 0x%02X. Requesting version information."), device_id); + LOG_DEBUG(("New EMS device detected with ID 0x%02X. Requesting version information."), device_id); send_read_request(EMSdevice::EMS_TYPE_VERSION, device_id); } } @@ -788,7 +785,7 @@ void EMSESP::process_version(std::shared_ptr telegram) { bool EMSESP::process_telegram(std::shared_ptr telegram) { // if watching or reading... if ((telegram->type_id == read_id_) && (telegram->dest == txservice_.ems_bus_id())) { - LOG_INFO(F("%s"), pretty_telegram(telegram).c_str()); + LOG_INFO(("%s"), pretty_telegram(telegram).c_str()); if (Mqtt::send_response()) { publish_response(telegram); } @@ -800,18 +797,18 @@ bool EMSESP::process_telegram(std::shared_ptr telegram) { } else if (watch() == WATCH_ON) { if ((watch_id_ == WATCH_ID_NONE) || (telegram->type_id == watch_id_) || ((watch_id_ < 0x80) && ((telegram->src == watch_id_) || (telegram->dest == watch_id_)))) { - LOG_NOTICE(F("%s"), pretty_telegram(telegram).c_str()); + LOG_NOTICE(("%s"), pretty_telegram(telegram).c_str()); } else if (!trace_raw_) { - LOG_TRACE(F("%s"), pretty_telegram(telegram).c_str()); + LOG_TRACE(("%s"), pretty_telegram(telegram).c_str()); } } else if (!trace_raw_) { - LOG_TRACE(F("%s"), pretty_telegram(telegram).c_str()); + LOG_TRACE(("%s"), pretty_telegram(telegram).c_str()); } // only process broadcast telegrams or ones sent to us on request // if ((telegram->dest != 0x00) && (telegram->dest != rxservice_.ems_bus_id())) { if (telegram->operation == Telegram::Operation::RX_READ) { - // LOG_DEBUG(F("read telegram received, not processing")); + // LOG_DEBUG(("read telegram received, not processing")); return false; } @@ -861,9 +858,9 @@ bool EMSESP::process_telegram(std::shared_ptr telegram) { } if (!found) { - LOG_DEBUG(F("No telegram type handler found for ID 0x%02X (src 0x%02X)"), telegram->type_id, telegram->src); + LOG_DEBUG(("No telegram type handler found for ID 0x%02X (src 0x%02X)"), telegram->type_id, telegram->src); if (watch() == WATCH_UNKNOWN) { - LOG_NOTICE(F("%s"), pretty_telegram(telegram).c_str()); + LOG_NOTICE(("%s"), pretty_telegram(telegram).c_str()); } if (!wait_km_ && !knowndevice && (telegram->src != EMSbus::ems_bus_id()) && (telegram->message_length > 0)) { send_read_request(EMSdevice::EMS_TYPE_VERSION, telegram->src); @@ -887,12 +884,12 @@ bool EMSESP::device_exists(const uint8_t device_id) { // for each associated EMS device go and get its system information void EMSESP::show_devices(uuid::console::Shell & shell) { if (emsdevices.empty()) { - shell.printfln(F("No EMS devices detected. Try using 'scan devices' from the ems menu.")); + shell.printfln(("No EMS devices detected. Try using 'scan devices' from the ems menu.")); shell.println(); return; } - shell.printfln(F("These EMS devices are currently active:")); + shell.printfln(("These EMS devices are currently active:")); shell.println(); // count the number of thermostats @@ -908,7 +905,7 @@ void EMSESP::show_devices(uuid::console::Shell & shell) { for (const auto & device_class : EMSFactory::device_handlers()) { for (const auto & emsdevice : emsdevices) { if (emsdevice && (emsdevice->device_type() == device_class.first)) { - shell.printf(F("%s: %s"), emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str()); + shell.printf(("%s: %s"), emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str()); shell.println(); emsdevice->show_telegram_handlers(shell); @@ -935,7 +932,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const if (product_id == 0) { // update only with valid product_id return true; } - LOG_DEBUG(F("Updating details for already active deviceID 0x%02X"), device_id); + LOG_DEBUG(("Updating details for already active deviceID 0x%02X"), device_id); emsdevice->product_id(product_id); emsdevice->version(version); // only set brand if it doesn't already exist @@ -976,7 +973,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const // if we don't recognize the productID report it and add as a generic device if (device_p == nullptr) { - LOG_NOTICE(F("Unrecognized EMS device (deviceID 0x%02X, productID %d). Please report on GitHub."), device_id, product_id); + LOG_NOTICE(("Unrecognized EMS device (deviceID 0x%02X, productID %d). Please report on GitHub."), device_id, product_id); emsdevices.push_back( EMSFactory::add(DeviceType::GENERIC, device_id, product_id, version, "unknown", DeviceFlags::EMS_DEVICE_FLAG_NONE, EMSdevice::Brand::NO_BRAND)); return false; // not found @@ -1021,14 +1018,14 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const name = "generic boiler"; device_type = DeviceType::BOILER; flags = DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP; - LOG_WARNING(F("Unknown EMS boiler. Using generic profile. Please report on GitHub.")); + LOG_WARNING(("Unknown EMS boiler. Using generic profile. Please report on GitHub.")); } else { - LOG_WARNING(F("Unrecognized EMS device (device ID 0x%02X, no product ID). Please report on GitHub."), device_id); + LOG_WARNING(("Unrecognized EMS device (device ID 0x%02X, no product ID). Please report on GitHub."), device_id); return false; } } - LOG_DEBUG(F("Adding new device %s (deviceID 0x%02X, productID %d, version %s)"), name, device_id, product_id, version); + LOG_DEBUG(("Adding new device %s (deviceID 0x%02X, productID %d, version %s)"), name, device_id, product_id, version); emsdevices.push_back(EMSFactory::add(device_type, device_id, product_id, version, name, flags, brand)); // assign a unique ID. Note that this is not actual unique after a restart as it's dependent on the order that devices are found @@ -1042,7 +1039,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const fetch_device_values(device_id); // go and fetch its data // Print to LOG showing we've added a new device - LOG_INFO(F("Recognized new %s with deviceID 0x%02X"), EMSdevice::device_type_2_device_name(device_type).c_str(), device_id); + LOG_INFO(("Recognized new %s with deviceID 0x%02X"), EMSdevice::device_type_2_device_name(device_type).c_str(), device_id); // add command commands for all devices, except for connect, controller and gateway if ((device_type == DeviceType::CONNECT) || (device_type == DeviceType::CONTROLLER) || (device_type == DeviceType::GATEWAY)) { @@ -1058,7 +1055,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const F_(info_cmd)); Command::add( device_type, - F("values"), + ("values"), [device_type](const char * value, const int8_t id, JsonObject & output) { return command_info(device_type, output, id, EMSdevice::OUTPUT_TARGET::API_SHORTNAMES); // HIDDEN command showing short names, used in e.g. /api/boiler }, @@ -1177,7 +1174,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data); #ifdef EMSESP_UART_DEBUG // get_uptime is only updated once per loop, does not give the right time - LOG_TRACE(F("[UART_DEBUG] Echo after %d ms: %s"), ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE(("[UART_DEBUG] Echo after %d ms: %s"), ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); #endif // add to RxQueue for log/watch rxservice_.add(data, length); @@ -1193,14 +1190,14 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { // if we're waiting on a Write operation, we want a single byte 1 or 4 if ((tx_state == Telegram::Operation::TX_WRITE) && (length == 1)) { if (first_value == TxService::TX_WRITE_SUCCESS) { - LOG_DEBUG(F("Last Tx write successful")); + LOG_DEBUG(("Last Tx write successful")); txservice_.increment_telegram_write_count(); // last tx/write was confirmed ok txservice_.send_poll(); // close the bus publish_id_ = txservice_.post_send_query(); // follow up with any post-read if set txservice_.reset_retry_count(); tx_successful = true; } else if (first_value == TxService::TX_WRITE_FAIL) { - LOG_ERROR(F("Last Tx write rejected by host")); + LOG_ERROR(("Last Tx write rejected by host")); txservice_.send_poll(); // close the bus txservice_.reset_retry_count(); } @@ -1209,7 +1206,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { uint8_t src = data[0]; uint8_t dest = data[1]; if (txservice_.is_last_tx(src, dest)) { - LOG_DEBUG(F("Last Tx read successful")); + LOG_DEBUG(("Last Tx read successful")); txservice_.increment_telegram_read_count(); txservice_.send_poll(); // close the bus txservice_.reset_retry_count(); @@ -1251,11 +1248,11 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { #ifdef EMSESP_UART_DEBUG char s[4]; if (first_value & 0x80) { - LOG_TRACE(F("[UART_DEBUG] next Poll %s after %d ms"), Helpers::hextoa(s, first_value), ::millis() - rx_time_); + LOG_TRACE(("[UART_DEBUG] next Poll %s after %d ms"), Helpers::hextoa(s, first_value), ::millis() - rx_time_); // time measurement starts here, use millis because get_uptime is only updated once per loop rx_time_ = ::millis(); } else { - LOG_TRACE(F("[UART_DEBUG] Poll ack %s after %d ms"), Helpers::hextoa(s, first_value), ::millis() - rx_time_); + LOG_TRACE(("[UART_DEBUG] Poll ack %s after %d ms"), Helpers::hextoa(s, first_value), ::millis() - rx_time_); } #endif // check for poll to us, if so send top message from Tx queue immediately and quit @@ -1267,7 +1264,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { return; } else { #ifdef EMSESP_UART_DEBUG - LOG_TRACE(F("[UART_DEBUG] Reply after %d ms: %s"), ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE(("[UART_DEBUG] Reply after %d ms: %s"), ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); #endif Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data); // check if there is a message for the roomcontroller @@ -1292,14 +1289,14 @@ void EMSESP::start() { webLogService.begin(); // start web log service. now we can start capturing logs to the web log #ifdef EMSESP_DEBUG - LOG_NOTICE(F("System is running in Debug mode")); + LOG_NOTICE(("System is running in Debug mode")); #endif - LOG_INFO(F("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str()); + LOG_INFO(("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str()); // do any system upgrades if (system_.check_upgrade()) { - LOG_INFO(F("System needs a restart to apply new settings. Please wait.")); + LOG_INFO(("System needs a restart to apply new settings. Please wait.")); system_.system_restart(); }; @@ -1315,7 +1312,7 @@ void EMSESP::start() { // start all the EMS-ESP services mqtt_.start(); // mqtt init system_.start(); // starts commands, led, adc, button, network, syslog & uart - LOG_INFO(F("Starting EMS-ESP version %s (hostname: %s)"), EMSESP_APP_VERSION, system_.hostname().c_str()); // welcome message + LOG_INFO(("Starting EMS-ESP version %s (hostname: %s)"), EMSESP_APP_VERSION, system_.hostname().c_str()); // welcome message shower_.start(); // initialize shower timer and shower alert dallassensor_.start(); // Dallas external sensors @@ -1326,7 +1323,7 @@ void EMSESP::start() { device_library_ = { #include "device_library.h" }; - LOG_INFO(F("Loaded EMS device library (%d records)"), device_library_.size()); + LOG_INFO(("Loaded EMS device library (%d records)"), device_library_.size()); #if defined(EMSESP_STANDALONE) Mqtt::on_connect(); // simulate an MQTT connection diff --git a/src/helpers.cpp b/src/helpers.cpp index c92c08a5f..80e400207 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -608,7 +608,7 @@ bool Helpers::value2bool(const char * value, bool & value_b) { // checks to see if a string is member of a vector and return the index, also allow true/false for on/off // this for a list of lists, when using translated strings -bool Helpers::value2enum(const char * value, uint8_t & value_ui, const __FlashStringHelper * const ** strs) { +bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * const ** strs) { if ((value == nullptr) || (strlen(value) == 0)) { return false; } @@ -616,7 +616,7 @@ bool Helpers::value2enum(const char * value, uint8_t & value_ui, const __FlashSt for (value_ui = 0; strs[value_ui]; value_ui++) { std::string str1 = toLower(Helpers::translated_word(strs[value_ui])); - std::string str2 = toLower(read_flash_string(strs[value_ui][0])); // also check for default language + std::string str2 = toLower((strs[value_ui][0])); // also check for default language if ((str1 != "") && ((str2 == "off" && str == "false") || (str2 == "on" && str == "true") || (str == str1) || (str == str2) || (value[0] == ('0' + value_ui) && value[1] == '\0'))) { @@ -628,14 +628,14 @@ bool Helpers::value2enum(const char * value, uint8_t & value_ui, const __FlashSt } // checks to see if a string is member of a vector and return the index, also allow true/false for on/off -bool Helpers::value2enum(const char * value, uint8_t & value_ui, const __FlashStringHelper * const * strs) { +bool Helpers::value2enum(const char * value, uint8_t & value_ui, const char * const * strs) { if ((value == nullptr) || (strlen(value) == 0)) { return false; } std::string str = toLower(value); for (value_ui = 0; strs[value_ui]; value_ui++) { - std::string enum_str = toLower(read_flash_string(strs[value_ui])); + std::string enum_str = toLower((strs[value_ui])); if ((enum_str != "") && ((enum_str == "off" && (str == Helpers::translated_word(FL_(off)) || str == "false")) @@ -655,6 +655,23 @@ std::string Helpers::toLower(std::string const & s) { return lc; } + +// TODO fix toLower +std::string Helpers::toLower(const char * s) { + std::string lc = s; + std::transform(lc.begin(), lc.end(), lc.begin(), [](unsigned char c) { return std::tolower(c); }); + return lc; + + /* + + for (; *s; ++s) { + *p = tolower(*s); + p++; + } + + */ +} + std::string Helpers::toUpper(std::string const & s) { std::string lc = s; std::transform(lc.begin(), lc.end(), lc.begin(), [](unsigned char c) { return std::toupper(c); }); @@ -676,7 +693,7 @@ void Helpers::replace_char(char * str, char find, char replace) { // count number of items in a list // the end of a list has a nullptr -uint8_t Helpers::count_items(const __FlashStringHelper * const * list) { +uint8_t Helpers::count_items(const char * const * list) { uint8_t list_size = 0; if (list != nullptr) { while (list[list_size]) { @@ -688,7 +705,7 @@ uint8_t Helpers::count_items(const __FlashStringHelper * const * list) { // count number of items in a list of lists // the end of a list has a nullptr -uint8_t Helpers::count_items(const __FlashStringHelper * const ** list) { +uint8_t Helpers::count_items(const char * const ** list) { uint8_t list_size = 0; if (list != nullptr) { while (list[list_size]) { @@ -699,29 +716,15 @@ uint8_t Helpers::count_items(const __FlashStringHelper * const ** list) { } // return translated string as a std::string, optionally converting to lowercase (for console commands) -// takes a FL(...) -std::string Helpers::translated_word(const __FlashStringHelper * const * strings, bool to_lower) { +std::string Helpers::translated_word(const char * const * strings, bool to_lower) { uint8_t language_index = EMSESP::system_.language_index(); uint8_t index = 0; // see how many translations we have for this entity. if there is no translation for this, revert to EN - if (Helpers::count_items(strings) >= language_index + 1 && !read_flash_string(strings[language_index]).empty()) { + if (Helpers::count_items(strings) >= language_index + 1 && strlen(strings[language_index])) { index = language_index; } - return to_lower ? toLower(read_flash_string(strings[index])) : read_flash_string(strings[index]); -} - -// return translated string -// takes a F(...) -const __FlashStringHelper * Helpers::translated_fword(const __FlashStringHelper * const * strings) { - uint8_t language_index = EMSESP::system_.language_index(); - uint8_t index = 0; - - // see how many translations we have for this entity. if there is no translation for this, revert to EN - if (Helpers::count_items(strings) >= language_index + 1 && !read_flash_string(strings[language_index]).empty()) { - index = language_index; - } - return strings[index]; + return to_lower ? toLower((strings[index])) : (strings[index]); } } // namespace emsesp diff --git a/src/helpers.h b/src/helpers.h index 396baa960..9f7efd9f7 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -54,7 +54,9 @@ class Helpers { static std::string toLower(std::string const & s); static std::string toUpper(std::string const & s); - static void replace_char(char * str, char find, char replace); + static std::string toLower(const char * s); + + static void replace_char(char * str, char find, char replace); static bool hasValue(const uint8_t & value, const uint8_t isBool = 0); static bool hasValue(const int8_t & value); @@ -67,16 +69,15 @@ class Helpers { static bool value2float(const char * value, float & value_f); static bool value2bool(const char * value, bool & value_b); static bool value2string(const char * value, std::string & value_s); - static bool value2enum(const char * value, uint8_t & value_ui, const __FlashStringHelper * const ** strs); - static bool value2enum(const char * value, uint8_t & value_ui, const __FlashStringHelper * const * strs); + static bool value2enum(const char * value, uint8_t & value_ui, const char * const ** strs); + static bool value2enum(const char * value, uint8_t & value_ui, const char * const * strs); static bool value2temperature(const char * value, float & value_f, bool relative = false); static bool value2temperature(const char * value, int & value_i, const bool relative = false, const int min = -2147483648, const int max = 2147483647); - static uint8_t count_items(const __FlashStringHelper * const ** list); - static uint8_t count_items(const __FlashStringHelper * const * list); + static uint8_t count_items(const char * const ** list); + static uint8_t count_items(const char * const * list); - static std::string translated_word(const __FlashStringHelper * const * strings, bool to_lower = false); - static const __FlashStringHelper * translated_fword(const __FlashStringHelper * const * strings); + static std::string translated_word(const char * const * strings, bool to_lower = false); #ifdef EMSESP_STANDALONE static char * ultostr(char * ptr, uint32_t value, const uint8_t base); diff --git a/src/locale_common.h b/src/locale_common.h index b0d32323a..35ea7eaca 100644 --- a/src/locale_common.h +++ b/src/locale_common.h @@ -144,46 +144,46 @@ MAKE_PSTR(password_prompt, "Password: ") MAKE_PSTR(unset, "") // more common names that don't need translations -MAKE_PSTR_LIST(1x3min, F("1x3min")) -MAKE_PSTR_LIST(2x3min, F("2x3min")) -MAKE_PSTR_LIST(3x3min, F("3x3min")) -MAKE_PSTR_LIST(4x3min, F("4x3min")) -MAKE_PSTR_LIST(5x3min, F("5x3min")) -MAKE_PSTR_LIST(6x3min, F("6x3min")) -MAKE_PSTR_LIST(auto, F("auto")) -MAKE_PSTR_LIST(na, F("n/a")) -MAKE_PSTR_LIST(rc3x, F("rc3x")) -MAKE_PSTR_LIST(rc20, F("rc20")) -MAKE_PSTR_LIST(fb10, F("fb10")) -MAKE_PSTR_LIST(fb100, F("fb100")) -MAKE_PSTR_LIST(dash, F("-")) -MAKE_PSTR_LIST(error, F("error")) -MAKE_PSTR_LIST(BLANK, F("")) -MAKE_PSTR_LIST(pwm, F("pwm")) -MAKE_PSTR_LIST(pwm_invers, F("pwm inverse")) -MAKE_PSTR_LIST(mpc, F("mpc")) -MAKE_PSTR_LIST(tempauto, F("temp auto")) -MAKE_PSTR_LIST(bypass, F("bypass")) -MAKE_PSTR_LIST(mixer, F("mixer")) -MAKE_PSTR_LIST(monovalent, F("monovalent")) -MAKE_PSTR_LIST(bivalent, F("bivalent")) -MAKE_PSTR_LIST(n_o, F("n_o")) -MAKE_PSTR_LIST(n_c, F("n_c")) -MAKE_PSTR_LIST(prog1, F("prog 1")) -MAKE_PSTR_LIST(prog2, F("prog 2")) -MAKE_PSTR_LIST(proga, F("prog a")) -MAKE_PSTR_LIST(progb, F("prog b")) -MAKE_PSTR_LIST(progc, F("prog c")) -MAKE_PSTR_LIST(progd, F("prog d")) -MAKE_PSTR_LIST(proge, F("prog e")) -MAKE_PSTR_LIST(progf, F("prog f")) +MAKE_PSTR_LIST(1x3min, "1x3min") +MAKE_PSTR_LIST(2x3min, "2x3min") +MAKE_PSTR_LIST(3x3min, "3x3min") +MAKE_PSTR_LIST(4x3min, "4x3min") +MAKE_PSTR_LIST(5x3min, "5x3min") +MAKE_PSTR_LIST(6x3min, "6x3min") +MAKE_PSTR_LIST(auto, "auto") +MAKE_PSTR_LIST(na, "n/a") +MAKE_PSTR_LIST(rc3x, "rc3x") +MAKE_PSTR_LIST(rc20, "rc20") +MAKE_PSTR_LIST(fb10, "fb10") +MAKE_PSTR_LIST(fb100, "fb100") +MAKE_PSTR_LIST(dash, "-") +MAKE_PSTR_LIST(error, "error") +MAKE_PSTR_LIST(BLANK, "") +MAKE_PSTR_LIST(pwm, "pwm") +MAKE_PSTR_LIST(pwm_invers, "pwm inverse") +MAKE_PSTR_LIST(mpc, "mpc") +MAKE_PSTR_LIST(tempauto, "temp auto") +MAKE_PSTR_LIST(bypass, "bypass") +MAKE_PSTR_LIST(mixer, "mixer") +MAKE_PSTR_LIST(monovalent, "monovalent") +MAKE_PSTR_LIST(bivalent, "bivalent") +MAKE_PSTR_LIST(n_o, "n_o") +MAKE_PSTR_LIST(n_c, "n_c") +MAKE_PSTR_LIST(prog1, "prog 1") +MAKE_PSTR_LIST(prog2, "prog 2") +MAKE_PSTR_LIST(proga, "prog a") +MAKE_PSTR_LIST(progb, "prog b") +MAKE_PSTR_LIST(progc, "prog c") +MAKE_PSTR_LIST(progd, "prog d") +MAKE_PSTR_LIST(proge, "prog e") +MAKE_PSTR_LIST(progf, "prog f") // templates - this are not translated and will be saved under optons_single -MAKE_PSTR_LIST(tpl_datetime, F("Format: < NTP | dd.mm.yyyy-hh:mm:ss-day(0-6)-dst(0/1) >")) -MAKE_PSTR_LIST(tpl_switchtime, F("Format: [ not_set | day hh:mm on|off ]")) -MAKE_PSTR_LIST(tpl_switchtime1, F("Format: [ not_set | day hh:mm Tn ]")) -MAKE_PSTR_LIST(tpl_holidays, F("Format: < dd.mm.yyyy-dd.mm.yyyy >")) -MAKE_PSTR_LIST(tpl_date, F("Format: < dd.mm.yyyy >")) +MAKE_PSTR_LIST(tpl_datetime, "Format: < NTP | dd.mm.yyyy-hh:mm:ss-day(0-6)-dst(0/1) >") +MAKE_PSTR_LIST(tpl_switchtime, "Format: [ not_set | day hh:mm on|off ]") +MAKE_PSTR_LIST(tpl_switchtime1, "Format: [ not_set | day hh:mm Tn ]") +MAKE_PSTR_LIST(tpl_holidays, "Format: < dd.mm.yyyy-dd.mm.yyyy >") +MAKE_PSTR_LIST(tpl_date, "Format: < dd.mm.yyyy >") // Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp // These don't need translating, it will mess up HA and the API @@ -264,16 +264,16 @@ MAKE_PSTR(response, "response") MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww") MAKE_PSTR(tag_device_data_ww_mqtt, "") -MAKE_PSTR_LIST(climate, F("HA climate config creation")) +MAKE_PSTR_LIST(climate, "HA climate config creation") // syslog -MAKE_PSTR_LIST(list_syslog_level, F("off"), F("emerg"), F("alert"), F("crit"), F("error"), F("warn"), F("notice"), F("info"), F("debug"), F("trace"), F("all")) +MAKE_PSTR_LIST(list_syslog_level, "off", "emerg", "alert", "crit", "error", "warn", "notice", "info", "debug", "trace", "all") // sensors -MAKE_PSTR_LIST(list_sensortype, F("none"), F("digital in"), F("counter"), F("adc"), F("timer"), F("rate"), F("digital out"), F("pwm 0"), F("pwm 1"), F("pwm 2")) +MAKE_PSTR_LIST(list_sensortype, "none", "digital in", "counter", "adc", "timer", "rate", "digital out", "pwm 0", "pwm 1", "pwm 2") // watch -MAKE_PSTR_LIST(list_watch, F("off"), F("on"), F("raw"), F("unknown")) +MAKE_PSTR_LIST(list_watch, "off", "on", "raw", "unknown") /* * The rest below are Enums and generated from translations lists diff --git a/src/locale_translations.h b/src/locale_translations.h index 2160e3f7e..28563790f 100644 --- a/src/locale_translations.h +++ b/src/locale_translations.h @@ -29,1143 +29,831 @@ // translations are in order en, de,nl, se.... // if there is no translation, it will default to en -// MAKE_PSTR_LIST2(on, "on", "an", "aan", "på") // TODO remove - // General -MAKE_PSTR_LIST(on, F("on"), F("an"), F("aan"), F("på")) -MAKE_PSTR_LIST(off, F("off"), F("aus"), F("uit"), F("av")) -MAKE_PSTR_LIST(ON, F("ON"), F("AN"), F("AAN"), F("PÅ")) -MAKE_PSTR_LIST(OFF, F("OFF"), F("AUS"), F("UIT"), F("AV")) +MAKE_PSTR_LIST(on, "on", "an", "aan", "på") +MAKE_PSTR_LIST(off, "off", "aus", "uit", "av") +MAKE_PSTR_LIST(ON, "ON", "AN", "AAN", "PÅ") +MAKE_PSTR_LIST(OFF, "OFF", "AUS", "UIT", "AV") // Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp // uom - also used with HA see https://github.com/home-assistant/core/blob/d7ac4bd65379e11461c7ce0893d3533d8d8b8cbf/homeassistant/const.py#L384 -MAKE_PSTR_LIST(minutes, F("minutes"), F("Minuten"), F("Minuten"), F("Minuter")) -MAKE_PSTR_LIST(hours, F("hours"), F("Stunden"), F("Uren"), F("Timmar")) -MAKE_PSTR_LIST(days, F("days"), F("Tage"), F("Dagen"), F("Dagar")) -MAKE_PSTR_LIST(seconds, F("seconds"), F("Sekunden"), F("Seconden"), F("Sekunder")) +MAKE_PSTR_LIST(minutes, "minutes", "Minuten", "Minuten", "Minuter") +MAKE_PSTR_LIST(hours, "hours", "Stunden", "Uren", "Timmar") +MAKE_PSTR_LIST(days, "days", "Tage", "Dagen", "Dagar") +MAKE_PSTR_LIST(seconds, "seconds", "Sekunden", "Seconden", "Sekunder") // Enum translations // general -MAKE_PSTR_LIST(day_mo, F("mo"), F("Mo"), F("Mo"), F("Må")) -MAKE_PSTR_LIST(day_tu, F("tu"), F("Di"), F("Di"), F("Ti")) -MAKE_PSTR_LIST(day_we, F("we"), F("Mi"), F("Wo"), F("On")) -MAKE_PSTR_LIST(day_th, F("th"), F("Do"), F("Do"), F("To")) -MAKE_PSTR_LIST(day_fr, F("fr"), F("Fr"), F("Vr"), F("Fr")) -MAKE_PSTR_LIST(day_sa, F("sa"), F("Sa"), F("Za"), F("Lö")) -MAKE_PSTR_LIST(day_su, F("su"), F("So"), F("Zo"), F("Sö")) -MAKE_PSTR_LIST(all, F("all"), F("Alle"), F("Alle"), F("Alla")) -MAKE_PSTR_LIST(own_1, F("own 1"), F("Eigen 1"), F("Eigen 1"), F("Egen 1")) -MAKE_PSTR_LIST(family, F("family"), F("Familie"), F("Familie"), F("Familj")) -MAKE_PSTR_LIST(morning, F("morning"), F("Morgends"), F("'s ochtends"), F("Morgon")) -MAKE_PSTR_LIST(evening, F("evening"), F("Abends"), F("'s avonds"), F("Kväll")) -MAKE_PSTR_LIST(seniors, F("seniors"), F("Senioren"), F("Senioren"), F("Seniorer")) -MAKE_PSTR_LIST(no, F("no"), F("nein"), F("nee"), F("nej")) -MAKE_PSTR_LIST(new, F("new"), F("Neu"), F("Nieuw"), F("Ny")) -MAKE_PSTR_LIST(own_2, F("own 2"), F("Eigen 2"), F("Eigen 2"), F("Egen 2")) -MAKE_PSTR_LIST(singles, F("singles"), F("Singles"), F("Singles"), F("Singlar")) -MAKE_PSTR_LIST(am, F("am"), F("Vormittag"), F("Ochtend"), F("Förmiddag")) -MAKE_PSTR_LIST(pm, F("pm"), F("Nachmittag"), F("Namiddag"), F("Eftermiddag")) -MAKE_PSTR_LIST(midday, F("midday"), F("Mittag"), F("Middag"), F("Middag")) -MAKE_PSTR_LIST(unknown, F("unknown"), F("Unbekannt"), F("Onbekend"), F("Okänt")) -MAKE_PSTR_LIST(flat, F("flat"), F("flach"), F("vlak"), F("Platt")) -MAKE_PSTR_LIST(vacuum, F("vacuum"), F("Vakuum"), F("vacuum"), F("Vakuum")) -MAKE_PSTR_LIST(co2_optimized, F("co2 optimized"), F("CO2 optimiert"), F("CO2 geoptimaliseerd"), F("CO2-optimerad")) -MAKE_PSTR_LIST(cost_optimized, F("cost optimized"), F("kostenoptimiert"), F("kosten geoptimaliseerd"), F("kostnadsoptimerad")) -MAKE_PSTR_LIST(outside_temp_switched, F("outside temp switched"), F("Außentemp. gesteuert"), F("Buitentemp. gestuurd"), F("Utomhustemp korrigerad")) -MAKE_PSTR_LIST(co2_cost_mix, F("co2 cost mix"), F("Kostenmix"), F("Kostenmix"), F("Kostnadsmix")) -MAKE_PSTR_LIST(analog, F("analog"), F("analog"), F("analoog"), F("analog")) -MAKE_PSTR_LIST(normal, F("normal"), F("normal"), F("normaal"), F("normal")) -MAKE_PSTR_LIST(blocking, F("blocking"), F("Blockierung"), F("Blokkering"), F("Blockering")) +MAKE_PSTR_LIST(day_mo, "mo", "Mo", "Mo", "Må") +MAKE_PSTR_LIST(day_tu, "tu", "Di", "Di", "Ti") +MAKE_PSTR_LIST(day_we, "we", "Mi", "Wo", "On") +MAKE_PSTR_LIST(day_th, "th", "Do", "Do", "To") +MAKE_PSTR_LIST(day_fr, "fr", "Fr", "Vr", "Fr") +MAKE_PSTR_LIST(day_sa, "sa", "Sa", "Za", "Lö") +MAKE_PSTR_LIST(day_su, "su", "So", "Zo", "Sö") +MAKE_PSTR_LIST(all, "all", "Alle", "Alle", "Alla") +MAKE_PSTR_LIST(own_1, "own 1", "Eigen 1", "Eigen 1", "Egen 1") +MAKE_PSTR_LIST(family, "family", "Familie", "Familie", "Familj") +MAKE_PSTR_LIST(morning, "morning", "Morgends", "'s ochtends", "Morgon") +MAKE_PSTR_LIST(evening, "evening", "Abends", "'s avonds", "Kväll") +MAKE_PSTR_LIST(seniors, "seniors", "Senioren", "Senioren", "Seniorer") +MAKE_PSTR_LIST(no, "no", "nein", "nee", "nej") +MAKE_PSTR_LIST(new, "new", "Neu", "Nieuw", "Ny") +MAKE_PSTR_LIST(own_2, "own 2", "Eigen 2", "Eigen 2", "Egen 2") +MAKE_PSTR_LIST(singles, "singles", "Singles", "Singles", "Singlar") +MAKE_PSTR_LIST(am, "am", "Vormittag", "Ochtend", "Förmiddag") +MAKE_PSTR_LIST(pm, "pm", "Nachmittag", "Namiddag", "Eftermiddag") +MAKE_PSTR_LIST(midday, "midday", "Mittag", "Middag", "Middag") +MAKE_PSTR_LIST(unknown, "unknown", "Unbekannt", "Onbekend", "Okänt") +MAKE_PSTR_LIST(flat, "flat", "flach", "vlak", "Platt") +MAKE_PSTR_LIST(vacuum, "vacuum", "Vakuum", "vacuum", "Vakuum") +MAKE_PSTR_LIST(co2_optimized, "co2 optimized", "CO2 optimiert", "CO2 geoptimaliseerd", "CO2-optimerad") +MAKE_PSTR_LIST(cost_optimized, "cost optimized", "kostenoptimiert", "kosten geoptimaliseerd", "kostnadsoptimerad") +MAKE_PSTR_LIST(outside_temp_switched, "outside temp switched", "Außentemp. gesteuert", "Buitentemp. gestuurd", "Utomhustemp korrigerad") +MAKE_PSTR_LIST(co2_cost_mix, "co2 cost mix", "Kostenmix", "Kostenmix", "Kostnadsmix") +MAKE_PSTR_LIST(analog, "analog", "analog", "analoog", "analog") +MAKE_PSTR_LIST(normal, "normal", "normal", "normaal", "normal") +MAKE_PSTR_LIST(blocking, "blocking", "Blockierung", "Blokkering", "Blockering") // boiler -MAKE_PSTR_LIST(time, F("time"), F("Zeit"), F("Tijd"), F("Tid")) -MAKE_PSTR_LIST(date, F("date"), F("Datum"), F("Datum"), F("Datum")) -MAKE_PSTR_LIST(continuous, F("continuous"), F("kontinuierlich"), F("continue"), F("kontinuerlig")) -MAKE_PSTR_LIST(3wayvalve, F("3-way valve"), F("3-Wege Ventil"), F("3-weg klep"), F("trevägsventil")) -MAKE_PSTR_LIST(chargepump, F("chargepump"), F("Ladepumpe"), F("laadpomp"), F("laddpump")) -MAKE_PSTR_LIST(hot, F("hot"), F("Heiß"), F("Heet"), F("Het")) -MAKE_PSTR_LIST(high_comfort, F("high comfort"), F("gehobener Komfort"), F("Verhoogd comfort"), F("Förhöjd komfort")) -MAKE_PSTR_LIST(eco, F("eco"), F("Eco"), F("Eco"), F("Eko")) -MAKE_PSTR_LIST(intelligent, F("intelligent"), F("Intelligent"), F("Intelligent"), F("Intelligent")) -MAKE_PSTR_LIST(flow, F("flow"), F("Durchfluss"), F("Volumestroom"), F("Flöde")) -MAKE_PSTR_LIST(manual, F("manual"), F("Manuell"), F("Hamdmatig"), F("Manuell")) -MAKE_PSTR_LIST(buffer, F("buffer"), F("Speicher"), F("Buffer"), F("Buffert")) -MAKE_PSTR_LIST(bufferedflow, F("buffered flow"), F("Durchlaufspeicher"), F("Doorstroombuffer"), F("Buffertflöde")) -MAKE_PSTR_LIST(layeredbuffer, F("layered buffer"), F("Schichtspeicher"), F("Gelaagde buffer"), F("Lagrad buffert")) -MAKE_PSTR_LIST(maintenance, F("maintenance"), F("Wartung"), F("Onderhoud"), F("Underhåll")) -MAKE_PSTR_LIST(heating, F("heating"), F("Heizen"), F("Verwarmen"), F("Uppvärmning")) -MAKE_PSTR_LIST(cooling, F("cooling"), F("Kühlen"), F("Koelen"), F("Kyler")) -MAKE_PSTR_LIST(disinfecting, F("disinfecting"), F("Desinfizieren"), F("Desinfecteren"), F("Desinficerar")) -MAKE_PSTR_LIST(no_heat, F("no heat"), F("keine Wärme"), F("Geen warmte"), F("Ingen värme")) -MAKE_PSTR_LIST(heatrequest, F("heat request"), F("Wärmeanforderung"), F("Verwarmignsverzoek"), F("Värmeförfrågan")) -MAKE_PSTR_LIST(valve, F("valve"), F("Ventil"), F("Klep"), F("Ventil")) +MAKE_PSTR_LIST(time, "time", "Zeit", "Tijd", "Tid") +MAKE_PSTR_LIST(date, "date", "Datum", "Datum", "Datum") +MAKE_PSTR_LIST(continuous, "continuous", "kontinuierlich", "continue", "kontinuerlig") +MAKE_PSTR_LIST(3wayvalve, "3-way valve", "3-Wege Ventil", "3-weg klep", "trevägsventil") +MAKE_PSTR_LIST(chargepump, "chargepump", "Ladepumpe", "laadpomp", "laddpump") +MAKE_PSTR_LIST(hot, "hot", "Heiß", "Heet", "Het") +MAKE_PSTR_LIST(high_comfort, "high comfort", "gehobener Komfort", "Verhoogd comfort", "Förhöjd komfort") +MAKE_PSTR_LIST(eco, "eco", "Eco", "Eco", "Eko") +MAKE_PSTR_LIST(intelligent, "intelligent", "Intelligent", "Intelligent", "Intelligent") +MAKE_PSTR_LIST(flow, "flow", "Durchfluss", "Volumestroom", "Flöde") +MAKE_PSTR_LIST(manual, "manual", "Manuell", "Hamdmatig", "Manuell") +MAKE_PSTR_LIST(buffer, "buffer", "Speicher", "Buffer", "Buffert") +MAKE_PSTR_LIST(bufferedflow, "buffered flow", "Durchlaufspeicher", "Doorstroombuffer", "Buffertflöde") +MAKE_PSTR_LIST(layeredbuffer, "layered buffer", "Schichtspeicher", "Gelaagde buffer", "Lagrad buffert") +MAKE_PSTR_LIST(maintenance, "maintenance", "Wartung", "Onderhoud", "Underhåll") +MAKE_PSTR_LIST(heating, "heating", "Heizen", "Verwarmen", "Uppvärmning") +MAKE_PSTR_LIST(cooling, "cooling", "Kühlen", "Koelen", "Kyler") +MAKE_PSTR_LIST(disinfecting, "disinfecting", "Desinfizieren", "Desinfecteren", "Desinficerar") +MAKE_PSTR_LIST(no_heat, "no heat", "keine Wärme", "Geen warmte", "Ingen värme") +MAKE_PSTR_LIST(heatrequest, "heat request", "Wärmeanforderung", "Verwarmignsverzoek", "Värmeförfrågan") +MAKE_PSTR_LIST(valve, "valve", "Ventil", "Klep", "Ventil") // heatpump -MAKE_PSTR_LIST(none, F("none"), F("keine"), F("geen"), F("ingen")) -MAKE_PSTR_LIST(hot_water, F("hot water"), F("Warmwasser"), F("warm water"), F("varmvatten")) -MAKE_PSTR_LIST(pool, F("pool"), F("Pool"), F("zwembad"), F("pool")) +MAKE_PSTR_LIST(none, "none", "keine", "geen", "ingen") +MAKE_PSTR_LIST(hot_water, "hot water", "Warmwasser", "warm water", "varmvatten") +MAKE_PSTR_LIST(pool, "pool", "Pool", "zwembad", "pool") // thermostat -MAKE_PSTR_LIST(seltemp, F("selTemp"), F("Solltemperatur"), F("Doeltemperatuur"), F("Börtemperatur")) -MAKE_PSTR_LIST(roomtemp, F("roomTemp"), F("Raumtemperatur"), F("Kamertemperatuur"), F("Rumstemperatur")) -MAKE_PSTR_LIST(own_prog, F("own prog"), F("Eigenprog."), F("Eigen prog."), F("Egen prog.")) -MAKE_PSTR_LIST(std_prog, F("std prog"), F("Standardprog."), F("Standaard prog."), F("Standardprog.")) -MAKE_PSTR_LIST(light, F("light"), F("Leicht"), F("Licht"), F("Lätt")) -MAKE_PSTR_LIST(medium, F("medium"), F("Mittel"), F("Middel"), F("Medel")) -MAKE_PSTR_LIST(heavy, F("heavy"), F("Schwer"), F("Zwaar"), F("Tung")) -MAKE_PSTR_LIST(start, F("start"), F("Start"), F("Start"), F("Start")) -MAKE_PSTR_LIST(heat, F("heat"), F("Heizen"), F("Verwarmen"), F("Värme")) -MAKE_PSTR_LIST(hold, F("hold"), F("Halten"), F("Pauzeren"), F("Paus")) -MAKE_PSTR_LIST(cool, F("cool"), F("Kühlen"), F("Koelen"), F("Kyla")) -MAKE_PSTR_LIST(end, F("end"), F("Ende"), F("Einde"), F("Slut")) -MAKE_PSTR_LIST(german, F("german"), F("Deutsch"), F("Duits"), F("Tyska")) -MAKE_PSTR_LIST(dutch, F("dutch"), F("Niederländisch"), F("Nederlands"), F("Nederländska")) -MAKE_PSTR_LIST(french, F("french"), F("Französisch"), F("Frans"), F("Franska")) -MAKE_PSTR_LIST(italian, F("italian"), F("Italienisch"), F("Italiaans"), F("Italienska")) -MAKE_PSTR_LIST(high, F("high"), F("hoch"), F("hoog"), F("Hög")) -MAKE_PSTR_LIST(low, F("low"), F("niedrig"), F("laag"), F("Låg")) -MAKE_PSTR_LIST(radiator, F("radiator"), F("Heizkörper"), F("Radiator"), F("Radiator")) -MAKE_PSTR_LIST(convector, F("convector"), F("Konvektor"), F("Convector"), F("Konvektor")) -MAKE_PSTR_LIST(floor, F("floor"), F("Fussboden"), F("Vloer"), F("Golv")) -MAKE_PSTR_LIST(summer, F("summer"), F("Sommer"), F("Zomer"), F("Sommar")) -MAKE_PSTR_LIST(winter, F("winter"), F("Winter"), F("Winter"), F("Vinter")) -MAKE_PSTR_LIST(outdoor, F("outdoor"), F("Außen"), F("Buiten"), F("Utomhus")) -MAKE_PSTR_LIST(room, F("room"), F("Raum"), F("Kamer"), F("Rum")) -MAKE_PSTR_LIST(room_outdoor, F("room outdoor"), F("Raum+Außen"), F("Kamer+Buiten"), F("Rum+Ute")) -MAKE_PSTR_LIST(power, F("power"), F("Leistung"), F("Vermogen"), F("Effekt")) -MAKE_PSTR_LIST(constant, F("constant"), F("konstant"), F("constant"), F("Konstant")) -MAKE_PSTR_LIST(simple, F("simple"), F("einfach"), F("simpel"), F("enkel")) -MAKE_PSTR_LIST(optimized, F("optimized"), F("optimiert"), F("geoptimaliseerd"), F("optimerad")) -MAKE_PSTR_LIST(nofrost, F("nofrost"), F("Frostschutz"), F("Vorstbescherming"), F("Frostskydd")) -MAKE_PSTR_LIST(comfort, F("comfort"), F("Komfort"), F("Comfort"), F("Komfort")) -MAKE_PSTR_LIST(night, F("night"), F("Nacht"), F("Nacht"), F("Natt")) -MAKE_PSTR_LIST(day, F("day"), F("Tag"), F("Dag"), F("Dag")) -MAKE_PSTR_LIST(holiday, F("holiday"), F("Urlaub"), F("Vakantie"), F("Helgdag")) -MAKE_PSTR_LIST(reduce, F("reduce"), F("reduziert"), F("gereduceerd"), F("Reducera")) -MAKE_PSTR_LIST(noreduce, F("no reduce"), F("unreduziert"), F("niet gerduceerd"), F("oreducerad")) -MAKE_PSTR_LIST(offset, F("offset"), F("Anhebung"), F("offset"), F("Förskutning")) -MAKE_PSTR_LIST(design, F("design"), F("Auslegung"), F("Ontwero"), F("Design")) -MAKE_PSTR_LIST(minflow, F("min flow"), F("min. Durchfluss"), F("Min. Doorstroom"), F("Min flöde")) -MAKE_PSTR_LIST(maxflow, F("max flow"), F("max. Durchfluss"), F("Max. Doorstroom"), F("Max flöde")) -MAKE_PSTR_LIST(fast, F("fast"), F("schnell"), F("snel"), F("snabb")) -MAKE_PSTR_LIST(slow, F("slow"), F("langsam"), F("langzaam"), F("långsam")) -MAKE_PSTR_LIST(internal_temperature, F("internal temperature"), F("Interne Temperatur"), F("Interne Temperatuur"), F("Interntemperatur")) -MAKE_PSTR_LIST(internal_setpoint, F("internal setpoint"), F("Interner Sollwert"), F("Interne Streeftemperatuur"), F("Internt börvärde")) -MAKE_PSTR_LIST(external_temperature, F("external temperature"), F("Externe Temperatur"), F("Externe Temperatuur"), F("Extern temperatur")) -MAKE_PSTR_LIST(burner_temperature, F("burner temperature"), F("Brennertemperatur"), F("Brander Temperuur"), F("Brännartemperatur")) -MAKE_PSTR_LIST(ww_temperature, F("ww temperature"), F("Wassertemperatur"), F("Watertemperatuur"), F("Vattentemperatur")) -MAKE_PSTR_LIST(smoke_temperature, F("smoke temperature"), F("Abgastemperatur"), F("Buitentemperatuur"), F("Rökgastemperatur")) -MAKE_PSTR_LIST(weather_compensated, F("weather compensated"), F("Wetter kompensiert"), F("Weer gecompenseerd"), F("Väderkompenserad")) -MAKE_PSTR_LIST(outside_basepoint, F("outside basepoint"), F("Basispunkt Außentemp."), F("Buiten basispunt"), F("Utomhus baspunkt")) -MAKE_PSTR_LIST(functioning_mode, F("functioning mode"), F("Funktionsweise"), F("Functiemodus"), F("Driftläge")) +MAKE_PSTR_LIST(seltemp, "selTemp", "Solltemperatur", "Doeltemperatuur", "Börtemperatur") +MAKE_PSTR_LIST(roomtemp, "roomTemp", "Raumtemperatur", "Kamertemperatuur", "Rumstemperatur") +MAKE_PSTR_LIST(own_prog, "own prog", "Eigenprog.", "Eigen prog.", "Egen prog.") +MAKE_PSTR_LIST(std_prog, "std prog", "Standardprog.", "Standaard prog.", "Standardprog.") +MAKE_PSTR_LIST(light, "light", "Leicht", "Licht", "Lätt") +MAKE_PSTR_LIST(medium, "medium", "Mittel", "Middel", "Medel") +MAKE_PSTR_LIST(heavy, "heavy", "Schwer", "Zwaar", "Tung") +MAKE_PSTR_LIST(start, "start", "Start", "Start", "Start") +MAKE_PSTR_LIST(heat, "heat", "Heizen", "Verwarmen", "Värme") +MAKE_PSTR_LIST(hold, "hold", "Halten", "Pauzeren", "Paus") +MAKE_PSTR_LIST(cool, "cool", "Kühlen", "Koelen", "Kyla") +MAKE_PSTR_LIST(end, "end", "Ende", "Einde", "Slut") +MAKE_PSTR_LIST(german, "german", "Deutsch", "Duits", "Tyska") +MAKE_PSTR_LIST(dutch, "dutch", "Niederländisch", "Nederlands", "Nederländska") +MAKE_PSTR_LIST(french, "french", "Französisch", "Frans", "Franska") +MAKE_PSTR_LIST(italian, "italian", "Italienisch", "Italiaans", "Italienska") +MAKE_PSTR_LIST(high, "high", "hoch", "hoog", "Hög") +MAKE_PSTR_LIST(low, "low", "niedrig", "laag", "Låg") +MAKE_PSTR_LIST(radiator, "radiator", "Heizkörper", "Radiator", "Radiator") +MAKE_PSTR_LIST(convector, "convector", "Konvektor", "Convector", "Konvektor") +MAKE_PSTR_LIST(floor, "floor", "Fussboden", "Vloer", "Golv") +MAKE_PSTR_LIST(summer, "summer", "Sommer", "Zomer", "Sommar") +MAKE_PSTR_LIST(winter, "winter", "Winter", "Winter", "Vinter") +MAKE_PSTR_LIST(outdoor, "outdoor", "Außen", "Buiten", "Utomhus") +MAKE_PSTR_LIST(room, "room", "Raum", "Kamer", "Rum") +MAKE_PSTR_LIST(room_outdoor, "room outdoor", "Raum+Außen", "Kamer+Buiten", "Rum+Ute") +MAKE_PSTR_LIST(power, "power", "Leistung", "Vermogen", "Effekt") +MAKE_PSTR_LIST(constant, "constant", "konstant", "constant", "Konstant") +MAKE_PSTR_LIST(simple, "simple", "einfach", "simpel", "enkel") +MAKE_PSTR_LIST(optimized, "optimized", "optimiert", "geoptimaliseerd", "optimerad") +MAKE_PSTR_LIST(nofrost, "nofrost", "Frostschutz", "Vorstbescherming", "Frostskydd") +MAKE_PSTR_LIST(comfort, "comfort", "Komfort", "Comfort", "Komfort") +MAKE_PSTR_LIST(night, "night", "Nacht", "Nacht", "Natt") +MAKE_PSTR_LIST(day, "day", "Tag", "Dag", "Dag") +MAKE_PSTR_LIST(holiday, "holiday", "Urlaub", "Vakantie", "Helgdag") +MAKE_PSTR_LIST(reduce, "reduce", "reduziert", "gereduceerd", "Reducera") +MAKE_PSTR_LIST(noreduce, "no reduce", "unreduziert", "niet gerduceerd", "oreducerad") +MAKE_PSTR_LIST(offset, "offset", "Anhebung", "offset", "Förskutning") +MAKE_PSTR_LIST(design, "design", "Auslegung", "Ontwero", "Design") +MAKE_PSTR_LIST(minflow, "min flow", "min. Durchfluss", "Min. Doorstroom", "Min flöde") +MAKE_PSTR_LIST(maxflow, "max flow", "max. Durchfluss", "Max. Doorstroom", "Max flöde") +MAKE_PSTR_LIST(fast, "fast", "schnell", "snel", "snabb") +MAKE_PSTR_LIST(slow, "slow", "langsam", "langzaam", "långsam") +MAKE_PSTR_LIST(internal_temperature, "internal temperature", "Interne Temperatur", "Interne Temperatuur", "Interntemperatur") +MAKE_PSTR_LIST(internal_setpoint, "internal setpoint", "Interner Sollwert", "Interne Streeftemperatuur", "Internt börvärde") +MAKE_PSTR_LIST(external_temperature, "external temperature", "Externe Temperatur", "Externe Temperatuur", "Extern temperatur") +MAKE_PSTR_LIST(burner_temperature, "burner temperature", "Brennertemperatur", "Brander Temperuur", "Brännartemperatur") +MAKE_PSTR_LIST(ww_temperature, "ww temperature", "Wassertemperatur", "Watertemperatuur", "Vattentemperatur") +MAKE_PSTR_LIST(smoke_temperature, "smoke temperature", "Abgastemperatur", "Buitentemperatuur", "Rökgastemperatur") +MAKE_PSTR_LIST(weather_compensated, "weather compensated", "Wetter kompensiert", "Weer gecompenseerd", "Väderkompenserad") +MAKE_PSTR_LIST(outside_basepoint, "outside basepoint", "Basispunkt Außentemp.", "Buiten basispunt", "Utomhus baspunkt") +MAKE_PSTR_LIST(functioning_mode, "functioning mode", "Funktionsweise", "Functiemodus", "Driftläge") // mixer -MAKE_PSTR_LIST(stopped, F("stopped"), F("gestoppt"), F("gestopt"), F("stoppad")) -MAKE_PSTR_LIST(opening, F("opening"), F("öffnen"), F("openen"), F("öppnar")) -MAKE_PSTR_LIST(closing, F("closing"), F("schließen"), F("sluiten"), F("stänger")) -MAKE_PSTR_LIST(open, F("open"), F("offen"), F("Open"), F("Öppen")) -MAKE_PSTR_LIST(close, F("close"), F("geschlossen"), F("Gesloten"), F("Stängd")) +MAKE_PSTR_LIST(stopped, "stopped", "gestoppt", "gestopt", "stoppad") +MAKE_PSTR_LIST(opening, "opening", "öffnen", "openen", "öppnar") +MAKE_PSTR_LIST(closing, "closing", "schließen", "sluiten", "stänger") +MAKE_PSTR_LIST(open, "open", "offen", "Open", "Öppen") +MAKE_PSTR_LIST(close, "close", "geschlossen", "Gesloten", "Stängd") // solar ww -MAKE_PSTR_LIST(cyl1, F("cyl 1"), F("Zyl_1"), F("Cil 1"), F("Cyl 1")) -MAKE_PSTR_LIST(cyl2, F("cyl 2"), F("Zyl_2"), F("Cil 2"), F("Cyl 2")) +MAKE_PSTR_LIST(cyl1, "cyl 1", "Zyl_1", "Cil 1", "Cyl 1") +MAKE_PSTR_LIST(cyl2, "cyl 2", "Zyl_2", "Cil 2", "Cyl 2") // Entity translations // Boiler -MAKE_PSTR_LIST(wwtapactivated, F("wwtapactivated"), F("turn on/off"), F("Durchlauferhitzer aktiv"), F("zet aan/uit"), F("sätt på/av")) -MAKE_PSTR_LIST(reset, F("reset"), F("Reset"), F("Reset"), F("Nollställ"), F("reset")) -MAKE_PSTR_LIST(oilPreHeat, F("oilpreheat"), F("oil preheating"), F("Ölvorwärmung"), F("Olie voorverwarming"), F("Förvärmning olja")) -MAKE_PSTR_LIST(heatingActive, F("heatingactive"), F("heating active"), F("Heizen aktiv"), F("Verwarming actief"), F("Uppvärmning aktiv")) -MAKE_PSTR_LIST(tapwaterActive, F("tapwateractive"), F("tapwater active"), F("Warmwasser aktiv"), F("Warm water actief"), F("Varmvatten aktiv")) -MAKE_PSTR_LIST(selFlowTemp, - F("selflowtemp"), - F("selected flow temperature"), - F("Sollwert Vorlauftemperatur"), - F("Ingestelde aanvoertemperatuur"), - F("Börvärde Flödestemperatur")) -MAKE_PSTR_LIST(selBurnPow, - F("selburnpow"), - F("burner selected max power"), - F("Sollwert Brennerleistung"), - F("Ingestelde maximale brandervermogen"), - F("Brännare vald maxeffekt")) -MAKE_PSTR_LIST(heatingPumpMod, - F("heatingpumpmod"), - F("heating pump modulation"), - F("Heizungspumpe 1 Modulation"), - F("Modulatie verwarmingspomp"), - F("Modulering Värmepump")) -MAKE_PSTR_LIST(heatingPump2Mod, - F("heatingpump2mod"), - F("heating pump 2 modulation"), - F("Heizungspumpe 2 Modulation"), - F("Modulatie verwarmingspomp 2"), - F("Modulering Värmepump 2")) -MAKE_PSTR_LIST(outdoorTemp, F("outdoortemp"), F("outside temperature"), F("Aussentemperatur"), F("Buitentemperatuur"), F("Utomhustemperatur")) -MAKE_PSTR_LIST(curFlowTemp, - F("curflowtemp"), - F("current flow temperature"), - F("aktuelle Vorlauftemperatur"), - F("Huidige aanvoertemperatuur"), - F("Aktuell flödestemperatur")) -MAKE_PSTR_LIST(retTemp, F("rettemp"), F("return temperature"), F("Rücklauftemperatur"), F("Retourtemperatuur"), F("Returtemperatur")) -MAKE_PSTR_LIST(switchTemp, F("switchtemp"), F("mixing switch temperature"), F("Mischer Schalttemperatur"), F("Mixer temperatuur"), F("Blandartemperatur")) -MAKE_PSTR_LIST(sysPress, F("syspress"), F("system pressure"), F("Systemdruck"), F("Systeemdruk"), F("systemtryck")) -MAKE_PSTR_LIST(boilTemp, F("boiltemp"), F("actual boiler temperature"), F("Kesseltemperatur"), F("Keteltemperatuur"), F("Temperatur Värmepanna")) -MAKE_PSTR_LIST(exhaustTemp, F("exhausttemp"), F("exhaust temperature"), F("Abgastemperatur"), F("Uitlaattemperatuur"), F("Avgastemperatur")) -MAKE_PSTR_LIST(burnGas, F("burngas"), F("gas"), F("Gas"), F("Gas"), F("Gas")) -MAKE_PSTR_LIST(burnGas2, F("burngas2"), F("gas stage 2"), F("Gas Stufe 2"), F("gas fase 2"), F("Gas Fas 2")) -MAKE_PSTR_LIST(flameCurr, F("flamecurr"), F("flame current"), F("Flammenstrom"), F("Vlammenstroom"), F("Lågström")) -MAKE_PSTR_LIST(heatingPump, F("heatingpump"), F("heating pump"), F("Heizungspumpe"), F("Verwarmingspomp"), F("Värmepump")) -MAKE_PSTR_LIST(fanWork, F("fanwork"), F("fan"), F("Gebläse"), F("Ventilator"), F("Fläkt")) -MAKE_PSTR_LIST(ignWork, F("ignwork"), F("ignition"), F("Zündung"), F("Ontsteking"), F("Tändning")) -MAKE_PSTR_LIST(heatingActivated, F("heatingactivated"), F("heating activated"), F("Heizen aktiviert"), F("Verwarmen geactiveerd"), F("Uppvärmning aktiv")) -MAKE_PSTR_LIST(heatingTemp, F("heatingtemp"), F("heating temperature"), F("Heizungstemperatur"), F("Verwarmingstemperatuur"), F("Uppvärmningstemperatur")) -MAKE_PSTR_LIST(pumpModMax, F("pumpmodmax"), F("boiler pump max power"), F("Kesselpumpen Maximalleistung"), F("Ketelpomp max vermogen"), F("Värmepannepump max effekt")) -MAKE_PSTR_LIST(pumpModMin, F("pumpmodmin"), F("boiler pump min power"), F("Kesselpumpen Minmalleistung"), F("Ketelpomp min vermogen"), F("Värmepannepump min effekt")) -MAKE_PSTR_LIST(pumpDelay, F("pumpdelay"), F("pump delay"), F("Pumpennachlaufzeit"), F("Pomp nalooptijd"), F("Pumpfördröjning")) -MAKE_PSTR_LIST(burnMinPeriod, F("burnminperiod"), F("burner min period"), F("Antipendelzeit"), F("Antipendeltijd"), F("Värmepanna Min Period")) -MAKE_PSTR_LIST(burnMinPower, F("burnminpower"), F("burner min power"), F("minimale Brennerleistung"), F("Minimaal brandervermogen"), F("Värmepanna Min Effekt")) -MAKE_PSTR_LIST(burnMaxPower, F("burnmaxpower"), F("burner max power"), F("maximale Brennerleistung"), F("Maximaal brandervermogen"), F("Värmepanna Max Effekt")) -MAKE_PSTR_LIST(boilHystOn, - F("boilhyston"), - F("hysteresis on temperature"), - F("Einschaltdifferenz"), - F("ketel aan hysterese verschil"), - F("Hysteres aktiveringstemperatur")) -MAKE_PSTR_LIST(boilHystOff, - F("boilhystoff"), - F("hysteresis off temperature"), - F("Ausschaltdifferenz"), - F("ketel uit hysterese verschil"), - F("Hysteres inaktiveringstemperatur")) -MAKE_PSTR_LIST(setFlowTemp, - F("setflowtemp"), - F("set flow temperature"), - F("Sollwert Vorlauftemperatur"), - F("Ingestelde aanvoertemperatuur"), - F("Börvärde Flödestemperatur")) -MAKE_PSTR_LIST(setBurnPow, F("setburnpow"), F("burner set power"), F("Sollwert Brennerleistung"), F("Ingesteld brandervermogen"), F("Värmepanna vald Effekt")) -MAKE_PSTR_LIST(curBurnPow, F("curburnpow"), F("burner current power"), F("Brennerleistung"), F("Brandervermogen"), F("Värmepanna aktuell effekt")) -MAKE_PSTR_LIST(burnStarts, F("burnstarts"), F("burner starts"), F("Brenner Starts"), F("Aantal brander starts"), F("Värmepanna antal starter")) -MAKE_PSTR_LIST(burnWorkMin, F("burnworkmin"), F("total burner operating time"), F("Brenner Laufzeit"), F("Totale branderlooptijd"), F("Värmepanna aktiva timmar")) +MAKE_PSTR_LIST(wwtapactivated, "wwtapactivated", "turn on/off", "Durchlauferhitzer aktiv", "zet aan/uit", "sätt på/av") +MAKE_PSTR_LIST(reset, "reset", "Reset", "Reset", "Nollställ", "reset") +MAKE_PSTR_LIST(oilPreHeat, "oilpreheat", "oil preheating", "Ölvorwärmung", "Olie voorverwarming", "Förvärmning olja") +MAKE_PSTR_LIST(heatingActive, "heatingactive", "heating active", "Heizen aktiv", "Verwarming actief", "Uppvärmning aktiv") +MAKE_PSTR_LIST(tapwaterActive, "tapwateractive", "tapwater active", "Warmwasser aktiv", "Warm water actief", "Varmvatten aktiv") +MAKE_PSTR_LIST(selFlowTemp, "selflowtemp", "selected flow temperature", "Sollwert Vorlauftemperatur", "Ingestelde aanvoertemperatuur", "Börvärde Flödestemperatur") +MAKE_PSTR_LIST(selBurnPow, "selburnpow", "burner selected max power", "Sollwert Brennerleistung", "Ingestelde maximale brandervermogen", "Brännare vald maxeffekt") +MAKE_PSTR_LIST(heatingPumpMod, "heatingpumpmod", "heating pump modulation", "Heizungspumpe 1 Modulation", "Modulatie verwarmingspomp", "Modulering Värmepump") +MAKE_PSTR_LIST(heatingPump2Mod, "heatingpump2mod", "heating pump 2 modulation", "Heizungspumpe 2 Modulation", "Modulatie verwarmingspomp 2", "Modulering Värmepump 2") +MAKE_PSTR_LIST(outdoorTemp, "outdoortemp", "outside temperature", "Aussentemperatur", "Buitentemperatuur", "Utomhustemperatur") +MAKE_PSTR_LIST(curFlowTemp, "curflowtemp", "current flow temperature", "aktuelle Vorlauftemperatur", "Huidige aanvoertemperatuur", "Aktuell flödestemperatur") +MAKE_PSTR_LIST(retTemp, "rettemp", "return temperature", "Rücklauftemperatur", "Retourtemperatuur", "Returtemperatur") +MAKE_PSTR_LIST(switchTemp, "switchtemp", "mixing switch temperature", "Mischer Schalttemperatur", "Mixer temperatuur", "Blandartemperatur") +MAKE_PSTR_LIST(sysPress, "syspress", "system pressure", "Systemdruck", "Systeemdruk", "systemtryck") +MAKE_PSTR_LIST(boilTemp, "boiltemp", "actual boiler temperature", "Kesseltemperatur", "Keteltemperatuur", "Temperatur Värmepanna") +MAKE_PSTR_LIST(exhaustTemp, "exhausttemp", "exhaust temperature", "Abgastemperatur", "Uitlaattemperatuur", "Avgastemperatur") +MAKE_PSTR_LIST(burnGas, "burngas", "gas", "Gas", "Gas", "Gas") +MAKE_PSTR_LIST(burnGas2, "burngas2", "gas stage 2", "Gas Stufe 2", "gas fase 2", "Gas Fas 2") +MAKE_PSTR_LIST(flameCurr, "flamecurr", "flame current", "Flammenstrom", "Vlammenstroom", "Lågström") +MAKE_PSTR_LIST(heatingPump, "heatingpump", "heating pump", "Heizungspumpe", "Verwarmingspomp", "Värmepump") +MAKE_PSTR_LIST(fanWork, "fanwork", "fan", "Gebläse", "Ventilator", "Fläkt") +MAKE_PSTR_LIST(ignWork, "ignwork", "ignition", "Zündung", "Ontsteking", "Tändning") +MAKE_PSTR_LIST(heatingActivated, "heatingactivated", "heating activated", "Heizen aktiviert", "Verwarmen geactiveerd", "Uppvärmning aktiv") +MAKE_PSTR_LIST(heatingTemp, "heatingtemp", "heating temperature", "Heizungstemperatur", "Verwarmingstemperatuur", "Uppvärmningstemperatur") +MAKE_PSTR_LIST(pumpModMax, "pumpmodmax", "boiler pump max power", "Kesselpumpen Maximalleistung", "Ketelpomp max vermogen", "Värmepannepump max effekt") +MAKE_PSTR_LIST(pumpModMin, "pumpmodmin", "boiler pump min power", "Kesselpumpen Minmalleistung", "Ketelpomp min vermogen", "Värmepannepump min effekt") +MAKE_PSTR_LIST(pumpDelay, "pumpdelay", "pump delay", "Pumpennachlaufzeit", "Pomp nalooptijd", "Pumpfördröjning") +MAKE_PSTR_LIST(burnMinPeriod, "burnminperiod", "burner min period", "Antipendelzeit", "Antipendeltijd", "Värmepanna Min Period") +MAKE_PSTR_LIST(burnMinPower, "burnminpower", "burner min power", "minimale Brennerleistung", "Minimaal brandervermogen", "Värmepanna Min Effekt") +MAKE_PSTR_LIST(burnMaxPower, "burnmaxpower", "burner max power", "maximale Brennerleistung", "Maximaal brandervermogen", "Värmepanna Max Effekt") +MAKE_PSTR_LIST(boilHystOn, "boilhyston", "hysteresis on temperature", "Einschaltdifferenz", "ketel aan hysterese verschil", "Hysteres aktiveringstemperatur") +MAKE_PSTR_LIST(boilHystOff, "boilhystoff", "hysteresis off temperature", "Ausschaltdifferenz", "ketel uit hysterese verschil", "Hysteres inaktiveringstemperatur") +MAKE_PSTR_LIST(setFlowTemp, "setflowtemp", "set flow temperature", "Sollwert Vorlauftemperatur", "Ingestelde aanvoertemperatuur", "Börvärde Flödestemperatur") +MAKE_PSTR_LIST(setBurnPow, "setburnpow", "burner set power", "Sollwert Brennerleistung", "Ingesteld brandervermogen", "Värmepanna vald Effekt") +MAKE_PSTR_LIST(curBurnPow, "curburnpow", "burner current power", "Brennerleistung", "Brandervermogen", "Värmepanna aktuell effekt") +MAKE_PSTR_LIST(burnStarts, "burnstarts", "burner starts", "Brenner Starts", "Aantal brander starts", "Värmepanna antal starter") +MAKE_PSTR_LIST(burnWorkMin, "burnworkmin", "total burner operating time", "Brenner Laufzeit", "Totale branderlooptijd", "Värmepanna aktiva timmar") MAKE_PSTR_LIST(burn2WorkMin, - F("burn2workmin"), - F("burner stage 2 operating time"), - F("Brenner Stufe 2 Laufzeit"), - F("Totale looptijd brander fase 2"), - F("Värmepanna steg 2 aktiva timmar")) -MAKE_PSTR_LIST(heatWorkMin, F("heatworkmin"), F("total heat operating time"), F("Heizung Laufzeit"), F("Totale looptijd verwarming"), F("Uppvärmning aktiva timmar")) -MAKE_PSTR_LIST(UBAuptime, F("ubauptime"), F("total UBA operating time"), F("Anlagen-Gesamtlaufzeit"), F("totale looptijd branderautomaat (UBA)"), F("Total Tid")) -MAKE_PSTR_LIST(lastCode, F("lastcode"), F("last error code"), F("Fehlerspeicher"), F("Laatste foutcode"), F("Senaste Felkod")) -MAKE_PSTR_LIST(serviceCode, F("servicecode"), F("service code"), F("Statusmeldung"), F("Statuscode"), F("Servicekod")) -MAKE_PSTR_LIST(serviceCodeNumber, F("servicecodenumber"), F("service code number"), F("Statusmeldungsnummer"), F("Status codenummer"), F("Servicekodsnummer")) -MAKE_PSTR_LIST(maintenanceMessage, F("maintenancemessage"), F("maintenance message"), F("Wartungsmeldung"), F("Onderhoudsmelding"), F("Servicemeddelande")) -MAKE_PSTR_LIST(maintenanceDate, F("maintenancedate"), F("next maintenance date"), F("Wartungsdatum"), F("Onderhoudsdatum"), F("Datum nästa Service")) -MAKE_PSTR_LIST(maintenanceType, F("maintenance"), F("maintenance scheduled"), F("Wartungsplan"), F("Onderhoud gepland"), F("Underhåll schemlagt")) -MAKE_PSTR_LIST(maintenanceTime, F("maintenancetime"), F("time to next maintenance"), F("Wartung in"), F("Onderhoud in"), F("Tid till nästa underhåll")) -MAKE_PSTR_LIST(emergencyOps, F("emergencyops"), F("emergency operation"), F("Notoperation"), F("Noodoperatie"), F("Nöddrift")) -MAKE_PSTR_LIST(emergencyTemp, F("emergencytemp"), F("emergency temperature"), F("Nottemperatur"), F("Noodtemperatuur"), F("Nödtemperatur")) + "burn2workmin", + "burner stage 2 operating time", + "Brenner Stufe 2 Laufzeit", + "Totale looptijd brander fase 2", + "Värmepanna steg 2 aktiva timmar") +MAKE_PSTR_LIST(heatWorkMin, "heatworkmin", "total heat operating time", "Heizung Laufzeit", "Totale looptijd verwarming", "Uppvärmning aktiva timmar") +MAKE_PSTR_LIST(UBAuptime, "ubauptime", "total UBA operating time", "Anlagen-Gesamtlaufzeit", "totale looptijd branderautomaat (UBA)", "Total Tid") +MAKE_PSTR_LIST(lastCode, "lastcode", "last error code", "Fehlerspeicher", "Laatste foutcode", "Senaste Felkod") +MAKE_PSTR_LIST(serviceCode, "servicecode", "service code", "Statusmeldung", "Statuscode", "Servicekod") +MAKE_PSTR_LIST(serviceCodeNumber, "servicecodenumber", "service code number", "Statusmeldungsnummer", "Status codenummer", "Servicekodsnummer") +MAKE_PSTR_LIST(maintenanceMessage, "maintenancemessage", "maintenance message", "Wartungsmeldung", "Onderhoudsmelding", "Servicemeddelande") +MAKE_PSTR_LIST(maintenanceDate, "maintenancedate", "next maintenance date", "Wartungsdatum", "Onderhoudsdatum", "Datum nästa Service") +MAKE_PSTR_LIST(maintenanceType, "maintenance", "maintenance scheduled", "Wartungsplan", "Onderhoud gepland", "Underhåll schemlagt") +MAKE_PSTR_LIST(maintenanceTime, "maintenancetime", "time to next maintenance", "Wartung in", "Onderhoud in", "Tid till nästa underhåll") +MAKE_PSTR_LIST(emergencyOps, "emergencyops", "emergency operation", "Notoperation", "Noodoperatie", "Nöddrift") +MAKE_PSTR_LIST(emergencyTemp, "emergencytemp", "emergency temperature", "Nottemperatur", "Noodtemperatuur", "Nödtemperatur") // heatpump/compress specific -MAKE_PSTR_LIST(upTimeControl, F("uptimecontrol"), F("total operating time heat"), F("Betriebszeit Heizen gesamt"), F("Totale bedrijfstijd"), F("Total tid uppvärmning")) +MAKE_PSTR_LIST(upTimeControl, "uptimecontrol", "total operating time heat", "Betriebszeit Heizen gesamt", "Totale bedrijfstijd", "Total tid uppvärmning") MAKE_PSTR_LIST(upTimeCompHeating, - F("uptimecompheating"), - F("operating time compressor heating"), - F("Betriebszeit Kompressor heizen"), - F("Bedrijfstijd compressor verwarmingsbedrijf"), - F("Total tid kompressor uppvärmning")) + "uptimecompheating", + "operating time compressor heating", + "Betriebszeit Kompressor heizen", + "Bedrijfstijd compressor verwarmingsbedrijf", + "Total tid kompressor uppvärmning") MAKE_PSTR_LIST(upTimeCompCooling, - F("uptimecompcooling"), - F("operating time compressor cooling"), - F("Betriebszeit Kompressor kühlen"), - F("Bedrijfstijd compressor koelbedrijf"), - F("Total tid kompressor kyla")) + "uptimecompcooling", + "operating time compressor cooling", + "Betriebszeit Kompressor kühlen", + "Bedrijfstijd compressor koelbedrijf", + "Total tid kompressor kyla") MAKE_PSTR_LIST(upTimeCompWw, - F("uptimecompww"), - F("operating time compressor dhw"), - F("Betriebszeit Kompressor"), - F("Bedrijfstijd compressor warmwaterbedrijf"), - F("Total tid kompressor varmvatten")) + "uptimecompww", + "operating time compressor dhw", + "Betriebszeit Kompressor", + "Bedrijfstijd compressor warmwaterbedrijf", + "Total tid kompressor varmvatten") MAKE_PSTR_LIST(upTimeCompPool, - F("uptimecomppool"), - F("operating time compressor pool"), - F("Betriebszeit Kompressor Pool"), - F("Bedrijfstijd compressor voor zwembadbedrijf"), - F("Total tid kompressor pool")) -MAKE_PSTR_LIST(totalCompStarts, - F("totalcompstarts"), - F("total compressor control starts"), - F("Kompressor Starts gesamt"), - F("Totaal compressorstarts"), - F("Kompressorstarter Totalt")) -MAKE_PSTR_LIST(heatingStarts, F("heatingstarts"), F("heating control starts"), F("Heizen Starts"), F("Starts verwarmingsbedrijf"), F("Kompressorstarter Uppvärmning")) -MAKE_PSTR_LIST(coolingStarts, F("coolingstarts"), F("cooling control starts"), F("Kühlen Starts"), F("Starts koelbedrijf"), F("Kompressorstarter Kyla")) -MAKE_PSTR_LIST(poolStarts, F("poolstarts"), F("pool control starts"), F("Pool Starts"), F("Starts zwembadbedrijf"), F("Kompressorstarter Pool")) -MAKE_PSTR_LIST(nrgConsTotal, F("nrgconstotal"), F("total energy consumption"), F("totaler Energieverbrauch"), F("Energieverbrauch gesamt"), F("Energieverbruik totaal")) + "uptimecomppool", + "operating time compressor pool", + "Betriebszeit Kompressor Pool", + "Bedrijfstijd compressor voor zwembadbedrijf", + "Total tid kompressor pool") +MAKE_PSTR_LIST(totalCompStarts, "totalcompstarts", "total compressor control starts", "Kompressor Starts gesamt", "Totaal compressorstarts", "Kompressorstarter Totalt") +MAKE_PSTR_LIST(heatingStarts, "heatingstarts", "heating control starts", "Heizen Starts", "Starts verwarmingsbedrijf", "Kompressorstarter Uppvärmning") +MAKE_PSTR_LIST(coolingStarts, "coolingstarts", "cooling control starts", "Kühlen Starts", "Starts koelbedrijf", "Kompressorstarter Kyla") +MAKE_PSTR_LIST(poolStarts, "poolstarts", "pool control starts", "Pool Starts", "Starts zwembadbedrijf", "Kompressorstarter Pool") +MAKE_PSTR_LIST(nrgConsTotal, "nrgconstotal", "total energy consumption", "totaler Energieverbrauch", "Energieverbrauch gesamt", "Energieverbruik totaal") MAKE_PSTR_LIST(nrgConsCompTotal, - F("nrgconscomptotal"), - F("total energy consumption compressor"), - F("Energieverbrauch Kompressor gesamt"), - F("Energieverbruik compressor totaal"), - F("Energiförbrukning kompressor")) + "nrgconscomptotal", + "total energy consumption compressor", + "Energieverbrauch Kompressor gesamt", + "Energieverbruik compressor totaal", + "Energiförbrukning kompressor") MAKE_PSTR_LIST(nrgConsCompHeating, - F("nrgconscompheating"), - F("energy consumption compressor heating"), - F("Energieverbrauch Kompressor heizen"), - F("Energieverbruik compressor verwarmingsbedrijf"), - F("Energiförbrukning uppvärmning")) + "nrgconscompheating", + "energy consumption compressor heating", + "Energieverbrauch Kompressor heizen", + "Energieverbruik compressor verwarmingsbedrijf", + "Energiförbrukning uppvärmning") MAKE_PSTR_LIST(nrgConsCompWw, - F("nrgconscompww"), - F("energy consumption compressor dhw"), - F("Energieverbrauch Kompressor"), - F("Energieverbruik compressor warmwaterbedrijf"), - F("Energiförbrukning varmvatten")) + "nrgconscompww", + "energy consumption compressor dhw", + "Energieverbrauch Kompressor", + "Energieverbruik compressor warmwaterbedrijf", + "Energiförbrukning varmvatten") MAKE_PSTR_LIST(nrgConsCompCooling, - F("nrgconscompcooling"), - F("energy consumption compressor cooling"), - F("Energieverbrauch Kompressor kühlen"), - F("Energieverbruik compressor koelbedrijf"), - F("Energiförbrukning kyla")) + "nrgconscompcooling", + "energy consumption compressor cooling", + "Energieverbrauch Kompressor kühlen", + "Energieverbruik compressor koelbedrijf", + "Energiförbrukning kyla") MAKE_PSTR_LIST(nrgConsCompPool, - F("nrgconscomppool"), - F("energy consumption compressor pool"), - F("Energieverbrauch Kompressor Pool"), - F("Energiebedrijf compressor zwembadbedrijf"), - F("Energiförbrukning pool")) -MAKE_PSTR_LIST(nrgSuppTotal, F("nrgsupptotal"), F("total energy supplied"), F("gesamte Energieabgabe"), F("Totaal opgewekte energie"), F("Tillförd energi")) + "nrgconscomppool", + "energy consumption compressor pool", + "Energieverbrauch Kompressor Pool", + "Energiebedrijf compressor zwembadbedrijf", + "Energiförbrukning pool") +MAKE_PSTR_LIST(nrgSuppTotal, "nrgsupptotal", "total energy supplied", "gesamte Energieabgabe", "Totaal opgewekte energie", "Tillförd energi") MAKE_PSTR_LIST(nrgSuppHeating, - F("nrgsuppheating"), - F("total energy supplied heating"), - F("gesamte Energieabgabe heizen"), - F("Opgewekte energie verwarmingsbedrijf"), - F("Tillförd energi Uppvärmning")) -MAKE_PSTR_LIST(nrgSuppWw, - F("nrgsuppww"), - F("total energy warm supplied dhw"), - F("gesamte Energieabgabe"), - F("Opgewekte energie warmwaterbedrijf"), - F("Tillförd energi Varmvatten")) -MAKE_PSTR_LIST(nrgSuppCooling, - F("nrgsuppcooling"), - F("total energy supplied cooling"), - F("gesamte Energieabgabe kühlen"), - F("Opgewekte energie koelbedrijf"), - F("Tillförd energi Kyla")) -MAKE_PSTR_LIST(nrgSuppPool, - F("nrgsupppool"), - F("total energy supplied pool"), - F("gesamte Energieabgabe Pool"), - F("Opgewekte energie zwembadbedrijf"), - F("TIllförd energi Pool")) + "nrgsuppheating", + "total energy supplied heating", + "gesamte Energieabgabe heizen", + "Opgewekte energie verwarmingsbedrijf", + "Tillförd energi Uppvärmning") +MAKE_PSTR_LIST(nrgSuppWw, "nrgsuppww", "total energy warm supplied dhw", "gesamte Energieabgabe", "Opgewekte energie warmwaterbedrijf", "Tillförd energi Varmvatten") +MAKE_PSTR_LIST(nrgSuppCooling, "nrgsuppcooling", "total energy supplied cooling", "gesamte Energieabgabe kühlen", "Opgewekte energie koelbedrijf", "Tillförd energi Kyla") +MAKE_PSTR_LIST(nrgSuppPool, "nrgsupppool", "total energy supplied pool", "gesamte Energieabgabe Pool", "Opgewekte energie zwembadbedrijf", "TIllförd energi Pool") MAKE_PSTR_LIST(auxElecHeatNrgConsTotal, - F("auxelecheatnrgconstotal"), - F("total auxiliary electrical heater energy consumption"), - F("Energieverbrauch el. Zusatzheizung"), - F("Totaal energieverbruik electrisch verwarmingselement"), - F("Energiförbrukning Elpatron")) + "auxelecheatnrgconstotal", + "total auxiliary electrical heater energy consumption", + "Energieverbrauch el. Zusatzheizung", + "Totaal energieverbruik electrisch verwarmingselement", + "Energiförbrukning Elpatron") MAKE_PSTR_LIST(auxElecHeatNrgConsHeating, - F("auxelecheatnrgconsheating"), - F("auxiliary electrical heater energy consumption heating"), - F("Energieverbrauch el. Zusatzheizung Heizen"), - F("Energieverbruik electrisch verwarmingselement voor verwarmingsbedrijf"), - F("Energiförbrukning Elpatron Uppvärmning")) + "auxelecheatnrgconsheating", + "auxiliary electrical heater energy consumption heating", + "Energieverbrauch el. Zusatzheizung Heizen", + "Energieverbruik electrisch verwarmingselement voor verwarmingsbedrijf", + "Energiförbrukning Elpatron Uppvärmning") MAKE_PSTR_LIST(auxElecHeatNrgConsWW, - F("auxelecheatnrgconsww"), - F("auxiliary electrical heater energy consumption dhw"), - F("Energieverbrauch el. Zusatzheizung"), - F("Energieverbruik electrisch verwarmingselement voor warmwaterbedrijf"), - F("Energiförbrukning Elpatron Varmvatten")) + "auxelecheatnrgconsww", + "auxiliary electrical heater energy consumption dhw", + "Energieverbrauch el. Zusatzheizung", + "Energieverbruik electrisch verwarmingselement voor warmwaterbedrijf", + "Energiförbrukning Elpatron Varmvatten") MAKE_PSTR_LIST(auxElecHeatNrgConsPool, - F("auxelecheatnrgconspool"), - F("auxiliary electrical heater energy consumption pool"), - F("Energieverbrauch el. Zusatzheizung Pool"), - F("Energieverbruik electrisch verwarmingselement voor zwembadbedrijf"), - F("Energiförbrukning Elpatron Pool")) + "auxelecheatnrgconspool", + "auxiliary electrical heater energy consumption pool", + "Energieverbrauch el. Zusatzheizung Pool", + "Energieverbruik electrisch verwarmingselement voor zwembadbedrijf", + "Energiförbrukning Elpatron Pool") -MAKE_PSTR_LIST(hpCompOn, F("hpcompon"), F("hp compressor"), F("WP Kompressor"), F("WP compressor"), F("VP Kompressor")) -MAKE_PSTR_LIST(hpHeatingOn, F("hpheatingon"), F("hp heating"), F("WP Heizen"), F("WP verwarmingsbedrijf"), F("VP Uppvärmning")) -MAKE_PSTR_LIST(hpCoolingOn, F("hpcoolingon"), F("hp cooling"), F("WP Kühlen"), F("WP koelbedrijf"), F("VP Kyla")) -MAKE_PSTR_LIST(hpWwOn, F("hpwwon"), F("hp dhw"), F("WP Warmwasser"), F("WP warmwaterbedrijf"), F("VP Varmvatten")) -MAKE_PSTR_LIST(hpPoolOn, F("hppoolon"), F("hp pool"), F("WP Pool"), F("WP zwembadbedrijf"), F("VP Pool")) -MAKE_PSTR_LIST(hpBrinePumpSpd, F("hpbrinepumpspd"), F("brine pump speed"), F("Solepumpen-Geschw."), F("Snelheid pekelpomp"), F("Hastighet Brine-pump")) -MAKE_PSTR_LIST(hpCompSpd, F("hpcompspd"), F("compressor speed"), F("Kompressor-Geschw."), F("Snelheid compressor"), F("Kompressorhastighet")) -MAKE_PSTR_LIST(hpCircSpd, F("hpcircspd"), F("circulation pump speed"), F("Zirkulationspumpen-Geschw."), F("Snelheid circulatiepomp"), F("Hastighet Cirkulationspump")) -MAKE_PSTR_LIST(hpBrineIn, F("hpbrinein"), F("brine in/evaporator"), F("Sole in/Verdampfer"), F("pekel in/verdamper"), F("Brine in/förångare")) -MAKE_PSTR_LIST(hpBrineOut, F("hpbrineout"), F("brine out/condenser"), F("Sole aus/Kondensator"), F("pekel uit/condensor"), F("Brine ut/kondensor")) -MAKE_PSTR_LIST(hpSuctionGas, F("hpsuctiongas"), F("suction gas"), F("Gasansaugung"), F("Gasaanzuiging"), F("Gasintag")) -MAKE_PSTR_LIST(hpHotGas, F("hphotgas"), F("hot gas/compressed"), F("Heißgas/verdichtet"), F("heet gas/samengeperst"), F("Hetgas/komprimerad")) -MAKE_PSTR_LIST(hpSwitchValve, F("hpswitchvalve"), F("switch valve"), F("Schaltventil"), F("schakelklep"), F("Växelventil")) -MAKE_PSTR_LIST(hpActivity, F("hpactivity"), F("compressor activity"), F("Kompressoraktivität"), F("Compressoractiviteit"), F("Kompressoraktivitet")) +MAKE_PSTR_LIST(hpCompOn, "hpcompon", "hp compressor", "WP Kompressor", "WP compressor", "VP Kompressor") +MAKE_PSTR_LIST(hpHeatingOn, "hpheatingon", "hp heating", "WP Heizen", "WP verwarmingsbedrijf", "VP Uppvärmning") +MAKE_PSTR_LIST(hpCoolingOn, "hpcoolingon", "hp cooling", "WP Kühlen", "WP koelbedrijf", "VP Kyla") +MAKE_PSTR_LIST(hpWwOn, "hpwwon", "hp dhw", "WP Warmwasser", "WP warmwaterbedrijf", "VP Varmvatten") +MAKE_PSTR_LIST(hpPoolOn, "hppoolon", "hp pool", "WP Pool", "WP zwembadbedrijf", "VP Pool") +MAKE_PSTR_LIST(hpBrinePumpSpd, "hpbrinepumpspd", "brine pump speed", "Solepumpen-Geschw.", "Snelheid pekelpomp", "Hastighet Brine-pump") +MAKE_PSTR_LIST(hpCompSpd, "hpcompspd", "compressor speed", "Kompressor-Geschw.", "Snelheid compressor", "Kompressorhastighet") +MAKE_PSTR_LIST(hpCircSpd, "hpcircspd", "circulation pump speed", "Zirkulationspumpen-Geschw.", "Snelheid circulatiepomp", "Hastighet Cirkulationspump") +MAKE_PSTR_LIST(hpBrineIn, "hpbrinein", "brine in/evaporator", "Sole in/Verdampfer", "pekel in/verdamper", "Brine in/förångare") +MAKE_PSTR_LIST(hpBrineOut, "hpbrineout", "brine out/condenser", "Sole aus/Kondensator", "pekel uit/condensor", "Brine ut/kondensor") +MAKE_PSTR_LIST(hpSuctionGas, "hpsuctiongas", "suction gas", "Gasansaugung", "Gasaanzuiging", "Gasintag") +MAKE_PSTR_LIST(hpHotGas, "hphotgas", "hot gas/compressed", "Heißgas/verdichtet", "heet gas/samengeperst", "Hetgas/komprimerad") +MAKE_PSTR_LIST(hpSwitchValve, "hpswitchvalve", "switch valve", "Schaltventil", "schakelklep", "Växelventil") +MAKE_PSTR_LIST(hpActivity, "hpactivity", "compressor activity", "Kompressoraktivität", "Compressoractiviteit", "Kompressoraktivitet") -MAKE_PSTR_LIST(hpPower, F("hppower"), F("compressor power output"), F("Kompressorleistung"), F("Compressorvermogen"), F("Kompressoreffekt")) -MAKE_PSTR_LIST(hpTc0, F("hptc0"), F("heat carrier return (TC0)"), F("Kältemittel Rücklauf (TC0)"), F("Koudemiddel retour (TC0O"), F("Värmebärare Retur (TC0)")) -MAKE_PSTR_LIST(hpTc1, F("hptc1"), F("heat carrier forward (TC1)"), F("Kältemittel Vorlauf (TC1)"), F("Koudemiddel aanvoer (TC1)"), F("Värmebärare Framledning (TC1)")) -MAKE_PSTR_LIST(hpTc3, F("hptc3"), F("condenser temperature (TC3)"), F("Verflüssigertemperatur (TC3)"), F("Condensortemperatuur (TC3)"), F("Kondensortemperatur (TC3)")) +MAKE_PSTR_LIST(hpPower, "hppower", "compressor power output", "Kompressorleistung", "Compressorvermogen", "Kompressoreffekt") +MAKE_PSTR_LIST(hpTc0, "hptc0", "heat carrier return (TC0)", "Kältemittel Rücklauf (TC0)", "Koudemiddel retour (TC0O", "Värmebärare Retur (TC0)") +MAKE_PSTR_LIST(hpTc1, "hptc1", "heat carrier forward (TC1)", "Kältemittel Vorlauf (TC1)", "Koudemiddel aanvoer (TC1)", "Värmebärare Framledning (TC1)") +MAKE_PSTR_LIST(hpTc3, "hptc3", "condenser temperature (TC3)", "Verflüssigertemperatur (TC3)", "Condensortemperatuur (TC3)", "Kondensortemperatur (TC3)") MAKE_PSTR_LIST(hpTr3, - F("hptr3"), - F("refrigerant temperature liquid side (condenser output) (TR3)"), - F("Kältemittel (flüssig) (TR3)"), - F("Temperatuur koudemiddel vloeibare zijde (TR3)"), - F("Köldmedium temperatur (kondensorutlopp) (TR3)")) -MAKE_PSTR_LIST(hpTr4, - F("hptr4"), - F("evaporator inlet temperature (TR4)"), - F("Verdampfer Eingang (TR4)"), - F("Verdamper ingangstemperatuur (TR4)"), - F("Förångare inloppstemp (TR4)")) -MAKE_PSTR_LIST(hpTr5, - F("hptr5"), - F("compressor inlet temperature (TR5)"), - F("Kompessoreingang (TR5)"), - F("Compressor ingangstemperatuur (TR5)"), - F("Kompressor inloppstemp (TR5)")) -MAKE_PSTR_LIST(hpTr6, - F("hptr6"), - F("compressor outlet temperature (TR6)"), - F("Kompressorausgang (TR6)"), - F("Compressor uitgangstemperatuur (TR6)"), - F("Kompressor utloppstemp (TR6)")) + "hptr3", + "refrigerant temperature liquid side (condenser output) (TR3)", + "Kältemittel (flüssig) (TR3)", + "Temperatuur koudemiddel vloeibare zijde (TR3)", + "Köldmedium temperatur (kondensorutlopp) (TR3)") +MAKE_PSTR_LIST(hpTr4, "hptr4", "evaporator inlet temperature (TR4)", "Verdampfer Eingang (TR4)", "Verdamper ingangstemperatuur (TR4)", "Förångare inloppstemp (TR4)") +MAKE_PSTR_LIST(hpTr5, "hptr5", "compressor inlet temperature (TR5)", "Kompessoreingang (TR5)", "Compressor ingangstemperatuur (TR5)", "Kompressor inloppstemp (TR5)") +MAKE_PSTR_LIST(hpTr6, "hptr6", "compressor outlet temperature (TR6)", "Kompressorausgang (TR6)", "Compressor uitgangstemperatuur (TR6)", "Kompressor utloppstemp (TR6)") MAKE_PSTR_LIST(hpTr7, - F("hptr7"), - F("refrigerant temperature gas side (condenser input) (TR7)"), - F("Kältemittel (gasförmig) (TR7)"), - F("Temperatuur koudemiddel gasvormig (TR7)"), - F("Köldmedium temperatur gassida (kondensorinlopp) (TR7)")) -MAKE_PSTR_LIST(hpTl2, - F("hptl2"), - F("air inlet temperature (TL2)"), - F("Außenluft-Einlasstemperatur (TL2)"), - F("Temperatuur luchtinlaat (TL2)"), - F("Luftintagstemperatur (TL2)")) -MAKE_PSTR_LIST(hpPl1, - F("hppl1"), - F("low pressure side temperature (PL1)"), - F("Niederdruckfühler (PL1)"), - F("Temperatuur lage drukzijde (PL1)"), - F("Temperatur Lågtryckssidan (PL1)")) -MAKE_PSTR_LIST(hpPh1, - F("hpph1"), - F("high pressure side temperature (PH1)"), - F("Hochdruckfühler (PH1)"), - F("Temperatuur hoge drukzijde (PH1)"), - F("Temperatur Högtryckssidan (PH1)")) + "hptr7", + "refrigerant temperature gas side (condenser input) (TR7)", + "Kältemittel (gasförmig) (TR7)", + "Temperatuur koudemiddel gasvormig (TR7)", + "Köldmedium temperatur gassida (kondensorinlopp) (TR7)") +MAKE_PSTR_LIST(hpTl2, "hptl2", "air inlet temperature (TL2)", "Außenluft-Einlasstemperatur (TL2)", "Temperatuur luchtinlaat (TL2)", "Luftintagstemperatur (TL2)") +MAKE_PSTR_LIST(hpPl1, "hppl1", "low pressure side temperature (PL1)", "Niederdruckfühler (PL1)", "Temperatuur lage drukzijde (PL1)", "Temperatur Lågtryckssidan (PL1)") +MAKE_PSTR_LIST(hpPh1, "hpph1", "high pressure side temperature (PH1)", "Hochdruckfühler (PH1)", "Temperatuur hoge drukzijde (PH1)", "Temperatur Högtryckssidan (PH1)") -MAKE_PSTR_LIST(hpInput1, F("hpin1"), F("input 1 state"), F("Eingang 1 Status"), F("Status input 1"), F("Status Ingång 1")) -MAKE_PSTR_LIST(hpInput2, F("hpin2"), F("input 2 state"), F("Eingang 2 Status"), F("Status input 2"), F("Status Ingång 2")) -MAKE_PSTR_LIST(hpInput3, F("hpin3"), F("input 3 state"), F("Eingang 3 Status"), F("Status input 3"), F("Status Ingång 3")) -MAKE_PSTR_LIST(hpInput4, F("hpin4"), F("input 4 state"), F("Eingang 4 Status"), F("Status input 4"), F("Status Ingång 4")) -MAKE_PSTR_LIST(hpIn1Opt, F("hpin1opt"), F("input 1 options"), F("Eingang 1 Einstellung"), F("Instelling input 1"), F("Inställningar Ingång 1")) -MAKE_PSTR_LIST(hpIn2Opt, F("hpin2opt"), F("input 2 options"), F("Eingang 2 Einstellung"), F("Instelling input 2"), F("Inställningar Ingång 2")) -MAKE_PSTR_LIST(hpIn3Opt, F("hpin3opt"), F("input 3 options"), F("Eingang 3 Einstellung"), F("Instelling input 3"), F("Inställningar Ingång 3")) -MAKE_PSTR_LIST(hpIn4Opt, F("hpin4opt"), F("input 4 options"), F("Eingang 4 Einstellung"), F("Instelling input 4"), F("Inställningar Ingång 4")) +MAKE_PSTR_LIST(hpInput1, "hpin1", "input 1 state", "Eingang 1 Status", "Status input 1", "Status Ingång 1") +MAKE_PSTR_LIST(hpInput2, "hpin2", "input 2 state", "Eingang 2 Status", "Status input 2", "Status Ingång 2") +MAKE_PSTR_LIST(hpInput3, "hpin3", "input 3 state", "Eingang 3 Status", "Status input 3", "Status Ingång 3") +MAKE_PSTR_LIST(hpInput4, "hpin4", "input 4 state", "Eingang 4 Status", "Status input 4", "Status Ingång 4") +MAKE_PSTR_LIST(hpIn1Opt, "hpin1opt", "input 1 options", "Eingang 1 Einstellung", "Instelling input 1", "Inställningar Ingång 1") +MAKE_PSTR_LIST(hpIn2Opt, "hpin2opt", "input 2 options", "Eingang 2 Einstellung", "Instelling input 2", "Inställningar Ingång 2") +MAKE_PSTR_LIST(hpIn3Opt, "hpin3opt", "input 3 options", "Eingang 3 Einstellung", "Instelling input 3", "Inställningar Ingång 3") +MAKE_PSTR_LIST(hpIn4Opt, "hpin4opt", "input 4 options", "Eingang 4 Einstellung", "Instelling input 4", "Inställningar Ingång 4") // hybrid heatpump -MAKE_PSTR_LIST(hybridStrategy, F("hybridstrategy"), F("hybrid control strategy"), F("Hybrid Strategie"), F("Hybride strategie"), F("Hybrid kontrollstrategi")) +MAKE_PSTR_LIST(hybridStrategy, "hybridstrategy", "hybrid control strategy", "Hybrid Strategie", "Hybride strategie", "Hybrid kontrollstrategi") MAKE_PSTR_LIST(switchOverTemp, - F("switchovertemp"), - F("outside switchover temperature"), - F("Außentemperatur für Umschaltung"), - F("Schakeltemperatuur buitentemperatuur"), - F("Utomhus Omställningstemperatur")) -MAKE_PSTR_LIST(energyCostRatio, F("energycostratio"), F("energy cost ratio"), F("Energie/Kosten-Verhältnis"), F("Energiekostenratio"), F("Energi/Kostnads-förhållande")) -MAKE_PSTR_LIST(fossileFactor, - F("fossilefactor"), - F("fossile energy factor"), - F("Energiefaktor Fossil"), - F("Energiefactor fossiele brandstof"), - F("Energifaktor fossilenergi")) -MAKE_PSTR_LIST(electricFactor, - F("electricfactor"), - F("electric energy factor"), - F("Energiefaktor elektrisch"), - F("Energiefactor electrisch"), - F("Elektrisk energifaktor")) -MAKE_PSTR_LIST(delayBoiler, F("delayboiler"), F("delay boiler support"), F("Verzögerungs-Option"), F("Vertragingsoptie"), F("Fördörjningsoption")) -MAKE_PSTR_LIST(tempDiffBoiler, - F("tempdiffboiler"), - F("temp diff boiler support"), - F("Temperaturdifferenz-Option"), - F("Verschiltemperatuuroptie"), - F("Temperaturskillnadsoption")) + "switchovertemp", + "outside switchover temperature", + "Außentemperatur für Umschaltung", + "Schakeltemperatuur buitentemperatuur", + "Utomhus Omställningstemperatur") +MAKE_PSTR_LIST(energyCostRatio, "energycostratio", "energy cost ratio", "Energie/Kosten-Verhältnis", "Energiekostenratio", "Energi/Kostnads-förhållande") +MAKE_PSTR_LIST(fossileFactor, "fossilefactor", "fossile energy factor", "Energiefaktor Fossil", "Energiefactor fossiele brandstof", "Energifaktor fossilenergi") +MAKE_PSTR_LIST(electricFactor, "electricfactor", "electric energy factor", "Energiefaktor elektrisch", "Energiefactor electrisch", "Elektrisk energifaktor") +MAKE_PSTR_LIST(delayBoiler, "delayboiler", "delay boiler support", "Verzögerungs-Option", "Vertragingsoptie", "Fördörjningsoption") +MAKE_PSTR_LIST(tempDiffBoiler, "tempdiffboiler", "temp diff boiler support", "Temperaturdifferenz-Option", "Verschiltemperatuuroptie", "Temperaturskillnadsoption") // alternative heatsource AM200 -MAKE_PSTR_LIST(aCylTopTemp, F("cyltoptemp"), F("cylinder top temperature"), F("Speichertemperatur Oben"), F("Buffer temperatuur boven"), F("Cylindertemperatur Toppen")) -MAKE_PSTR_LIST(aCylCenterTemp, - F("cylcentertemp"), - F("cylinder center temperature"), - F("Speichertemperatur Mitte"), - F("Buffer temperatuur midden"), - F("Cylindertemperatur Mitten")) -MAKE_PSTR_LIST(aCylBottomTemp, - F("cylbottomtemp"), - F("cylinder bottom temperature"), - F("Speichertemperatur Unten"), - F("Buffer temperatuur onder"), - F("Cylindertemperatur Botten")) +MAKE_PSTR_LIST(aCylTopTemp, "cyltoptemp", "cylinder top temperature", "Speichertemperatur Oben", "Buffer temperatuur boven", "Cylindertemperatur Toppen") +MAKE_PSTR_LIST(aCylCenterTemp, "cylcentertemp", "cylinder center temperature", "Speichertemperatur Mitte", "Buffer temperatuur midden", "Cylindertemperatur Mitten") +MAKE_PSTR_LIST(aCylBottomTemp, "cylbottomtemp", "cylinder bottom temperature", "Speichertemperatur Unten", "Buffer temperatuur onder", "Cylindertemperatur Botten") MAKE_PSTR_LIST(aFlowTemp, - F("altflowtemp"), - F("alternative hs flow temperature"), - F("Alternativer WE Vorlauftemperatur"), - F("Alternatieve warmtebron aanvoertemperatuur"), - F("Alternativ flödestemp värmekälla")) + "altflowtemp", + "alternative hs flow temperature", + "Alternativer WE Vorlauftemperatur", + "Alternatieve warmtebron aanvoertemperatuur", + "Alternativ flödestemp värmekälla") MAKE_PSTR_LIST(aRetTemp, - F("altrettemp"), - F("alternative hs return temperature"), - F("Alternativer WE Rücklauftemperatur"), - F("Alternatieve warmtebron retourtemperatuur"), - F("Alternativ returtemp värmekälla")) -MAKE_PSTR_LIST(sysFlowTemp, F("sysflowtemp"), F("system flow temperature"), F("System Vorlauftemperatur"), F("Systeem aanvoertemperatuur"), F("Systemflödestemperatur")) -MAKE_PSTR_LIST(sysRetTemp, F("sysrettemp"), F("system return temperature"), F("System Rücklauftemperatur"), F("Systeem retourtemperatuur"), F("Systemreturtemperatur")) -MAKE_PSTR_LIST(valveByPass, F("valvebypass"), F("bypass valve"), F("Bypass-Ventil"), F("Bypass klep"), F("Bypassventil")) -MAKE_PSTR_LIST(valveBuffer, F("valvebuffer"), F("buffer valve"), F("Puffer-Ventil"), F("Bufferklep"), F("Buffertventil")) -MAKE_PSTR_LIST(valveReturn, F("valvereturn"), F("return valve"), F("Rückfluss-Ventil"), F("Retourklep"), F("Returventil")) + "altrettemp", + "alternative hs return temperature", + "Alternativer WE Rücklauftemperatur", + "Alternatieve warmtebron retourtemperatuur", + "Alternativ returtemp värmekälla") +MAKE_PSTR_LIST(sysFlowTemp, "sysflowtemp", "system flow temperature", "System Vorlauftemperatur", "Systeem aanvoertemperatuur", "Systemflödestemperatur") +MAKE_PSTR_LIST(sysRetTemp, "sysrettemp", "system return temperature", "System Rücklauftemperatur", "Systeem retourtemperatuur", "Systemreturtemperatur") +MAKE_PSTR_LIST(valveByPass, "valvebypass", "bypass valve", "Bypass-Ventil", "Bypass klep", "Bypassventil") +MAKE_PSTR_LIST(valveBuffer, "valvebuffer", "buffer valve", "Puffer-Ventil", "Bufferklep", "Buffertventil") +MAKE_PSTR_LIST(valveReturn, "valvereturn", "return valve", "Rückfluss-Ventil", "Retourklep", "Returventil") MAKE_PSTR_LIST(aPumpMod, - F("altpumpmod"), - F("alternative hs pump modulation"), - F("Alternativer WE Pumpenmodulation"), - F("Alternatieve warmtebron pomp modulatie"), - F("Alternativ Pumpmodulering Värmekälla")) -MAKE_PSTR_LIST(heatSource, - F("heatsource"), - F("alternative heating active"), - F("Alternativer Wärmeerzeuger aktiv"), - F("Alternatieve warmtebron aktief"), - F("Alternativ Värmekälla aktiv")) + "altpumpmod", + "alternative hs pump modulation", + "Alternativer WE Pumpenmodulation", + "Alternatieve warmtebron pomp modulatie", + "Alternativ Pumpmodulering Värmekälla") +MAKE_PSTR_LIST(heatSource, "heatsource", "alternative heating active", "Alternativer Wärmeerzeuger aktiv", "Alternatieve warmtebron aktief", "Alternativ Värmekälla aktiv") -MAKE_PSTR_LIST(vr2Config, F("vr2config"), F("vr2 configuration"), F("VR2 Konfiguration"), F("VR2 configuratie"), F("VR2 Konfiguration")) +MAKE_PSTR_LIST(vr2Config, "vr2config", "vr2 configuration", "VR2 Konfiguration", "VR2 configuratie", "VR2 Konfiguration") MAKE_PSTR_LIST(ahsActivated, - F("ahsactivated"), - F("alternate heat source activation"), - F("Alt. Wärmeerzeuger aktiviert"), - F("Altenatieve warmtebron geactiveerd"), - F("Alternativ värmekälla aktivering")) -MAKE_PSTR_LIST(aPumpConfig, F("apumpconfig"), F("primary pump config"), F("Konfig. Hauptpumpe"), F("Primaire pomp configuratie"), F("Konfiguration Primärpump")) -MAKE_PSTR_LIST(aPumpSignal, F("apumpsignal"), F("output for pr1 pump"), F("Ausgang Pumpe PR1"), F("Output voor pomp PR1"), F("Utgång från pump PR1")) -MAKE_PSTR_LIST(aPumpMin, F("apumpmin"), F("min output pump pr1"), F("Minimale Pumpenansteuerung"), F("Minimale output pomp PR1"), F("Min Output Pump PR1")) -MAKE_PSTR_LIST(tempRise, F("temprise"), F("ahs return temp rise"), F("Rücklauf Temperaturerhöhung"), F("Verhoging retourtemperatuur"), F("Förhöjd returtemperatur")) -MAKE_PSTR_LIST(setReturnTemp, F("setreturntemp"), F("set temp return"), F("Soll-Rücklauftemperatur"), F("Streeftemperatuur retour"), F("Vald returtemperatur")) -MAKE_PSTR_LIST(mixRuntime, F("mixruntime"), F("mixer run time"), F("Mischer-Laufzeit"), F("Mixer looptijd"), F("Blandningsventil drifttid")) -MAKE_PSTR_LIST(bufBypass, F("bufbypass"), F("buffer bypass config"), F("Puffer-Bypass Konfig."), F("Buffer bypass configuratie"), F("Konfiguration Buffer bypass")) -MAKE_PSTR_LIST(bufMixRuntime, - F("bufmixruntime"), - F("bypass mixer run time"), - F("Speicher-Mischer-Laufzeit"), - F("Buffer mixer looptijd"), - F("Blandningsventil Bypass drifttid")) -MAKE_PSTR_LIST(bufConfig, - F("bufconfig"), - F("dhw buffer config"), - F("Konfig. Warmwasserspeicher"), - F("Warmwater boiler configuratie"), - F("Konfiguration Varmvattentank")) -MAKE_PSTR_LIST(blockMode, F("blockmode"), F("config htg. blocking mode"), F("Konfig. Sperr-Modus"), F("Configuratie blokeermodus"), F("Konfiguration Blockeringsläge")) -MAKE_PSTR_LIST(blockTerm, - F("blockterm"), - F("config of block terminal"), - F("Konfig. Sperrterminal"), - F("Configuratie blookerterminal"), - F("Konfiguration Blockeringsterminal")) -MAKE_PSTR_LIST(blockHyst, F("blockhyst"), F("hyst. for boiler block"), F("Hysterese Sperrmodus"), F("Hysterese blokeerterminal"), F("Hysteres Blockeringsmodul")) -MAKE_PSTR_LIST(releaseWait, F("releasewait"), F("boiler release wait time"), F("Wartezeit Kessel-Freigabe"), F("Wachttijd ketel vrijgave"), F("Väntetid Frisläppning")) + "ahsactivated", + "alternate heat source activation", + "Alt. Wärmeerzeuger aktiviert", + "Altenatieve warmtebron geactiveerd", + "Alternativ värmekälla aktivering") +MAKE_PSTR_LIST(aPumpConfig, "apumpconfig", "primary pump config", "Konfig. Hauptpumpe", "Primaire pomp configuratie", "Konfiguration Primärpump") +MAKE_PSTR_LIST(aPumpSignal, "apumpsignal", "output for pr1 pump", "Ausgang Pumpe PR1", "Output voor pomp PR1", "Utgång från pump PR1") +MAKE_PSTR_LIST(aPumpMin, "apumpmin", "min output pump pr1", "Minimale Pumpenansteuerung", "Minimale output pomp PR1", "Min Output Pump PR1") +MAKE_PSTR_LIST(tempRise, "temprise", "ahs return temp rise", "Rücklauf Temperaturerhöhung", "Verhoging retourtemperatuur", "Förhöjd returtemperatur") +MAKE_PSTR_LIST(setReturnTemp, "setreturntemp", "set temp return", "Soll-Rücklauftemperatur", "Streeftemperatuur retour", "Vald returtemperatur") +MAKE_PSTR_LIST(mixRuntime, "mixruntime", "mixer run time", "Mischer-Laufzeit", "Mixer looptijd", "Blandningsventil drifttid") +MAKE_PSTR_LIST(bufBypass, "bufbypass", "buffer bypass config", "Puffer-Bypass Konfig.", "Buffer bypass configuratie", "Konfiguration Buffer bypass") +MAKE_PSTR_LIST(bufMixRuntime, "bufmixruntime", "bypass mixer run time", "Speicher-Mischer-Laufzeit", "Buffer mixer looptijd", "Blandningsventil Bypass drifttid") +MAKE_PSTR_LIST(bufConfig, "bufconfig", "dhw buffer config", "Konfig. Warmwasserspeicher", "Warmwater boiler configuratie", "Konfiguration Varmvattentank") +MAKE_PSTR_LIST(blockMode, "blockmode", "config htg. blocking mode", "Konfig. Sperr-Modus", "Configuratie blokeermodus", "Konfiguration Blockeringsläge") +MAKE_PSTR_LIST(blockTerm, "blockterm", "config of block terminal", "Konfig. Sperrterminal", "Configuratie blookerterminal", "Konfiguration Blockeringsterminal") +MAKE_PSTR_LIST(blockHyst, "blockhyst", "hyst. for boiler block", "Hysterese Sperrmodus", "Hysterese blokeerterminal", "Hysteres Blockeringsmodul") +MAKE_PSTR_LIST(releaseWait, "releasewait", "boiler release wait time", "Wartezeit Kessel-Freigabe", "Wachttijd ketel vrijgave", "Väntetid Frisläppning") // the following are dhw for the boiler and automatically tagged with 'dhw' -MAKE_PSTR_LIST(wwSelTempLow, - F("wwseltemplow"), - F("selected lower temperature"), - F("untere Solltemperatur"), - F("Onderste streeftemperatuur"), - F("Vald lägstatemperatur")) -MAKE_PSTR_LIST(wwSelTempOff, - F("wwseltempoff"), - F("selected temperature for off"), - F("Solltemperatur bei AUS"), - F("Streeftemperatuur bij UIT"), - F("Vald tempereatur för AV")) +MAKE_PSTR_LIST(wwSelTempLow, "wwseltemplow", "selected lower temperature", "untere Solltemperatur", "Onderste streeftemperatuur", "Vald lägstatemperatur") +MAKE_PSTR_LIST(wwSelTempOff, "wwseltempoff", "selected temperature for off", "Solltemperatur bei AUS", "Streeftemperatuur bij UIT", "Vald tempereatur för AV") MAKE_PSTR_LIST(wwSelTempSingle, - F("wwseltempsingle"), - F("single charge temperature"), - F("Solltemperatur Einmalladung"), - F("Streeftemperatuur enkele lading"), - F("Temperatur Engångsladdning")) + "wwseltempsingle", + "single charge temperature", + "Solltemperatur Einmalladung", + "Streeftemperatuur enkele lading", + "Temperatur Engångsladdning") MAKE_PSTR_LIST(wwCylMiddleTemp, - F("wwcylmiddletemp"), - F("cylinder middle temperature (TS3)"), - F("Speichertemperature Mitte"), - F("Buffer temperatuur midden"), - F("Cylinder Temperatur Mitten (TS3)")) + "wwcylmiddletemp", + "cylinder middle temperature (TS3)", + "Speichertemperature Mitte", + "Buffer temperatuur midden", + "Cylinder Temperatur Mitten (TS3)") -MAKE_PSTR_LIST(wwSelTemp, F("wwseltemp"), F("selected temperature"), F("gewählte Temperatur"), F("Geselecteerd temperatuur"), F("Vald Temperatur")) -MAKE_PSTR_LIST(wwSetTemp, F("wwsettemp"), F("set temperature"), F("Solltemperatur"), F("Streeftemperatuut"), F("Börtempertur")) -MAKE_PSTR_LIST(wwType, F("wwtype"), F("type"), F("Typ"), F("type"), F("Typ")) -MAKE_PSTR_LIST(wwComfort, F("wwcomfort"), F("comfort"), F("Komfort"), F("Comfort"), F("Komfort")) -MAKE_PSTR_LIST(wwComfort1, F("wwcomfort1"), F("comfort mode"), F("Komfort-Modus"), F("Comfort modus"), F("Komfortläge")) -MAKE_PSTR_LIST(wwFlowTempOffset, - F("wwflowtempoffset"), - F("flow temperature offset"), - F("Vorlauftemperaturanhebung"), - F("Aanvoertemperatuur offset"), - F("Flödestemperatur förskjutning")) -MAKE_PSTR_LIST(wwMaxPower, F("wwmaxpower"), F("max power"), F("max Leistung"), F("Maximaal vermogen"), F("Max Effekt")) -MAKE_PSTR_LIST(wwCircPump, - F("wwcircpump"), - F("circulation pump available"), - F("Zirkulationspumpe vorhanden"), - F("Circulatiepomp aanwezig"), - F("Cirkulationspump tillgänglig")) -MAKE_PSTR_LIST(wwChargeType, F("wwchargetype"), F("charging type"), F("Speicher-Ladungstyp"), F("Buffer laadtype"), F("Laddningstyp")) -MAKE_PSTR_LIST(wwDisinfectionTemp, - F("wwdisinfectiontemp"), - F("disinfection temperature"), - F("Desinfektionstemperatur"), - F("Desinfectietemperatuur"), - F("Desinfektionstemperatur")) -MAKE_PSTR_LIST(wwCircMode, F("wwcircmode"), F("circulation pump mode"), F("Zirkulationspumpen-Modus"), F("Modus circulatiepomp"), F("Läge Cirkulationspump")) -MAKE_PSTR_LIST(wwCirc, F("wwcirc"), F("circulation active"), F("Zirkulation aktiv"), F("Circulatiepomp actief"), F("Cirkulation aktiv")) -MAKE_PSTR_LIST(wwCurTemp, - F("wwcurtemp"), - F("current intern temperature"), - F("aktuelle interne Temperatur"), - F("Huidige interne temperatuur"), - F("Aktuell Intern Temperatur")) -MAKE_PSTR_LIST(wwCurTemp2, - F("wwcurtemp2"), - F("current extern temperature"), - F("aktuelle externe Temperatur"), - F("Huidige externe temperatuur"), - F("Aktuell Extern Temperatur")) -MAKE_PSTR_LIST(wwCurFlow, F("wwcurflow"), F("current tap water flow"), F("aktueller Durchfluss"), F("Hudige warmwater doorstroming"), F("Aktuellt tappvattenflöde")) -MAKE_PSTR_LIST(wwStorageTemp1, - F("wwstoragetemp1"), - F("storage intern temperature"), - F("interne Speichertemperature"), - F("Interne buffertemperatuur"), - F("Beredare Intern Temperatur")) -MAKE_PSTR_LIST(wwStorageTemp2, - F("wwstoragetemp2"), - F("storage extern temperature"), - F("externer Speichertemperatur"), - F("Externe buffertemperatuur"), - F("Beredare Extern Tempereatur")) -MAKE_PSTR_LIST(wwActivated, F("wwactivated"), F("activated"), F("aktiviert"), F("geactiveerd"), F("Aktiverad")) -MAKE_PSTR_LIST(wwOneTime, F("wwonetime"), F("one time charging"), F("Einmalladung"), F("Buffer eenmalig laden"), F("Engångsladdning")) -MAKE_PSTR_LIST(wwDisinfecting, F("wwdisinfecting"), F("disinfecting"), F("Desinfizieren"), F("Desinfectie"), F("Desinficerar")) -MAKE_PSTR_LIST(wwCharging, F("wwcharging"), F("charging"), F("Laden"), F("Laden"), F("Laddar")) -MAKE_PSTR_LIST(wwChargeOptimization, F("wwchargeoptimization"), F("charge optimization"), F("Ladungsoptimierung"), F("laadoptimalisatie"), F("Laddningsoptimering")) -MAKE_PSTR_LIST(wwRecharging, F("wwrecharging"), F("recharging"), F("Nachladen"), F("herladen"), F("Omladdar")) -MAKE_PSTR_LIST(wwTempOK, F("wwtempok"), F("temperature ok"), F("Temperatur ok"), F("Temperatuur OK"), F("Temperatur OK")) -MAKE_PSTR_LIST(wwActive, F("wwactive"), F("active"), F("aktiv"), F("Actief"), F("Aktiv")) -MAKE_PSTR_LIST(ww3wayValve, F("ww3wayvalve"), F("3-way valve active"), F("3-Wegeventil aktiv"), F("3-wegklep actief"), F("Trevägsventil Aktiv")) -MAKE_PSTR_LIST(wwSetPumpPower, F("wwsetpumppower"), F("set pump power"), F("Soll Pumpenleistung"), F("Streefwaarde pompvermogen"), F("Vald pumpeffekt")) -MAKE_PSTR_LIST(wwMixerTemp, F("wwmixertemp"), F("mixer temperature"), F("Mischertemperatur"), F("Mixertemperatuur"), F("Blandningsventil-tempertur")) -MAKE_PSTR_LIST(wwStarts, F("wwstarts"), F("starts"), F("Anzahl Starts"), F("Aantal starts"), F("Antal Starter")) -MAKE_PSTR_LIST(wwStarts2, F("wwstarts2"), F("control starts2"), F("Kreis 2 Anzahl Starts"), F("Aantal starts circuit 2"), F("Antal Starter Krets 2")) -MAKE_PSTR_LIST(wwWorkM, F("wwworkm"), F("active time"), F("aktive Zeit"), F("Actieve tijd"), F("Aktiv Tid")) -MAKE_PSTR_LIST(wwHystOn, - F("wwhyston"), - F("hysteresis on temperature"), - F("Einschalttemperaturdifferenz"), - F("Inschakeltemperatuurverschil"), - F("Hysteres PÅ-temperatur")) -MAKE_PSTR_LIST(wwHystOff, - F("wwhystoff"), - F("hysteresis off temperature"), - F("Ausschalttemperaturdifferenz"), - F("Uitschakeltemperatuurverschil"), - F("Hysteres AV-temperatur")) -MAKE_PSTR_LIST(wwProgMode, F("wwprogmode"), F("program"), F("Programmmodus"), F("Programma"), F("Program")) -MAKE_PSTR_LIST(wwCircProg, F("wwcircprog"), F("circulation program"), F("Zirkulationsprogramm"), F("Circulatieprogramma"), F("Cirkulationsprogram")) -MAKE_PSTR_LIST(wwMaxTemp, F("wwmaxtemp"), F("maximum temperature"), F("Maximale Temperatur"), F("Maximale temperatuur"), F("Maximal Temperatur")) -MAKE_PSTR_LIST(wwOneTimeKey, F("wwonetimekey"), F("one time key function"), F("Einmalladungstaste"), F("Knop voor eenmalig laden buffer"), F("Engångsfunktion")) +MAKE_PSTR_LIST(wwSelTemp, "wwseltemp", "selected temperature", "gewählte Temperatur", "Geselecteerd temperatuur", "Vald Temperatur") +MAKE_PSTR_LIST(wwSetTemp, "wwsettemp", "set temperature", "Solltemperatur", "Streeftemperatuut", "Börtempertur") +MAKE_PSTR_LIST(wwType, "wwtype", "type", "Typ", "type", "Typ") +MAKE_PSTR_LIST(wwComfort, "wwcomfort", "comfort", "Komfort", "Comfort", "Komfort") +MAKE_PSTR_LIST(wwComfort1, "wwcomfort1", "comfort mode", "Komfort-Modus", "Comfort modus", "Komfortläge") +MAKE_PSTR_LIST(wwFlowTempOffset, "wwflowtempoffset", "flow temperature offset", "Vorlauftemperaturanhebung", "Aanvoertemperatuur offset", "Flödestemperatur förskjutning") +MAKE_PSTR_LIST(wwMaxPower, "wwmaxpower", "max power", "max Leistung", "Maximaal vermogen", "Max Effekt") +MAKE_PSTR_LIST(wwCircPump, "wwcircpump", "circulation pump available", "Zirkulationspumpe vorhanden", "Circulatiepomp aanwezig", "Cirkulationspump tillgänglig") +MAKE_PSTR_LIST(wwChargeType, "wwchargetype", "charging type", "Speicher-Ladungstyp", "Buffer laadtype", "Laddningstyp") +MAKE_PSTR_LIST(wwDisinfectionTemp, "wwdisinfectiontemp", "disinfection temperature", "Desinfektionstemperatur", "Desinfectietemperatuur", "Desinfektionstemperatur") +MAKE_PSTR_LIST(wwCircMode, "wwcircmode", "circulation pump mode", "Zirkulationspumpen-Modus", "Modus circulatiepomp", "Läge Cirkulationspump") +MAKE_PSTR_LIST(wwCirc, "wwcirc", "circulation active", "Zirkulation aktiv", "Circulatiepomp actief", "Cirkulation aktiv") +MAKE_PSTR_LIST(wwCurTemp, "wwcurtemp", "current intern temperature", "aktuelle interne Temperatur", "Huidige interne temperatuur", "Aktuell Intern Temperatur") +MAKE_PSTR_LIST(wwCurTemp2, "wwcurtemp2", "current extern temperature", "aktuelle externe Temperatur", "Huidige externe temperatuur", "Aktuell Extern Temperatur") +MAKE_PSTR_LIST(wwCurFlow, "wwcurflow", "current tap water flow", "aktueller Durchfluss", "Hudige warmwater doorstroming", "Aktuellt tappvattenflöde") +MAKE_PSTR_LIST(wwStorageTemp1, "wwstoragetemp1", "storage intern temperature", "interne Speichertemperature", "Interne buffertemperatuur", "Beredare Intern Temperatur") +MAKE_PSTR_LIST(wwStorageTemp2, "wwstoragetemp2", "storage extern temperature", "externer Speichertemperatur", "Externe buffertemperatuur", "Beredare Extern Tempereatur") +MAKE_PSTR_LIST(wwActivated, "wwactivated", "activated", "aktiviert", "geactiveerd", "Aktiverad") +MAKE_PSTR_LIST(wwOneTime, "wwonetime", "one time charging", "Einmalladung", "Buffer eenmalig laden", "Engångsladdning") +MAKE_PSTR_LIST(wwDisinfecting, "wwdisinfecting", "disinfecting", "Desinfizieren", "Desinfectie", "Desinficerar") +MAKE_PSTR_LIST(wwCharging, "wwcharging", "charging", "Laden", "Laden", "Laddar") +MAKE_PSTR_LIST(wwChargeOptimization, "wwchargeoptimization", "charge optimization", "Ladungsoptimierung", "laadoptimalisatie", "Laddningsoptimering") +MAKE_PSTR_LIST(wwRecharging, "wwrecharging", "recharging", "Nachladen", "herladen", "Omladdar") +MAKE_PSTR_LIST(wwTempOK, "wwtempok", "temperature ok", "Temperatur ok", "Temperatuur OK", "Temperatur OK") +MAKE_PSTR_LIST(wwActive, "wwactive", "active", "aktiv", "Actief", "Aktiv") +MAKE_PSTR_LIST(ww3wayValve, "ww3wayvalve", "3-way valve active", "3-Wegeventil aktiv", "3-wegklep actief", "Trevägsventil Aktiv") +MAKE_PSTR_LIST(wwSetPumpPower, "wwsetpumppower", "set pump power", "Soll Pumpenleistung", "Streefwaarde pompvermogen", "Vald pumpeffekt") +MAKE_PSTR_LIST(wwMixerTemp, "wwmixertemp", "mixer temperature", "Mischertemperatur", "Mixertemperatuur", "Blandningsventil-tempertur") +MAKE_PSTR_LIST(wwStarts, "wwstarts", "starts", "Anzahl Starts", "Aantal starts", "Antal Starter") +MAKE_PSTR_LIST(wwStarts2, "wwstarts2", "control starts2", "Kreis 2 Anzahl Starts", "Aantal starts circuit 2", "Antal Starter Krets 2") +MAKE_PSTR_LIST(wwWorkM, "wwworkm", "active time", "aktive Zeit", "Actieve tijd", "Aktiv Tid") +MAKE_PSTR_LIST(wwHystOn, "wwhyston", "hysteresis on temperature", "Einschalttemperaturdifferenz", "Inschakeltemperatuurverschil", "Hysteres PÅ-temperatur") +MAKE_PSTR_LIST(wwHystOff, "wwhystoff", "hysteresis off temperature", "Ausschalttemperaturdifferenz", "Uitschakeltemperatuurverschil", "Hysteres AV-temperatur") +MAKE_PSTR_LIST(wwProgMode, "wwprogmode", "program", "Programmmodus", "Programma", "Program") +MAKE_PSTR_LIST(wwCircProg, "wwcircprog", "circulation program", "Zirkulationsprogramm", "Circulatieprogramma", "Cirkulationsprogram") +MAKE_PSTR_LIST(wwMaxTemp, "wwmaxtemp", "maximum temperature", "Maximale Temperatur", "Maximale temperatuur", "Maximal Temperatur") +MAKE_PSTR_LIST(wwOneTimeKey, "wwonetimekey", "one time key function", "Einmalladungstaste", "Knop voor eenmalig laden buffer", "Engångsfunktion") // mqtt values / commands -MAKE_PSTR_LIST(switchtime, F("switchtime"), F("program switchtime"), F("Programm Schaltzeit"), F("Programma schakeltijd"), F("Program Bytestid")) -MAKE_PSTR_LIST(switchtime1, F("switchtime1"), F("own1 program switchtime"), F("Programm 1 Schaltzeit"), F("Schakeltijd programma 1"), F("Program 1 Bytestid")) -MAKE_PSTR_LIST(switchtime2, F("switchtime2"), F("own2 program switchtime"), F("Programm 2 Schaltzeit"), F("Schakeltijd programma 2"), F("Program 2 Bytestid")) -MAKE_PSTR_LIST(wwswitchtime, - F("wwswitchtime"), - F("program switchtime"), - F("Programm Schaltzeit"), - F("Warm water programma schakeltijd"), - F("Varmvattenprogram Bytestid")) +MAKE_PSTR_LIST(switchtime, "switchtime", "program switchtime", "Programm Schaltzeit", "Programma schakeltijd", "Program Bytestid") +MAKE_PSTR_LIST(switchtime1, "switchtime1", "own1 program switchtime", "Programm 1 Schaltzeit", "Schakeltijd programma 1", "Program 1 Bytestid") +MAKE_PSTR_LIST(switchtime2, "switchtime2", "own2 program switchtime", "Programm 2 Schaltzeit", "Schakeltijd programma 2", "Program 2 Bytestid") +MAKE_PSTR_LIST(wwswitchtime, "wwswitchtime", "program switchtime", "Programm Schaltzeit", "Warm water programma schakeltijd", "Varmvattenprogram Bytestid") MAKE_PSTR_LIST(wwcircswitchtime, - F("wwcircswitchtime"), - F("circulation program switchtime"), - F("Zirculationsprogramm Schaltzeit"), - F("Schakeltijd circulatieprogramma"), - F("Cirkulationsprogram Bytestid")) -MAKE_PSTR_LIST(dateTime, F("datetime"), F("date/time"), F("Datum/Zeit"), F("Datum/Tijd"), F("Datum/Tid")) -MAKE_PSTR_LIST(errorCode, F("errorcode"), F("error code"), F("Fehlermeldung"), F("Foutmeldingscode"), F("Felkod")) -MAKE_PSTR_LIST(ibaMainDisplay, F("display"), F("display"), F("Anzeige"), F("Display"), F("Display")) -MAKE_PSTR_LIST(ibaLanguage, F("language"), F("language"), F("Sprache"), F("Taal"), F("Språk")) -MAKE_PSTR_LIST(ibaClockOffset, F("clockoffset"), F("clock offset"), F("Uhrkorrektur"), F("Klokcorrectie"), F("Tidskorrigering")) -MAKE_PSTR_LIST(ibaBuildingType, F("building"), F("building type"), F("Gebäudetyp"), F(""), F("Byggnadstyp")) -MAKE_PSTR_LIST(heatingPID, F("heatingpid"), F("heating PID"), F("Heizungs-PID"), F(""), F("Uppvärmning PID")) -MAKE_PSTR_LIST(ibaCalIntTemperature, F("intoffset"), F("internal temperature offset"), F("Korrektur interner Temperatur"), F(""), F("Korrigering interntemperatur")) -MAKE_PSTR_LIST(ibaMinExtTemperature, F("minexttemp"), F("minimal external temperature"), F("min. Aussentemperatur"), F(""), F("Min Extern Temperatur")) -MAKE_PSTR_LIST(backlight, F("backlight"), F("key backlight"), F("Gegenlicht"), F("Toetsverlichting"), F("Bakgrundsbelysning")) -MAKE_PSTR_LIST(damping, - F("damping"), - F("damping outdoor temperature"), - F("Dämpfung der Außentemperatur"), - F("Demping buitentemperatuur"), - F("Dämpning Utomhustemperatur")) -MAKE_PSTR_LIST(tempsensor1, F("inttemp1"), F("temperature sensor 1"), F("Temperatursensor 1"), F("Temperatuursensor 1"), F("Temperatursensor 1")) -MAKE_PSTR_LIST(tempsensor2, F("inttemp2"), F("temperature sensor 2"), F("Temperatursensor 2"), F("Temperatuursensor 2"), F("Temperatursensor 2")) -MAKE_PSTR_LIST(dampedoutdoortemp, - F("dampedoutdoortemp"), - F("damped outdoor temperature"), - F("gedämpfte Außentemperatur"), - F("Gedempte buitentemperatuur"), - F("Dämpad Utomhustemperatur")) -MAKE_PSTR_LIST(floordrystatus, F("floordry"), F("floor drying"), F("Estrichtrocknung"), F("Vloerdroogprogramma"), F("Golvtorkning")) -MAKE_PSTR_LIST(floordrytemp, - F("floordrytemp"), - F("floor drying temperature"), - F("Estrichtrocknungs Temperatur"), - F("Temperatuur vloerdroogprogramma"), - F("Golvtorkning Temperatur")) -MAKE_PSTR_LIST(brightness, F("brightness"), F("screen brightness"), F("Bildschirmhelligkeit"), F("Schermhelderheid"), F("Ljusstyrka")) + "wwcircswitchtime", + "circulation program switchtime", + "Zirculationsprogramm Schaltzeit", + "Schakeltijd circulatieprogramma", + "Cirkulationsprogram Bytestid") +MAKE_PSTR_LIST(dateTime, "datetime", "date/time", "Datum/Zeit", "Datum/Tijd", "Datum/Tid") +MAKE_PSTR_LIST(errorCode, "errorcode", "error code", "Fehlermeldung", "Foutmeldingscode", "Felkod") +MAKE_PSTR_LIST(ibaMainDisplay, "display", "display", "Anzeige", "Display", "Display") +MAKE_PSTR_LIST(ibaLanguage, "language", "language", "Sprache", "Taal", "Språk") +MAKE_PSTR_LIST(ibaClockOffset, "clockoffset", "clock offset", "Uhrkorrektur", "Klokcorrectie", "Tidskorrigering") +MAKE_PSTR_LIST(ibaBuildingType, "building", "building type", "Gebäudetyp", "", "Byggnadstyp") +MAKE_PSTR_LIST(heatingPID, "heatingpid", "heating PID", "Heizungs-PID", "", "Uppvärmning PID") +MAKE_PSTR_LIST(ibaCalIntTemperature, "intoffset", "internal temperature offset", "Korrektur interner Temperatur", "", "Korrigering interntemperatur") +MAKE_PSTR_LIST(ibaMinExtTemperature, "minexttemp", "minimal external temperature", "min. Aussentemperatur", "", "Min Extern Temperatur") +MAKE_PSTR_LIST(backlight, "backlight", "key backlight", "Gegenlicht", "Toetsverlichting", "Bakgrundsbelysning") +MAKE_PSTR_LIST(damping, "damping", "damping outdoor temperature", "Dämpfung der Außentemperatur", "Demping buitentemperatuur", "Dämpning Utomhustemperatur") +MAKE_PSTR_LIST(tempsensor1, "inttemp1", "temperature sensor 1", "Temperatursensor 1", "Temperatuursensor 1", "Temperatursensor 1") +MAKE_PSTR_LIST(tempsensor2, "inttemp2", "temperature sensor 2", "Temperatursensor 2", "Temperatuursensor 2", "Temperatursensor 2") +MAKE_PSTR_LIST(dampedoutdoortemp, "dampedoutdoortemp", "damped outdoor temperature", "gedämpfte Außentemperatur", "Gedempte buitentemperatuur", "Dämpad Utomhustemperatur") +MAKE_PSTR_LIST(floordrystatus, "floordry", "floor drying", "Estrichtrocknung", "Vloerdroogprogramma", "Golvtorkning") +MAKE_PSTR_LIST(floordrytemp, "floordrytemp", "floor drying temperature", "Estrichtrocknungs Temperatur", "Temperatuur vloerdroogprogramma", "Golvtorkning Temperatur") +MAKE_PSTR_LIST(brightness, "brightness", "screen brightness", "Bildschirmhelligkeit", "Schermhelderheid", "Ljusstyrka") MAKE_PSTR_LIST(autodst, - F("autodst"), - F("automatic change daylight saving time"), - F("automatische Sommerzeit Umstellung"), - F("Automatische omschakeling zomer-wintertijd"), - F("Automatisk växling sommar/vinter-tid")) + "autodst", + "automatic change daylight saving time", + "automatische Sommerzeit Umstellung", + "Automatische omschakeling zomer-wintertijd", + "Automatisk växling sommar/vinter-tid") MAKE_PSTR_LIST(preheating, - F("preheating"), - F("preheating in the clock program"), - F("Vorheizen im Zeitprogramm"), - F("Voorverwarming in het klokprogramma"), - F("Förvärmning i tidsprogram")) -MAKE_PSTR_LIST(offtemp, F("offtemp"), F("temperature when mode is off"), F("Temperatur bei AUS"), F("Temperatuur bij UIT"), F("Temperatur Avslagen")) -MAKE_PSTR_LIST(mixingvalves, F("mixingvalves"), F("mixing valves"), F("Mischventile"), F("Mengkleppen"), F("Blandningsventiler")) + "preheating", + "preheating in the clock program", + "Vorheizen im Zeitprogramm", + "Voorverwarming in het klokprogramma", + "Förvärmning i tidsprogram") +MAKE_PSTR_LIST(offtemp, "offtemp", "temperature when mode is off", "Temperatur bei AUS", "Temperatuur bij UIT", "Temperatur Avslagen") +MAKE_PSTR_LIST(mixingvalves, "mixingvalves", "mixing valves", "Mischventile", "Mengkleppen", "Blandningsventiler") // thermostat ww -MAKE_PSTR_LIST(wwMode, F("wwmode"), F("mode"), F("Modus"), F("Modus"), F("Läge")) -MAKE_PSTR_LIST(wwSetTempLow, F("wwsettemplow"), F("set low temperature"), F("untere Solltemperatur"), F("Onderste streeftemperatuur"), F("Nedre Börvärde")) -MAKE_PSTR_LIST(wwWhenModeOff, - F("wwwhenmodeoff"), - F("when thermostat mode off"), - F("bei Thermostatmodus AUS"), - F("Als Thermostaat op UIT"), - F("när Termostatläge är AV")) -MAKE_PSTR_LIST(wwExtra1, F("wwextra1"), F("circuit 1 extra"), F("Kreis 1 Extra"), F("Circuit 1 extra"), F("Krets 1 Extra")) -MAKE_PSTR_LIST(wwExtra2, F("wwextra2"), F("circuit 2 extra"), F("Kreis 2 Extra"), F("Circuit 2 extra"), F("Kets 2 Extra")) +MAKE_PSTR_LIST(wwMode, "wwmode", "mode", "Modus", "Modus", "Läge") +MAKE_PSTR_LIST(wwSetTempLow, "wwsettemplow", "set low temperature", "untere Solltemperatur", "Onderste streeftemperatuur", "Nedre Börvärde") +MAKE_PSTR_LIST(wwWhenModeOff, "wwwhenmodeoff", "when thermostat mode off", "bei Thermostatmodus AUS", "Als Thermostaat op UIT", "när Termostatläge är AV") +MAKE_PSTR_LIST(wwExtra1, "wwextra1", "circuit 1 extra", "Kreis 1 Extra", "Circuit 1 extra", "Krets 1 Extra") +MAKE_PSTR_LIST(wwExtra2, "wwextra2", "circuit 2 extra", "Kreis 2 Extra", "Circuit 2 extra", "Kets 2 Extra") -MAKE_PSTR_LIST(wwCharge, F("wwcharge"), F("charge"), F("Laden"), F("Laden"), F("Ladda")) -MAKE_PSTR_LIST(wwChargeDuration, F("wwchargeduration"), F("charge duration"), F("Ladedauer"), F("Laadtijd"), F("Laddtid")) -MAKE_PSTR_LIST(wwDisinfect, F("wwdisinfect"), F("disinfection"), F("Desinfektion"), F("Desinfectie"), F("Desinfektion")) -MAKE_PSTR_LIST(wwDisinfectDay, F("wwdisinfectday"), F("disinfection day"), F("Desinfektionstag"), F("Desinfectiedag"), F("Desinfektionsdag")) -MAKE_PSTR_LIST(wwDisinfectHour, F("wwdisinfecthour"), F("disinfection hour"), F("Desinfektionsstunde"), F("Desinfectieuur"), F("Desinfektionstimme")) -MAKE_PSTR_LIST(wwDisinfectTime, F("wwdisinfecttime"), F("disinfection time"), F("Desinfektionszeit"), F("Desinfectietijd"), F("Desinfektionstid")) -MAKE_PSTR_LIST(wwDailyHeating, F("wwdailyheating"), F("daily heating"), F("täglich Heizen"), F("Dagelijks opwarmen"), F("Daglig Uppvärmning")) -MAKE_PSTR_LIST(wwDailyHeatTime, F("wwdailyheattime"), F("daily heating time"), F("tägliche Heizzeit"), F("Tijd dagelijkse opwarming"), F("Daglig Uppvärmningstid")) +MAKE_PSTR_LIST(wwCharge, "wwcharge", "charge", "Laden", "Laden", "Ladda") +MAKE_PSTR_LIST(wwChargeDuration, "wwchargeduration", "charge duration", "Ladedauer", "Laadtijd", "Laddtid") +MAKE_PSTR_LIST(wwDisinfect, "wwdisinfect", "disinfection", "Desinfektion", "Desinfectie", "Desinfektion") +MAKE_PSTR_LIST(wwDisinfectDay, "wwdisinfectday", "disinfection day", "Desinfektionstag", "Desinfectiedag", "Desinfektionsdag") +MAKE_PSTR_LIST(wwDisinfectHour, "wwdisinfecthour", "disinfection hour", "Desinfektionsstunde", "Desinfectieuur", "Desinfektionstimme") +MAKE_PSTR_LIST(wwDisinfectTime, "wwdisinfecttime", "disinfection time", "Desinfektionszeit", "Desinfectietijd", "Desinfektionstid") +MAKE_PSTR_LIST(wwDailyHeating, "wwdailyheating", "daily heating", "täglich Heizen", "Dagelijks opwarmen", "Daglig Uppvärmning") +MAKE_PSTR_LIST(wwDailyHeatTime, "wwdailyheattime", "daily heating time", "tägliche Heizzeit", "Tijd dagelijkse opwarming", "Daglig Uppvärmningstid") // thermostat hc -MAKE_PSTR_LIST(selRoomTemp, F("seltemp"), F("selected room temperature"), F("Sollwert Raumtemperatur"), F("Streeftemperatuur kamer"), F("Vald Rumstemperatur")) -MAKE_PSTR_LIST(roomTemp, F("currtemp"), F("current room temperature"), F("aktuelle Raumtemperatur"), F("Huidige kamertemperatuur"), F("Aktuell Rumstemperatur")) -MAKE_PSTR_LIST(mode, F("mode"), F("mode"), F("Modus"), F("Modus"), F("Läge")) -MAKE_PSTR_LIST(modetype, F("modetype"), F("mode type"), F("Modus Typ"), F("Type modus"), F("Typ av läge")) -MAKE_PSTR_LIST(fastheatup, F("fastheatup"), F("fast heatup"), F("schnelles Aufheizen"), F("Snel opwarmen"), F("Snabb Uppvärmning")) -MAKE_PSTR_LIST(daytemp, F("daytemp"), F("day temperature"), F("Tagestemperatur"), F("temperatuur dag"), F("Dagstemperatur")) -MAKE_PSTR_LIST(daylowtemp, F("daytemp2"), F("day temperature T2"), F("Tagestemperatur T2"), F("Temperatuur dag T2"), F("Dagstemperatur T2")) -MAKE_PSTR_LIST(daymidtemp, F("daytemp3"), F("day temperature T3"), F("Tagestemperatur T3"), F("Temperatuur dag T3"), F("Dagstemperatur T3")) -MAKE_PSTR_LIST(dayhightemp, F("daytemp4"), F("day temperature T4"), F("Tagestemperatur T4"), F("Temperatuur dag T4"), F("Dagstemperatur T4")) -MAKE_PSTR_LIST(heattemp, F("heattemp"), F("heat temperature"), F("Heizen Temperatur"), F("Temperatuur verwarming"), F("Temperatur Uppvärmning")) -MAKE_PSTR_LIST(nighttemp, F("nighttemp"), F("night temperature"), F("Nachttemperatur"), F("Nachttemperatuur"), F("Nattemperatur")) -MAKE_PSTR_LIST(nighttemp2, F("nighttemp"), F("night temperature T1"), F("Nachttemperatur T1"), F("Nachttemperatuur T1"), F("Nattemperatur T1")) -MAKE_PSTR_LIST(ecotemp, F("ecotemp"), F("eco temperature"), F("eco Temperatur"), F("Temperatuur eco"), F("Eko-temperatur")) -MAKE_PSTR_LIST(manualtemp, F("manualtemp"), F("manual temperature"), F("manuelle Temperatur"), F("temperatuur handmatig"), F("Temperatur Manuell")) +MAKE_PSTR_LIST(selRoomTemp, "seltemp", "selected room temperature", "Sollwert Raumtemperatur", "Streeftemperatuur kamer", "Vald Rumstemperatur") +MAKE_PSTR_LIST(roomTemp, "currtemp", "current room temperature", "aktuelle Raumtemperatur", "Huidige kamertemperatuur", "Aktuell Rumstemperatur") +MAKE_PSTR_LIST(mode, "mode", "mode", "Modus", "Modus", "Läge") +MAKE_PSTR_LIST(modetype, "modetype", "mode type", "Modus Typ", "Type modus", "Typ av läge") +MAKE_PSTR_LIST(fastheatup, "fastheatup", "fast heatup", "schnelles Aufheizen", "Snel opwarmen", "Snabb Uppvärmning") +MAKE_PSTR_LIST(daytemp, "daytemp", "day temperature", "Tagestemperatur", "temperatuur dag", "Dagstemperatur") +MAKE_PSTR_LIST(daylowtemp, "daytemp2", "day temperature T2", "Tagestemperatur T2", "Temperatuur dag T2", "Dagstemperatur T2") +MAKE_PSTR_LIST(daymidtemp, "daytemp3", "day temperature T3", "Tagestemperatur T3", "Temperatuur dag T3", "Dagstemperatur T3") +MAKE_PSTR_LIST(dayhightemp, "daytemp4", "day temperature T4", "Tagestemperatur T4", "Temperatuur dag T4", "Dagstemperatur T4") +MAKE_PSTR_LIST(heattemp, "heattemp", "heat temperature", "Heizen Temperatur", "Temperatuur verwarming", "Temperatur Uppvärmning") +MAKE_PSTR_LIST(nighttemp, "nighttemp", "night temperature", "Nachttemperatur", "Nachttemperatuur", "Nattemperatur") +MAKE_PSTR_LIST(nighttemp2, "nighttemp", "night temperature T1", "Nachttemperatur T1", "Nachttemperatuur T1", "Nattemperatur T1") +MAKE_PSTR_LIST(ecotemp, "ecotemp", "eco temperature", "eco Temperatur", "Temperatuur eco", "Eko-temperatur") +MAKE_PSTR_LIST(manualtemp, "manualtemp", "manual temperature", "manuelle Temperatur", "temperatuur handmatig", "Temperatur Manuell") MAKE_PSTR_LIST(tempautotemp, - F("tempautotemp"), - F("temporary set temperature automode"), - F("temporäre Solltemperatur"), - F("Streeftemperatuur automodus tijdelijk"), - F("Temporär Aktivering av Auto-läge")) + "tempautotemp", + "temporary set temperature automode", + "temporäre Solltemperatur", + "Streeftemperatuur automodus tijdelijk", + "Temporär Aktivering av Auto-läge") MAKE_PSTR_LIST(remoteseltemp, - F("remoteseltemp"), - F("temporary set temperature from remote"), - F("temporäre Solltemperatur Remote"), - F("Temperatuur van afstandsbedieding"), - F("Temperatur från fjärruppkoppling")) -MAKE_PSTR_LIST(comforttemp, F("comforttemp"), F("comfort temperature"), F("Komforttemperatur"), F("Comforttemperatuur"), F("Komforttemperatur")) -MAKE_PSTR_LIST(summertemp, F("summertemp"), F("summer temperature"), F("Sommertemperatur"), F("Zomertemperatuur"), F("Sommartemperatur")) -MAKE_PSTR_LIST(designtemp, F("designtemp"), F("design temperature"), F("Auslegungstemperatur"), F("Ontwerptemperatuur"), F("Design-temperatur")) -MAKE_PSTR_LIST(offsettemp, F("offsettemp"), F("offset temperature"), F("Temperaturanhebung"), F("Temperatuur offset"), F("Temperaturkorrigering")) -MAKE_PSTR_LIST(minflowtemp, F("minflowtemp"), F("min flow temperature"), F("min Vorlauftemperatur"), F(""), F("Min Flödestemperatur")) -MAKE_PSTR_LIST(maxflowtemp, F("maxflowtemp"), F("max flow temperature"), F("max Vorlauftemperatur"), F(""), F("Max Flödestemperatur")) -MAKE_PSTR_LIST(roominfluence, F("roominfluence"), F("room influence"), F("Raumeinfluss"), F("Ruimteinvloed"), F("Rumspåverkan")) -MAKE_PSTR_LIST(roominfl_factor, F("roominflfactor"), F("room influence factor"), F("Raumeinfluss Factor"), F("Factor ruimteinvloed"), F("Rumspåverkansfaktor")) -MAKE_PSTR_LIST(curroominfl, F("curroominfl"), F("current room influence"), F("aktueller Raumeinfluss"), F("Huidige ruimteinvloed"), F("Aktuell Rumspåverkan")) -MAKE_PSTR_LIST(nofrosttemp, F("nofrosttemp"), F("nofrost temperature"), F("Frostschutztemperatur"), F("Temperatuur vorstbeveiliging"), F("Temperatur Frostskydd")) -MAKE_PSTR_LIST(targetflowtemp, - F("targetflowtemp"), - F("target flow temperature"), - F("berechnete Vorlauftemperatur"), - F("Berekende aanvoertemperatuur"), - F("Målvärde Flödestemperatur")) -MAKE_PSTR_LIST(heatingtype, F("heatingtype"), F("heating type"), F("Heizungstyp"), F("Verwarmingstype"), F("Uppvärmningstyp")) -MAKE_PSTR_LIST(summersetmode, F("summersetmode"), F("set summer mode"), F("Einstellung Sommerbetrieb"), F("Instelling zomerbedrijf"), F("Aktivera Sommarläge")) -MAKE_PSTR_LIST(hpoperatingmode, - F("hpoperatingmode"), - F("heatpump operating mode"), - F("Wärmepumpe Betriebsmodus"), - F("Bedrijfsmodus warmtepomp"), - F("Värmepump Driftläge")) -MAKE_PSTR_LIST(hpoperatingstate, F("hpoperatingstate"), F("heatpump operating state"), F("WP Arbeitsweise"), F("Huidige modus warmtepomp"), F("Värmepump Driftstatus")) -MAKE_PSTR_LIST(controlmode, F("controlmode"), F("control mode"), F("Kontrollmodus"), F("Comtrolemodus"), F("Kontrolläge")) -MAKE_PSTR_LIST(control, F("control"), F("control device"), F("Fernsteuerung"), F("Afstandsbedieding"), F("Kontrollenhet")) -MAKE_PSTR_LIST(program, F("program"), F("program"), F("Programm"), F("Programma"), F("Program")) -MAKE_PSTR_LIST(pause, F("pause"), F("pause time"), F("Pausenzeit"), F("Pausetijd"), F("Paustid")) -MAKE_PSTR_LIST(party, F("party"), F("party time"), F("Partyzeit"), F("Partytijd"), F("Partytid")) -MAKE_PSTR_LIST(holidaytemp, F("holidaytemp"), F("holiday temperature"), F("Urlaubstemperatur"), F("Vakantietemperatuur"), F("Helgtemperatur")) -MAKE_PSTR_LIST(summermode, F("summermode"), F("summer mode"), F("Sommerbetrieb"), F("Zomerbedrijf"), F("Sommarläge")) -MAKE_PSTR_LIST(holidaymode, F("holidaymode"), F("holiday mode"), F("Urlaubsbetrieb"), F("Vakantiebedrijf"), F("Helgläge")) + "remoteseltemp", + "temporary set temperature from remote", + "temporäre Solltemperatur Remote", + "Temperatuur van afstandsbedieding", + "Temperatur från fjärruppkoppling") +MAKE_PSTR_LIST(comforttemp, "comforttemp", "comfort temperature", "Komforttemperatur", "Comforttemperatuur", "Komforttemperatur") +MAKE_PSTR_LIST(summertemp, "summertemp", "summer temperature", "Sommertemperatur", "Zomertemperatuur", "Sommartemperatur") +MAKE_PSTR_LIST(designtemp, "designtemp", "design temperature", "Auslegungstemperatur", "Ontwerptemperatuur", "Design-temperatur") +MAKE_PSTR_LIST(offsettemp, "offsettemp", "offset temperature", "Temperaturanhebung", "Temperatuur offset", "Temperaturkorrigering") +MAKE_PSTR_LIST(minflowtemp, "minflowtemp", "min flow temperature", "min Vorlauftemperatur", "", "Min Flödestemperatur") +MAKE_PSTR_LIST(maxflowtemp, "maxflowtemp", "max flow temperature", "max Vorlauftemperatur", "", "Max Flödestemperatur") +MAKE_PSTR_LIST(roominfluence, "roominfluence", "room influence", "Raumeinfluss", "Ruimteinvloed", "Rumspåverkan") +MAKE_PSTR_LIST(roominfl_factor, "roominflfactor", "room influence factor", "Raumeinfluss Factor", "Factor ruimteinvloed", "Rumspåverkansfaktor") +MAKE_PSTR_LIST(curroominfl, "curroominfl", "current room influence", "aktueller Raumeinfluss", "Huidige ruimteinvloed", "Aktuell Rumspåverkan") +MAKE_PSTR_LIST(nofrosttemp, "nofrosttemp", "nofrost temperature", "Frostschutztemperatur", "Temperatuur vorstbeveiliging", "Temperatur Frostskydd") +MAKE_PSTR_LIST(targetflowtemp, "targetflowtemp", "target flow temperature", "berechnete Vorlauftemperatur", "Berekende aanvoertemperatuur", "Målvärde Flödestemperatur") +MAKE_PSTR_LIST(heatingtype, "heatingtype", "heating type", "Heizungstyp", "Verwarmingstype", "Uppvärmningstyp") +MAKE_PSTR_LIST(summersetmode, "summersetmode", "set summer mode", "Einstellung Sommerbetrieb", "Instelling zomerbedrijf", "Aktivera Sommarläge") +MAKE_PSTR_LIST(hpoperatingmode, "hpoperatingmode", "heatpump operating mode", "Wärmepumpe Betriebsmodus", "Bedrijfsmodus warmtepomp", "Värmepump Driftläge") +MAKE_PSTR_LIST(hpoperatingstate, "hpoperatingstate", "heatpump operating state", "WP Arbeitsweise", "Huidige modus warmtepomp", "Värmepump Driftstatus") +MAKE_PSTR_LIST(controlmode, "controlmode", "control mode", "Kontrollmodus", "Comtrolemodus", "Kontrolläge") +MAKE_PSTR_LIST(control, "control", "control device", "Fernsteuerung", "Afstandsbedieding", "Kontrollenhet") +MAKE_PSTR_LIST(program, "program", "program", "Programm", "Programma", "Program") +MAKE_PSTR_LIST(pause, "pause", "pause time", "Pausenzeit", "Pausetijd", "Paustid") +MAKE_PSTR_LIST(party, "party", "party time", "Partyzeit", "Partytijd", "Partytid") +MAKE_PSTR_LIST(holidaytemp, "holidaytemp", "holiday temperature", "Urlaubstemperatur", "Vakantietemperatuur", "Helgtemperatur") +MAKE_PSTR_LIST(summermode, "summermode", "summer mode", "Sommerbetrieb", "Zomerbedrijf", "Sommarläge") +MAKE_PSTR_LIST(holidaymode, "holidaymode", "holiday mode", "Urlaubsbetrieb", "Vakantiebedrijf", "Helgläge") MAKE_PSTR_LIST(flowtempoffset, - F("flowtempoffset"), - F("flow temperature offset for mixer"), - F("Vorlauftemperaturanhebung"), - F("Mixer aanvoertemperatuur offset"), - F("Temperaturkorrigering Flödestemp. Blandningsventil")) -MAKE_PSTR_LIST(reducemode, F("reducemode"), F("reduce mode"), F("Absenkmodus"), F("Gereduceerde modus"), F("Reducerat Läge")) -MAKE_PSTR_LIST(noreducetemp, - F("noreducetemp"), - F("no reduce below temperature"), - F("Durchheizen unter"), - F("Reduceermodus onderbreken onder"), - F("Inaktivera reducering under")) -MAKE_PSTR_LIST(reducetemp, F("reducetemp"), F("off/reduce switch temperature"), F("Absenkmodus unter"), F("Onderste afschakeltemperatuur"), F("Avslag/Reducera under")) + "flowtempoffset", + "flow temperature offset for mixer", + "Vorlauftemperaturanhebung", + "Mixer aanvoertemperatuur offset", + "Temperaturkorrigering Flödestemp. Blandningsventil") +MAKE_PSTR_LIST(reducemode, "reducemode", "reduce mode", "Absenkmodus", "Gereduceerde modus", "Reducerat Läge") +MAKE_PSTR_LIST(noreducetemp, "noreducetemp", "no reduce below temperature", "Durchheizen unter", "Reduceermodus onderbreken onder", "Inaktivera reducering under") +MAKE_PSTR_LIST(reducetemp, "reducetemp", "off/reduce switch temperature", "Absenkmodus unter", "Onderste afschakeltemperatuur", "Avslag/Reducera under") MAKE_PSTR_LIST(vacreducetemp, - F("vacreducetemp"), - F("vacations off/reduce switch temperature"), - F("Urlaub Absenkmodus unter"), - F("Vakantiemodus onderste afschakeltemperatuur"), - F("Helg Avslag/Reducering under")) -MAKE_PSTR_LIST(vacreducemode, F("vacreducemode"), F("vacations reduce mode"), F("Urlaub Absenkmodus"), F("Vakantie afschakelmodus"), F("Helg reduceringsläge")) -MAKE_PSTR_LIST(nofrostmode, F("nofrostmode"), F("nofrost mode"), F("Frostschutz Modus"), F("Vorstbeveiligingsmodus"), F("Frostskyddsläge")) -MAKE_PSTR_LIST(remotetemp, - F("remotetemp"), - F("room temperature from remote"), - F("Raumtemperatur Remote"), - F("Ruimtetemperatuur van afstandsbediening"), - F("Rumstemperatur från fjärr")) + "vacreducetemp", + "vacations off/reduce switch temperature", + "Urlaub Absenkmodus unter", + "Vakantiemodus onderste afschakeltemperatuur", + "Helg Avslag/Reducering under") +MAKE_PSTR_LIST(vacreducemode, "vacreducemode", "vacations reduce mode", "Urlaub Absenkmodus", "Vakantie afschakelmodus", "Helg reduceringsläge") +MAKE_PSTR_LIST(nofrostmode, "nofrostmode", "nofrost mode", "Frostschutz Modus", "Vorstbeveiligingsmodus", "Frostskyddsläge") +MAKE_PSTR_LIST(remotetemp, "remotetemp", "room temperature from remote", "Raumtemperatur Remote", "Ruimtetemperatuur van afstandsbediening", "Rumstemperatur från fjärr") -MAKE_PSTR_LIST(wwHolidays, F("wwholidays"), F("holiday dates"), F("Feiertage"), F("Feestdagen"), F("Helgdagar")) -MAKE_PSTR_LIST(wwVacations, F("wwvacations"), F("vacation dates"), F("Urlaubstage"), F("Vakantiedagen"), F("Semesterdatum Varmvatten")) -MAKE_PSTR_LIST(holidays, F("holidays"), F("holiday dates"), F("Feiertage"), F("Feestdagen"), F("Helgdatum")) -MAKE_PSTR_LIST(vacations, F("vacations"), F("vacation dates"), F("Urlaubstage"), F("Vakantiedagen"), F("Semesterdatum")) -MAKE_PSTR_LIST(wwprio, F("wwprio"), F("dhw priority"), F("WW-Vorrang"), F("Prioriteit warm water"), F("Prioritera Varmvatten")) -MAKE_PSTR_LIST(nofrostmode1, F("nofrostmode1"), F("nofrost mode"), F("Frostschutz"), F("Vorstbeveiligingsmodus"), F("Frostskyddsläge")) -MAKE_PSTR_LIST(reducehours, F("reducehours"), F("duration for nighttemp"), F("Dauer Nachttemp."), F("Duur nachtverlaging"), F("Timmar Nattsänkning")) -MAKE_PSTR_LIST(reduceminutes, - F("reduceminutes"), - F("remaining time for nightmode"), - F("Restzeit Nachttemp."), - F("Resterende tijd nachtverlaging"), - F("Återstående Tid Nattläge")) -MAKE_PSTR_LIST(switchonoptimization, - F("switchonoptimization"), - F("switch-on optimization"), - F("Einschaltoptimierung"), - F("Inschakeloptimalisering"), - F("Växlingsoptimering")) +MAKE_PSTR_LIST(wwHolidays, "wwholidays", "holiday dates", "Feiertage", "Feestdagen", "Helgdagar") +MAKE_PSTR_LIST(wwVacations, "wwvacations", "vacation dates", "Urlaubstage", "Vakantiedagen", "Semesterdatum Varmvatten") +MAKE_PSTR_LIST(holidays, "holidays", "holiday dates", "Feiertage", "Feestdagen", "Helgdatum") +MAKE_PSTR_LIST(vacations, "vacations", "vacation dates", "Urlaubstage", "Vakantiedagen", "Semesterdatum") +MAKE_PSTR_LIST(wwprio, "wwprio", "dhw priority", "WW-Vorrang", "Prioriteit warm water", "Prioritera Varmvatten") +MAKE_PSTR_LIST(nofrostmode1, "nofrostmode1", "nofrost mode", "Frostschutz", "Vorstbeveiligingsmodus", "Frostskyddsläge") +MAKE_PSTR_LIST(reducehours, "reducehours", "duration for nighttemp", "Dauer Nachttemp.", "Duur nachtverlaging", "Timmar Nattsänkning") +MAKE_PSTR_LIST(reduceminutes, "reduceminutes", "remaining time for nightmode", "Restzeit Nachttemp.", "Resterende tijd nachtverlaging", "Återstående Tid Nattläge") +MAKE_PSTR_LIST(switchonoptimization, "switchonoptimization", "switch-on optimization", "Einschaltoptimierung", "Inschakeloptimalisering", "Växlingsoptimering") // heatpump -MAKE_PSTR_LIST(airHumidity, F("airhumidity"), F("relative air humidity"), F("relative Luftfeuchte"), F("Relatieve luchtvochtigheid"), F("Relativ Luftfuktighet")) -MAKE_PSTR_LIST(dewTemperature, F("dewtemperature"), F("dew point temperature"), F("Taupunkttemperatur"), F("Dauwpunttemperatuur"), F("Daggpunkt")) +MAKE_PSTR_LIST(airHumidity, "airhumidity", "relative air humidity", "relative Luftfeuchte", "Relatieve luchtvochtigheid", "Relativ Luftfuktighet") +MAKE_PSTR_LIST(dewTemperature, "dewtemperature", "dew point temperature", "Taupunkttemperatur", "Dauwpunttemperatuur", "Daggpunkt") // mixer -MAKE_PSTR_LIST(flowSetTemp, - F("flowsettemp"), - F("setpoint flow temperature"), - F("Sollwert Vorlauftemperatur"), - F("Streefwaarde aanvoertemperatuur"), - F("Vald flödestemperatur")) -MAKE_PSTR_LIST(flowTempHc, - F("flowtemphc"), - F("flow temperature (TC1)"), - F("Vorlauftemperatur HK (TC1)"), - F("Aanvoertemperatuut circuit (TC1)"), - F("Flödestemperatur (TC1)")) -MAKE_PSTR_LIST(pumpStatus, F("pumpstatus"), F("pump status (PC1)"), F("Pumpenstatus HK (PC1)"), F("pompstatus circuit (PC1)"), F("Pumpstatus (PC1)")) -MAKE_PSTR_LIST(mixerStatus, - F("valvestatus"), - F("mixing valve actuator (VC1)"), - F("Mischerventil Position (VC1)"), - F("positie mixerklep (VC1)"), - F("Shuntventil Status (VC1)")) +MAKE_PSTR_LIST(flowSetTemp, "flowsettemp", "setpoint flow temperature", "Sollwert Vorlauftemperatur", "Streefwaarde aanvoertemperatuur", "Vald flödestemperatur") +MAKE_PSTR_LIST(flowTempHc, "flowtemphc", "flow temperature (TC1)", "Vorlauftemperatur HK (TC1)", "Aanvoertemperatuut circuit (TC1)", "Flödestemperatur (TC1)") +MAKE_PSTR_LIST(pumpStatus, "pumpstatus", "pump status (PC1)", "Pumpenstatus HK (PC1)", "pompstatus circuit (PC1)", "Pumpstatus (PC1)") +MAKE_PSTR_LIST(mixerStatus, "valvestatus", "mixing valve actuator (VC1)", "Mischerventil Position (VC1)", "positie mixerklep (VC1)", "Shuntventil Status (VC1)") MAKE_PSTR_LIST(flowTempVf, - F("flowtempvf"), - F("flow temperature in header (T0/Vf)"), - F("Vorlauftemperatur am Verteiler (T0/Vf)"), - F("aanvoertemperatuur verdeler (T0/Vf)"), - F("Flödestemperatur Fördelare (T0/Vf)")) -MAKE_PSTR_LIST(mixerSetTime, F("valvesettime"), F("time to set valve"), F("Zeit zum Einstellen des Ventils"), F("Inschakeltijd mengklep"), F("Inställningstid Ventil")) + "flowtempvf", + "flow temperature in header (T0/Vf)", + "Vorlauftemperatur am Verteiler (T0/Vf)", + "aanvoertemperatuur verdeler (T0/Vf)", + "Flödestemperatur Fördelare (T0/Vf)") +MAKE_PSTR_LIST(mixerSetTime, "valvesettime", "time to set valve", "Zeit zum Einstellen des Ventils", "Inschakeltijd mengklep", "Inställningstid Ventil") // mixer prefixed with wwc MAKE_PSTR_LIST(wwPumpStatus, - F("pumpstatus"), - F("pump status in assigned wwc (PC1)"), - F("Pumpenstatus des wwk (PC1)"), - F("Pompstatus in WW circuit (PC1)"), - F("Pumpstatus i VV-krets (PC1)")) + "pumpstatus", + "pump status in assigned wwc (PC1)", + "Pumpenstatus des wwk (PC1)", + "Pompstatus in WW circuit (PC1)", + "Pumpstatus i VV-krets (PC1)") MAKE_PSTR_LIST(wwTempStatus, - F("wwtempstatus"), - F("temperature switch in assigned wwc (MC1)"), - F("Temperaturschalter des wwk (MC1)"), - F("Temperatuurschakeling in WW circuit (MC1)"), - F("Temperaturventil i VV-krets (MC1)")) -MAKE_PSTR_LIST(wwTemp, F("wwtemp"), F("current temperature"), F("aktuelle Temperatur"), F("huidige temperatuur"), F("Aktuell Temperatur")) + "wwtempstatus", + "temperature switch in assigned wwc (MC1)", + "Temperaturschalter des wwk (MC1)", + "Temperatuurschakeling in WW circuit (MC1)", + "Temperaturventil i VV-krets (MC1)") +MAKE_PSTR_LIST(wwTemp, "wwtemp", "current temperature", "aktuelle Temperatur", "huidige temperatuur", "Aktuell Temperatur") // mixer pool -MAKE_PSTR_LIST(poolSetTemp, F("poolsettemp"), F("pool set temperature"), F("Pool Solltemperatur"), F("Streeftemperatuur zwembad"), F("Pool Temperatur Börvärde")) -MAKE_PSTR_LIST(poolTemp, F("pooltemp"), F("pool temperature"), F("Pool Temperatur"), F("Zwembadtemperatuur"), F("Pooltemperatur")) +MAKE_PSTR_LIST(poolSetTemp, "poolsettemp", "pool set temperature", "Pool Solltemperatur", "Streeftemperatuur zwembad", "Pool Temperatur Börvärde") +MAKE_PSTR_LIST(poolTemp, "pooltemp", "pool temperature", "Pool Temperatur", "Zwembadtemperatuur", "Pooltemperatur") MAKE_PSTR_LIST(poolShuntStatus, - F("poolshuntstatus"), - F("pool shunt status opening/closing"), - F("Pool Ventil öffnen/schließen"), - F("Zwembadklep status openen/sluiten"), - F("Pool Shunt-status öppnen/stängd")) -MAKE_PSTR_LIST(poolShunt, - F("poolshunt"), - F("pool shunt open/close (0% = pool / 100% = heat)"), - F("Pool Ventil Öffnung"), - F("Mengklep zwembad stand"), - F("Pool Shunt Öppen/Stängd")) -MAKE_PSTR_LIST(hydrTemp, F("hydrTemp"), F("hydraulic header temperature"), F("Verteilertemperatur"), F("Temperatuur open verdeler"), F("Fördelartemperatur")) + "poolshuntstatus", + "pool shunt status opening/closing", + "Pool Ventil öffnen/schließen", + "Zwembadklep status openen/sluiten", + "Pool Shunt-status öppnen/stängd") +MAKE_PSTR_LIST(poolShunt, "poolshunt", "pool shunt open/close (0% = pool / 100% = heat)", "Pool Ventil Öffnung", "Mengklep zwembad stand", "Pool Shunt Öppen/Stängd") +MAKE_PSTR_LIST(hydrTemp, "hydrTemp", "hydraulic header temperature", "Verteilertemperatur", "Temperatuur open verdeler", "Fördelartemperatur") // solar MAKE_PSTR_LIST(cylMiddleTemp, - F("cylmiddletemp"), - F("cylinder middle temperature (TS3)"), - F("Speichertemperatur Mitte (TS3)"), - F("Zonneboilertemperatuur midden (TS3)"), - F("Cylindertemperatur Mitten (TS3)")) + "cylmiddletemp", + "cylinder middle temperature (TS3)", + "Speichertemperatur Mitte (TS3)", + "Zonneboilertemperatuur midden (TS3)", + "Cylindertemperatur Mitten (TS3)") MAKE_PSTR_LIST(retHeatAssist, - F("retheatassist"), - F("return temperature heat assistance (TS4)"), - F("Rücklaufanhebungs-Temp. (TS4)"), - F("Retourtemperatuur verwarmingsassistentie (TS4)"), - F("Returtemperatur värmestöd (TS4)")) + "retheatassist", + "return temperature heat assistance (TS4)", + "Rücklaufanhebungs-Temp. (TS4)", + "Retourtemperatuur verwarmingsassistentie (TS4)", + "Returtemperatur värmestöd (TS4)") MAKE_PSTR_LIST(m1Valve, - F("heatassistvalve"), - F("heat assistance valve (M1)"), - F("Ventil Heizungsunterstützung (M1)"), - F("Klep verwarmingsassistentie (M1)"), - F("Uppvärmningsstöd Ventil (M1)")) + "heatassistvalve", + "heat assistance valve (M1)", + "Ventil Heizungsunterstützung (M1)", + "Klep verwarmingsassistentie (M1)", + "Uppvärmningsstöd Ventil (M1)") MAKE_PSTR_LIST(m1Power, - F("heatassistpower"), - F("heat assistance valve power (M1)"), - F("Ventilleistung Heizungsunterstützung (M1)"), - F("Vermogen klep verwarmingsassistentie (M1)"), - F("Uppvärmningsstöd Ventil Effekt (M1)")) -MAKE_PSTR_LIST(pumpMinMod, F("pumpminmod"), F("minimum pump modulation"), F("minimale Pumpenmodulation"), F("Minimale pompmodulatie"), F("Min Pumpmodulering")) -MAKE_PSTR_LIST(maxFlow, F("maxflow"), F("maximum solar flow"), F("maximaler Durchfluss"), F("Maximale doorstroom solar"), F("Max Flöde Solpanel")) -MAKE_PSTR_LIST(solarPower, F("solarpower"), F("actual solar power"), F("aktuelle Solarleistung"), F("Huidig solar vermogen"), F("Aktuellt Sol-effekt")) -MAKE_PSTR_LIST(solarPumpTurnonDiff, - F("turnondiff"), - F("pump turn on difference"), - F("Einschalthysterese Pumpe"), - F("Inschakelhysterese pomp"), - F("Aktiveringshysteres Pump")) -MAKE_PSTR_LIST(solarPumpTurnoffDiff, - F("turnoffdiff"), - F("pump turn off difference"), - F("Ausschalthysterese Pumpe"), - F("Uitschakelhysterese pomp"), - F("Avslagshysteres Pump")) -MAKE_PSTR_LIST(pump2MinMod, - F("pump2minmod"), - F("minimum pump 2 modulation"), - F("minimale Modulation Pumpe 2"), - F("Minimale modulatie pomp 2"), - F("Min Modulering Pump 2")) -MAKE_PSTR_LIST(solarPump2TurnonDiff, - F("turnondiff2"), - F("pump 2 turn on difference"), - F("Einschalthysterese Pumpe 2"), - F("Inschakelhysterese pomp 2"), - F("Aktiveringshysteres Pump 2")) -MAKE_PSTR_LIST(solarPump2TurnoffDiff, - F("turnoffdiff2"), - F("pump 2 turn off difference"), - F("Ausschalthysterese Pumpe 2"), - F("Uitschakelhysterese pomp 2"), - F("Avslagshysteres Pump 2")) + "heatassistpower", + "heat assistance valve power (M1)", + "Ventilleistung Heizungsunterstützung (M1)", + "Vermogen klep verwarmingsassistentie (M1)", + "Uppvärmningsstöd Ventil Effekt (M1)") +MAKE_PSTR_LIST(pumpMinMod, "pumpminmod", "minimum pump modulation", "minimale Pumpenmodulation", "Minimale pompmodulatie", "Min Pumpmodulering") +MAKE_PSTR_LIST(maxFlow, "maxflow", "maximum solar flow", "maximaler Durchfluss", "Maximale doorstroom solar", "Max Flöde Solpanel") +MAKE_PSTR_LIST(solarPower, "solarpower", "actual solar power", "aktuelle Solarleistung", "Huidig solar vermogen", "Aktuellt Sol-effekt") +MAKE_PSTR_LIST(solarPumpTurnonDiff, "turnondiff", "pump turn on difference", "Einschalthysterese Pumpe", "Inschakelhysterese pomp", "Aktiveringshysteres Pump") +MAKE_PSTR_LIST(solarPumpTurnoffDiff, "turnoffdiff", "pump turn off difference", "Ausschalthysterese Pumpe", "Uitschakelhysterese pomp", "Avslagshysteres Pump") +MAKE_PSTR_LIST(pump2MinMod, "pump2minmod", "minimum pump 2 modulation", "minimale Modulation Pumpe 2", "Minimale modulatie pomp 2", "Min Modulering Pump 2") +MAKE_PSTR_LIST(solarPump2TurnonDiff, "turnondiff2", "pump 2 turn on difference", "Einschalthysterese Pumpe 2", "Inschakelhysterese pomp 2", "Aktiveringshysteres Pump 2") +MAKE_PSTR_LIST(solarPump2TurnoffDiff, "turnoffdiff2", "pump 2 turn off difference", "Ausschalthysterese Pumpe 2", "Uitschakelhysterese pomp 2", "Avslagshysteres Pump 2") -MAKE_PSTR_LIST(collectorTemp, - F("collectortemp"), - F("collector temperature (TS1)"), - F("Kollektortemperatur (TS1)"), - F("Collectortemperatuur (TS1)"), - F("Kollektor Temperatur (TS1)")) +MAKE_PSTR_LIST(collectorTemp, "collectortemp", "collector temperature (TS1)", "Kollektortemperatur (TS1)", "Collectortemperatuur (TS1)", "Kollektor Temperatur (TS1)") MAKE_PSTR_LIST(collector2Temp, - F("collector2temp"), - F("collector 2 temperature (TS7)"), - F("Kollector 2 Temperatur (TS7)"), - F("Collector 2 temperatuur (TS7)"), - F("Kollektor 2 Temperatur (TS7)")) + "collector2temp", + "collector 2 temperature (TS7)", + "Kollector 2 Temperatur (TS7)", + "Collector 2 temperatuur (TS7)", + "Kollektor 2 Temperatur (TS7)") MAKE_PSTR_LIST(cylBottomTemp, - F("cylbottomtemp"), - F("cylinder bottom temperature (TS2)"), - F("Speicher Bodentemperatur (TS2)"), - F("Bodemtemperatuur zonneboiler (TS2)"), - F("Cylindertemperatur Botten (TS2)")) + "cylbottomtemp", + "cylinder bottom temperature (TS2)", + "Speicher Bodentemperatur (TS2)", + "Bodemtemperatuur zonneboiler (TS2)", + "Cylindertemperatur Botten (TS2)") MAKE_PSTR_LIST(cyl2BottomTemp, - F("cyl2bottomtemp"), - F("second cylinder bottom temperature (TS5)"), - F("2. Speicher Bodentemperatur (TS5)"), - F("Bodemtemperatuur 2e boiler"), - F("Sekundär Cylindertemperatur Botten (TS5)")) + "cyl2bottomtemp", + "second cylinder bottom temperature (TS5)", + "2. Speicher Bodentemperatur (TS5)", + "Bodemtemperatuur 2e boiler", + "Sekundär Cylindertemperatur Botten (TS5)") MAKE_PSTR_LIST(heatExchangerTemp, - F("heatexchangertemp"), - F("heat exchanger temperature (TS6)"), - F("wärmetauscher Temperatur (TS6)"), - F("Temperatuur warmtewisselaar (TS6)"), - F("Värmeväxlare Temperatur (TS6)")) + "heatexchangertemp", + "heat exchanger temperature (TS6)", + "wärmetauscher Temperatur (TS6)", + "Temperatuur warmtewisselaar (TS6)", + "Värmeväxlare Temperatur (TS6)") MAKE_PSTR_LIST(collectorMaxTemp, - F("collectormaxtemp"), - F("maximum collector temperature"), - F("maximale Kollektortemperatur"), - F("Maximale collectortemperatuur"), - F("Max Kollektortemperatur")) + "collectormaxtemp", + "maximum collector temperature", + "maximale Kollektortemperatur", + "Maximale collectortemperatuur", + "Max Kollektortemperatur") MAKE_PSTR_LIST(collectorMinTemp, - F("collectormintemp"), - F("minimum collector temperature"), - F("minimale Kollektortemperatur"), - F("Minimale collectortemperatuur"), - F("Min Kollektortemperatur")) -MAKE_PSTR_LIST(cylMaxTemp, - F("cylmaxtemp"), - F("maximum cylinder temperature"), - F("maximale Speichertemperatur"), - F("maximale temperatuur zonneboiler"), - F("Max Cylindertemperatur")) -MAKE_PSTR_LIST(solarPumpMod, F("solarpumpmod"), F("pump modulation (PS1)"), F("Pumpenmodulation (PS1)"), F("Pompmodulatie (PS1)"), F("Pumpmodulering (PS1)")) + "collectormintemp", + "minimum collector temperature", + "minimale Kollektortemperatur", + "Minimale collectortemperatuur", + "Min Kollektortemperatur") +MAKE_PSTR_LIST(cylMaxTemp, "cylmaxtemp", "maximum cylinder temperature", "maximale Speichertemperatur", "maximale temperatuur zonneboiler", "Max Cylindertemperatur") +MAKE_PSTR_LIST(solarPumpMod, "solarpumpmod", "pump modulation (PS1)", "Pumpenmodulation (PS1)", "Pompmodulatie (PS1)", "Pumpmodulering (PS1)") MAKE_PSTR_LIST(cylPumpMod, - F("cylpumpmod"), - F("cylinder pump modulation (PS5)"), - F("Speicherpumpenmodulation (PS5)"), - F("Modulatie zonneboilerpomp (PS5)"), - F("Cylinderpumpmodulering (PS5)")) -MAKE_PSTR_LIST(solarPump, F("solarpump"), F("pump (PS1)"), F("Pumpe (PS1)"), F("Pomp (PS1)"), F("Pump (PS1)")) -MAKE_PSTR_LIST(solarPump2, F("solarpump2"), F("pump 2 (PS4)"), F("Pumpe 2 (PS4)"), F("Pomp 2 (PS4)"), F("Pump 2 (PS4)")) -MAKE_PSTR_LIST(solarPump2Mod, - F("solarpump2mod"), - F("pump 2 modulation (PS4)"), - F("Pumpe 2 Modulation (PS4)"), - F("Modulatie pomp 2 (PS4)"), - F("Pump 2 Modulering (PS4)")) -MAKE_PSTR_LIST(valveStatus, F("valvestatus"), F("valve status"), F("Ventilstatus"), F("Klepstatus"), F("Ventilstatus")) -MAKE_PSTR_LIST(cylHeated, F("cylheated"), F("cyl heated"), F("Speichertemperatur erreicht"), F("Boilertemperatuur behaald"), F("Värmepanna Uppvärmd")) -MAKE_PSTR_LIST(collectorShutdown, F("collectorshutdown"), F("collector shutdown"), F("Kollektorabschaltung"), F("Collector afschakeling"), F("Kollektor Avstängning")) -MAKE_PSTR_LIST(pumpWorkTime, F("pumpworktime"), F("pump working time"), F("Pumpenlaufzeit"), F("Pomplooptijd"), F("Pump Drifttid")) -MAKE_PSTR_LIST(pump2WorkTime, F("pump2worktime"), F("pump 2 working time"), F("Pumpe 2 Laufzeit"), F("Looptijd pomp 2"), F("Pump 2 Drifttid")) + "cylpumpmod", + "cylinder pump modulation (PS5)", + "Speicherpumpenmodulation (PS5)", + "Modulatie zonneboilerpomp (PS5)", + "Cylinderpumpmodulering (PS5)") +MAKE_PSTR_LIST(solarPump, "solarpump", "pump (PS1)", "Pumpe (PS1)", "Pomp (PS1)", "Pump (PS1)") +MAKE_PSTR_LIST(solarPump2, "solarpump2", "pump 2 (PS4)", "Pumpe 2 (PS4)", "Pomp 2 (PS4)", "Pump 2 (PS4)") +MAKE_PSTR_LIST(solarPump2Mod, "solarpump2mod", "pump 2 modulation (PS4)", "Pumpe 2 Modulation (PS4)", "Modulatie pomp 2 (PS4)", "Pump 2 Modulering (PS4)") +MAKE_PSTR_LIST(valveStatus, "valvestatus", "valve status", "Ventilstatus", "Klepstatus", "Ventilstatus") +MAKE_PSTR_LIST(cylHeated, "cylheated", "cyl heated", "Speichertemperatur erreicht", "Boilertemperatuur behaald", "Värmepanna Uppvärmd") +MAKE_PSTR_LIST(collectorShutdown, "collectorshutdown", "collector shutdown", "Kollektorabschaltung", "Collector afschakeling", "Kollektor Avstängning") +MAKE_PSTR_LIST(pumpWorkTime, "pumpworktime", "pump working time", "Pumpenlaufzeit", "Pomplooptijd", "Pump Drifttid") +MAKE_PSTR_LIST(pump2WorkTime, "pump2worktime", "pump 2 working time", "Pumpe 2 Laufzeit", "Looptijd pomp 2", "Pump 2 Drifttid") MAKE_PSTR_LIST(m1WorkTime, - F("m1worktime"), - F("differential control working time"), - F("Differenzregelung Arbeitszeit"), - F("Verschilregeling arbeidstijd"), - F("Differentialreglering Drifttid")) -MAKE_PSTR_LIST(energyLastHour, F("energylasthour"), F("energy last hour"), F("Energie letzte Std"), F("Energie laatste uur"), F("Energi Senaste Timmen")) -MAKE_PSTR_LIST(energyTotal, F("energytotal"), F("total energy"), F("Gesamtenergie"), F("Totale energie"), F("Total Energi")) -MAKE_PSTR_LIST(energyToday, F("energytoday"), F("total energy today"), F("Energie heute"), F("Energie vandaag"), F("Total Energi Idag")) + "m1worktime", + "differential control working time", + "Differenzregelung Arbeitszeit", + "Verschilregeling arbeidstijd", + "Differentialreglering Drifttid") +MAKE_PSTR_LIST(energyLastHour, "energylasthour", "energy last hour", "Energie letzte Std", "Energie laatste uur", "Energi Senaste Timmen") +MAKE_PSTR_LIST(energyTotal, "energytotal", "total energy", "Gesamtenergie", "Totale energie", "Total Energi") +MAKE_PSTR_LIST(energyToday, "energytoday", "total energy today", "Energie heute", "Energie vandaag", "Total Energi Idag") // solar ww -MAKE_PSTR_LIST(wwTemp1, F("wwtemp1"), F("temperature 1"), F("Temperatur 1"), F("Temperatuur 1"), F("Temperatur 1")) -MAKE_PSTR_LIST(wwTemp3, F("wwtemp3"), F("temperature 3"), F("Temperatur 3"), F("Temperatuur 2"), F("Temperatur 2")) -MAKE_PSTR_LIST(wwTemp4, F("wwtemp4"), F("temperature 4"), F("Temperatur 4"), F("Temperatuur 3"), F("Temperatur 3")) -MAKE_PSTR_LIST(wwTemp5, F("wwtemp5"), F("temperature 5"), F("Temperatur 5"), F("Temperatuur 5"), F("Temperatur 4")) -MAKE_PSTR_LIST(wwTemp7, F("wwtemp7"), F("temperature 7"), F("Temperatur 7"), F("Temperatuur 7"), F("Temperatur 5")) -MAKE_PSTR_LIST(wwPump, F("wwpump"), F("pump"), F("Pumpe"), F("Pomp"), F("Pump")) +MAKE_PSTR_LIST(wwTemp1, "wwtemp1", "temperature 1", "Temperatur 1", "Temperatuur 1", "Temperatur 1") +MAKE_PSTR_LIST(wwTemp3, "wwtemp3", "temperature 3", "Temperatur 3", "Temperatuur 2", "Temperatur 2") +MAKE_PSTR_LIST(wwTemp4, "wwtemp4", "temperature 4", "Temperatur 4", "Temperatuur 3", "Temperatur 3") +MAKE_PSTR_LIST(wwTemp5, "wwtemp5", "temperature 5", "Temperatur 5", "Temperatuur 5", "Temperatur 4") +MAKE_PSTR_LIST(wwTemp7, "wwtemp7", "temperature 7", "Temperatur 7", "Temperatuur 7", "Temperatur 5") +MAKE_PSTR_LIST(wwPump, "wwpump", "pump", "Pumpe", "Pomp", "Pump") // solar ww and mixer wwc -MAKE_PSTR_LIST(wwMinTemp, F("wwmintemp"), F("minimum temperature"), F("minimale Temperatur"), F("Minimale temperatuur"), F("Min Temperatur")) -MAKE_PSTR_LIST(wwRedTemp, F("wwredtemp"), F("reduced temperature"), F("reduzierte Temperatur"), F("Gereduceerde temperatuur"), F("Reducerad Temperatur")) -MAKE_PSTR_LIST(wwDailyTemp, F("wwdailytemp"), F("daily temperature"), F("tägl. Temperatur"), F("Dagelijkse temperatuur"), F("Daglig temperatur")) -MAKE_PSTR_LIST(wwKeepWarm, F("wwkeepwarm"), F("keep warm"), F("Warmhalten"), F("Warm houde"), F("Varmhållning")) -MAKE_PSTR_LIST(wwStatus2, F("wwstatus2"), F("status 2"), F("Status 2"), F("Status 2"), F("Status 2")) -MAKE_PSTR_LIST(wwPumpMod, F("wwpumpmod"), F("pump modulation"), F("Pumpen Modulation"), F("Pompmodulatie"), F("Pumpmodulering")) -MAKE_PSTR_LIST(wwFlow, F("wwflow"), F("flow rate"), F("Volumenstrom"), F("Doorstroomsnelheid"), F("Flöde")) +MAKE_PSTR_LIST(wwMinTemp, "wwmintemp", "minimum temperature", "minimale Temperatur", "Minimale temperatuur", "Min Temperatur") +MAKE_PSTR_LIST(wwRedTemp, "wwredtemp", "reduced temperature", "reduzierte Temperatur", "Gereduceerde temperatuur", "Reducerad Temperatur") +MAKE_PSTR_LIST(wwDailyTemp, "wwdailytemp", "daily temperature", "tägl. Temperatur", "Dagelijkse temperatuur", "Daglig temperatur") +MAKE_PSTR_LIST(wwKeepWarm, "wwkeepwarm", "keep warm", "Warmhalten", "Warm houde", "Varmhållning") +MAKE_PSTR_LIST(wwStatus2, "wwstatus2", "status 2", "Status 2", "Status 2", "Status 2") +MAKE_PSTR_LIST(wwPumpMod, "wwpumpmod", "pump modulation", "Pumpen Modulation", "Pompmodulatie", "Pumpmodulering") +MAKE_PSTR_LIST(wwFlow, "wwflow", "flow rate", "Volumenstrom", "Doorstroomsnelheid", "Flöde") // extra mixer ww -MAKE_PSTR_LIST(wwRequiredTemp, F("wwrequiredtemp"), F("required temperature"), F("benötigte Temperatur"), F("Benodigde temperatuur"), F("Nödvändig Temperatur")) +MAKE_PSTR_LIST(wwRequiredTemp, "wwrequiredtemp", "required temperature", "benötigte Temperatur", "Benodigde temperatuur", "Nödvändig Temperatur") MAKE_PSTR_LIST(wwDiffTemp, - F("wwdifftemp"), - F("start differential temperature"), - F("Start Differential Temperatur"), - F("Start differentiele temperatuur"), - F("Start Differentialtemperatur")) + "wwdifftemp", + "start differential temperature", + "Start Differential Temperatur", + "Start differentiele temperatuur", + "Start Differentialtemperatur") // SM100 -MAKE_PSTR_LIST(heatTransferSystem, - F("heattransfersystem"), - F("heattransfer system"), - F("Wärmeübertragungs-System"), - F("Warmteoverdrachtssysteem"), - F("Värmeöverföringssystem")) -MAKE_PSTR_LIST(externalCyl, F("externalcyl"), F("external cylinder"), F("Externer Speicher"), F("Externe boiler"), F("Extern Cylinder")) -MAKE_PSTR_LIST(thermalDisinfect, F("thermaldisinfect"), F("thermal disinfection"), F("Thermische Desinfektion"), F("Thermische desinfectie"), F("Termisk Desinfektion")) -MAKE_PSTR_LIST(heatMetering, F("heatmetering"), F("heatmetering"), F("Wärmemessung"), F("warmtemeting"), F("Värmemätning")) -MAKE_PSTR_LIST(solarIsEnabled, F("solarenabled"), F("solarmodule enabled"), F("Solarmodul aktiviert"), F("Solarmodule geactiveerd"), F("Solmodul Aktiverad")) +MAKE_PSTR_LIST(heatTransferSystem, "heattransfersystem", "heattransfer system", "Wärmeübertragungs-System", "Warmteoverdrachtssysteem", "Värmeöverföringssystem") +MAKE_PSTR_LIST(externalCyl, "externalcyl", "external cylinder", "Externer Speicher", "Externe boiler", "Extern Cylinder") +MAKE_PSTR_LIST(thermalDisinfect, "thermaldisinfect", "thermal disinfection", "Thermische Desinfektion", "Thermische desinfectie", "Termisk Desinfektion") +MAKE_PSTR_LIST(heatMetering, "heatmetering", "heatmetering", "Wärmemessung", "warmtemeting", "Värmemätning") +MAKE_PSTR_LIST(solarIsEnabled, "solarenabled", "solarmodule enabled", "Solarmodul aktiviert", "Solarmodule geactiveerd", "Solmodul Aktiverad") // telegram 0x035A -MAKE_PSTR_LIST(solarPumpMode, F("solarpumpmode"), F("pump mode"), F("Solar Pumpen Einst."), F("Modus zonneboilerpomp"), F("Sol Pumpläge")) -MAKE_PSTR_LIST(solarPumpKick, F("pumpkick"), F("pump kick"), F("Röhrenkollektorfunktion"), F("Modus buizencollector"), F("Sol Kollektorfunktion")) -MAKE_PSTR_LIST(plainWaterMode, F("plainwatermode"), F("plain water mode"), F("Südeuropafunktion"), F("Modus Zuid-Europa"), F("Sydeuropa-funktion")) -MAKE_PSTR_LIST(doubleMatchFlow, F("doublematchflow"), F("doublematchflow"), F("Double Match Flow"), F("Double Match Flow"), F("Dubbelmatchning Flöde")) -MAKE_PSTR_LIST(solarPump2Mode, F("pump2mode"), F("pump 2 mode"), F("Pumpe 2 Modus"), F("Modus pomp 2"), F("Pump 2 Läge")) -MAKE_PSTR_LIST(solarPump2Kick, F("pump2kick"), F("pump kick 2"), F("Pumpe 2 Startboost"), F("Startboost pomp 2"), F("Pump 2 Kollektorfunktion")) +MAKE_PSTR_LIST(solarPumpMode, "solarpumpmode", "pump mode", "Solar Pumpen Einst.", "Modus zonneboilerpomp", "Sol Pumpläge") +MAKE_PSTR_LIST(solarPumpKick, "pumpkick", "pump kick", "Röhrenkollektorfunktion", "Modus buizencollector", "Sol Kollektorfunktion") +MAKE_PSTR_LIST(plainWaterMode, "plainwatermode", "plain water mode", "Südeuropafunktion", "Modus Zuid-Europa", "Sydeuropa-funktion") +MAKE_PSTR_LIST(doubleMatchFlow, "doublematchflow", "doublematchflow", "Double Match Flow", "Double Match Flow", "Dubbelmatchning Flöde") +MAKE_PSTR_LIST(solarPump2Mode, "pump2mode", "pump 2 mode", "Pumpe 2 Modus", "Modus pomp 2", "Pump 2 Läge") +MAKE_PSTR_LIST(solarPump2Kick, "pump2kick", "pump kick 2", "Pumpe 2 Startboost", "Startboost pomp 2", "Pump 2 Kollektorfunktion") // telegram 0x035F -MAKE_PSTR_LIST(cylPriority, F("cylpriority"), F("cylinder priority"), F("Speicher Priorität"), F("Prioriteit boiler"), F("Cylinderprioritering")) +MAKE_PSTR_LIST(cylPriority, "cylpriority", "cylinder priority", "Speicher Priorität", "Prioriteit boiler", "Cylinderprioritering") // telegram 0x380 -MAKE_PSTR_LIST(climateZone, F("climatezone"), F("climate zone"), F("Klimazone"), F("klimaatzone"), F("Klimatzon")) -MAKE_PSTR_LIST(collector1Area, F("collector1area"), F("collector 1 area"), F("Kollektor 1 Fläche"), F("oppervlakte collector 1"), F("Kollektor 1 Area")) -MAKE_PSTR_LIST(collector1Type, F("collector1type"), F("collector 1 type"), F("Kollektor 1 Typ"), F("Type collector 1"), F("Kollektor 1 Typ")) -MAKE_PSTR_LIST(collector2Area, F("collector2area"), F("collector 2 area"), F("Kollektor 2 Fläche"), F("Oppervlakte collector 2"), F("Kollektor 2 Area")) -MAKE_PSTR_LIST(collector2Type, F("collector2type"), F("collector 2 type"), F("Kollektor 2 Typ"), F("Type collector 2"), F("Kollektor 2 Typ")) +MAKE_PSTR_LIST(climateZone, "climatezone", "climate zone", "Klimazone", "klimaatzone", "Klimatzon") +MAKE_PSTR_LIST(collector1Area, "collector1area", "collector 1 area", "Kollektor 1 Fläche", "oppervlakte collector 1", "Kollektor 1 Area") +MAKE_PSTR_LIST(collector1Type, "collector1type", "collector 1 type", "Kollektor 1 Typ", "Type collector 1", "Kollektor 1 Typ") +MAKE_PSTR_LIST(collector2Area, "collector2area", "collector 2 area", "Kollektor 2 Fläche", "Oppervlakte collector 2", "Kollektor 2 Area") +MAKE_PSTR_LIST(collector2Type, "collector2type", "collector 2 type", "Kollektor 2 Typ", "Type collector 2", "Kollektor 2 Typ") // telegram 0x0363 heatCounter MAKE_PSTR_LIST(heatCntFlowTemp, - F("heatcntflowtemp"), - F("heat counter flow temperature"), - F("Wärmezähler Vorlauf-Temperatur"), - F("Aanvoertemperatuur warmteenergiemeter"), - F("Värmeräknare Flödestemperatur")) + "heatcntflowtemp", + "heat counter flow temperature", + "Wärmezähler Vorlauf-Temperatur", + "Aanvoertemperatuur warmteenergiemeter", + "Värmeräknare Flödestemperatur") MAKE_PSTR_LIST(heatCntRetTemp, - F("heatcntrettemp"), - F("heat counter return temperature"), - F("Wärmezähler Rücklauf-Temperatur"), - F("Retourtemperatuur warmteenergiemeter"), - F("Värmeräknare Returtemperatur")) -MAKE_PSTR_LIST(heatCnt, F("heatcnt"), F("heat counter impulses"), F("Wärmezähler Impulse"), F("Warmteenergiemeter pulsen"), F("Värmeräknare Impuls")) + "heatcntrettemp", + "heat counter return temperature", + "Wärmezähler Rücklauf-Temperatur", + "Retourtemperatuur warmteenergiemeter", + "Värmeräknare Returtemperatur") +MAKE_PSTR_LIST(heatCnt, "heatcnt", "heat counter impulses", "Wärmezähler Impulse", "Warmteenergiemeter pulsen", "Värmeräknare Impuls") MAKE_PSTR_LIST(swapFlowTemp, - F("swapflowtemp"), - F("swap flow temperature (TS14)"), - F("Austausch Vorlauf-Temperatur (TS14)"), - F("Aanvoertemperatuur verwisselaar (TS14)"), - F("Växlingstemperatur Flöde (TS14)")) + "swapflowtemp", + "swap flow temperature (TS14)", + "Austausch Vorlauf-Temperatur (TS14)", + "Aanvoertemperatuur verwisselaar (TS14)", + "Växlingstemperatur Flöde (TS14)") MAKE_PSTR_LIST(swapRetTemp, - F("swaprettemp"), - F("swap return temperature (TS15)"), - F("Austausch Rücklauf-Temperatur (TS15)"), - F("Retourtemperatuur verwisselaar (TS15)"), - F("Växlingstemperatur Returflöde (TS15)")) + "swaprettemp", + "swap return temperature (TS15)", + "Austausch Rücklauf-Temperatur (TS15)", + "Retourtemperatuur verwisselaar (TS15)", + "Växlingstemperatur Returflöde (TS15)") // switch -MAKE_PSTR_LIST(activated, F("activated"), F("activated"), F("Aktiviert"), F("Geactiveerd"), F("Aktiverad")) -MAKE_PSTR_LIST(status, F("status"), F("status"), F("Status"), F("Status"), F("Status")) +MAKE_PSTR_LIST(activated, "activated", "activated", "Aktiviert", "Geactiveerd", "Aktiverad") +MAKE_PSTR_LIST(status, "status", "status", "Status", "Status", "Status") // RF sensor, id 0x40, telegram 0x435 -MAKE_PSTR_LIST(RFTemp, F("rftemp"), F("RF room temperature sensor"), F("RF Raumtemperatur Sensor"), F("RF ruimtetemperatuur sensor"), F("RF Rumsgivare Temp")) +MAKE_PSTR_LIST(RFTemp, "rftemp", "RF room temperature sensor", "RF Raumtemperatur Sensor", "RF ruimtetemperatuur sensor", "RF Rumsgivare Temp") /* // unknown fields to track (SM10), only for testing // **** NO TRANSLATION NEEDED **** -MAKE_PSTR_LIST(data11, F("data11"), F("unknown datafield 11")) -MAKE_PSTR_LIST(data12, F("data12"), F("unknown datafield 12")) -MAKE_PSTR_LIST(data8, F("data8"), F("unknown datafield 8")) -MAKE_PSTR_LIST(data0, F("data0"), F("unknown datafield 0")) -MAKE_PSTR_LIST(data1, F("data1"), F("unknown datafield 1")) -MAKE_PSTR_LIST(setting3, F("setting3"), F("unknown setting 3")) -MAKE_PSTR_LIST(setting4, F("setting4"), F("unknown setting 4")) +MAKE_PSTR_LIST(data11, "data11", "unknown datafield 11") +MAKE_PSTR_LIST(data12, "data12", "unknown datafield 12") +MAKE_PSTR_LIST(data8, "data8", "unknown datafield 8") +MAKE_PSTR_LIST(data0, "data0", "unknown datafield 0") +MAKE_PSTR_LIST(data1, "data1", "unknown datafield 1") +MAKE_PSTR_LIST(setting3, "setting3", "unknown setting 3") +MAKE_PSTR_LIST(setting4, "setting4", "unknown setting 4") */ diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 0ed29ea09..1b17f41ae 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -186,26 +186,26 @@ void Mqtt::loop() { // print MQTT log and other stuff to console void Mqtt::show_mqtt(uuid::console::Shell & shell) { - shell.printfln(F("MQTT is %s"), connected() ? read_flash_string(F_(connected)).c_str() : read_flash_string(F_(disconnected)).c_str()); + shell.printfln(("MQTT is %s"), connected() ? F_(connected) : F_(disconnected)); - shell.printfln(F("MQTT publish errors: %lu"), mqtt_publish_fails_); + shell.printfln(("MQTT publish errors: %lu"), mqtt_publish_fails_); shell.println(); // show subscriptions - shell.printfln(F("MQTT topic subscriptions:")); + shell.printfln(("MQTT topic subscriptions:")); for (const auto & mqtt_subfunction : mqtt_subfunctions_) { - shell.printfln(F(" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str()); + shell.printfln((" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str()); } shell.println(); // show queues if (mqtt_messages_.empty()) { - shell.printfln(F("MQTT queue is empty")); + shell.printfln(("MQTT queue is empty")); shell.println(); return; } - shell.printfln(F("MQTT queue (%d/%d messages):"), mqtt_messages_.size(), MAX_MQTT_MESSAGES); + shell.printfln(("MQTT queue (%d/%d messages):"), mqtt_messages_.size(), MAX_MQTT_MESSAGES); for (const auto & message : mqtt_messages_) { auto content = message.content_; @@ -222,12 +222,12 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) { // Publish messages if (message.retry_count_ == 0) { if (message.packet_id_ == 0) { - shell.printfln(F(" [%02d] (Pub) topic=%s payload=%s"), message.id_, topic, content->payload.c_str()); + shell.printfln((" [%02d] (Pub) topic=%s payload=%s"), message.id_, topic, content->payload.c_str()); } else { - shell.printfln(F(" [%02d] (Pub) topic=%s payload=%s (pid %d)"), message.id_, topic, content->payload.c_str(), message.packet_id_); + shell.printfln((" [%02d] (Pub) topic=%s payload=%s (pid %d)"), message.id_, topic, content->payload.c_str(), message.packet_id_); } } else { - shell.printfln(F(" [%02d] (Pub) topic=%s payload=%s (pid %d, retry #%d)"), + shell.printfln((" [%02d] (Pub) topic=%s payload=%s (pid %d, retry #%d)"), message.id_, topic, content->payload.c_str(), @@ -236,7 +236,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) { } } else { // Subscribe messages - shell.printfln(F(" [%02d] (Sub) topic=%s"), message.id_, topic); + shell.printfln((" [%02d] (Sub) topic=%s"), message.id_, topic); } } shell.println(); @@ -264,16 +264,16 @@ void Mqtt::on_message(const char * topic, const char * payload, size_t len) cons #if defined(EMSESP_DEBUG) if (len) { - LOG_DEBUG(F("Received topic `%s` => payload `%s` (length %d)"), topic, message, len); + LOG_DEBUG(("Received topic `%s` => payload `%s` (length %d)"), topic, message, len); } else { - LOG_DEBUG(F("Received topic `%s`"), topic); + LOG_DEBUG(("Received topic `%s`"), topic); } #endif // remove HA topics if we don't use discovery if (strncmp(topic, discovery_prefix().c_str(), discovery_prefix().size()) == 0) { if (!ha_enabled_ && len) { // don't ping pong the empty message queue_publish_message(topic, "", true); - LOG_DEBUG(F("Remove topic %s"), topic); + LOG_DEBUG(("Remove topic %s"), topic); } return; } @@ -285,7 +285,7 @@ void Mqtt::on_message(const char * topic, const char * payload, size_t len) cons snprintf(full_topic, sizeof(full_topic), "%s/%s", mqtt_base_.c_str(), mf.topic_.c_str()); if ((!strcmp(topic, full_topic)) && (mf.mqtt_subfunction_)) { if (!(mf.mqtt_subfunction_)(message)) { - LOG_ERROR(F("error: invalid payload %s for this topic %s"), message, topic); + LOG_ERROR(("error: invalid payload %s for this topic %s"), message, topic); if (send_response_) { Mqtt::publish(F_(response), "error: invalid data"); } @@ -341,10 +341,10 @@ void Mqtt::show_topic_handlers(uuid::console::Shell & shell, const uint8_t devic return; } - // shell.print(F(" Subscribed MQTT topics: ")); + // shell.print((" Subscribed MQTT topics: ")); // for (const auto & mqtt_subfunction : mqtt_subfunctions_) { // if (mqtt_subfunction.device_type_ == device_type) { - // shell.printf(F("%s "), mqtt_subfunction.topic_.c_str()); + // shell.printf(("%s "), mqtt_subfunction.topic_.c_str()); // } // } shell.println(); @@ -358,7 +358,7 @@ void Mqtt::on_publish(uint16_t packetId) const { // find the MQTT message in the queue and remove it if (mqtt_messages_.empty()) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] No message stored for ACK pid %d"), packetId); + LOG_DEBUG(("[DEBUG] No message stored for ACK pid %d"), packetId); #endif return; } @@ -368,18 +368,18 @@ void Mqtt::on_publish(uint16_t packetId) const { // if the last published failed, don't bother checking it. wait for the next retry if (mqtt_message.packet_id_ == 0) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] ACK for failed message pid 0")); + LOG_DEBUG(("[DEBUG] ACK for failed message pid 0")); #endif return; } if (mqtt_message.packet_id_ != packetId) { - LOG_ERROR(F("Mismatch, expecting PID %d, got %d"), mqtt_message.packet_id_, packetId); + LOG_ERROR(("Mismatch, expecting PID %d, got %d"), mqtt_message.packet_id_, packetId); mqtt_publish_fails_++; // increment error count } #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] ACK pid %d"), packetId); + LOG_DEBUG(("[DEBUG] ACK pid %d"), packetId); #endif mqtt_messages_.pop_front(); // always remove from queue, regardless if there was a successful ACK @@ -450,17 +450,17 @@ void Mqtt::start() { } connecting_ = false; if (reason == AsyncMqttClientDisconnectReason::TCP_DISCONNECTED) { - LOG_WARNING(F("MQTT disconnected: TCP")); + LOG_WARNING(("MQTT disconnected: TCP")); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_IDENTIFIER_REJECTED) { - LOG_WARNING(F("MQTT disconnected: Identifier Rejected")); + LOG_WARNING(("MQTT disconnected: Identifier Rejected")); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_SERVER_UNAVAILABLE) { - LOG_WARNING(F("MQTT disconnected: Server unavailable")); + LOG_WARNING(("MQTT disconnected: Server unavailable")); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_MALFORMED_CREDENTIALS) { - LOG_WARNING(F("MQTT disconnected: Malformed credentials")); + LOG_WARNING(("MQTT disconnected: Malformed credentials")); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_NOT_AUTHORIZED) { - LOG_WARNING(F("MQTT disconnected: Not authorized")); + LOG_WARNING(("MQTT disconnected: Not authorized")); } else { - LOG_WARNING(F("MQTT disconnected: code %d"), reason); + LOG_WARNING(("MQTT disconnected: code %d"), reason); } }); @@ -535,7 +535,7 @@ void Mqtt::on_connect() { return; } - LOG_INFO(F("MQTT connected")); + LOG_INFO(("MQTT connected")); connecting_ = true; connectcount_++; @@ -554,7 +554,7 @@ void Mqtt::on_connect() { doc["version"] = EMSESP_APP_VERSION; #ifndef EMSESP_STANDALONE if (WiFi.status() == WL_CONNECTED) { - doc["connection"] = F("WiFi"); + doc["connection"] = ("WiFi"); doc["hostname"] = WiFi.getHostname(); doc["SSID"] = WiFi.SSID(); doc["BSSID"] = WiFi.BSSIDstr(); @@ -567,7 +567,7 @@ void Mqtt::on_connect() { doc["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6()); } } else if (EMSESP::system_.ethernet_connected()) { - doc["connection"] = F("Ethernet"); + doc["connection"] = ("Ethernet"); doc["hostname"] = ETH.getHostname(); doc["MAC"] = ETH.macAddress(); doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask()); @@ -600,7 +600,7 @@ void Mqtt::on_connect() { // re-subscribe to all custom registered MQTT topics resubscribe(); - publish_retain(F("status"), "online", true); // say we're alive to the Last Will topic, with retain on + publish_retain(("status"), "online", true); // say we're alive to the Last Will topic, with retain on mqtt_publish_fails_ = 0; // reset fail count to 0 @@ -609,7 +609,7 @@ void Mqtt::on_connect() { LOG_INFO("Queue size: %d", mqtt_messages_.size()); for (const auto & message : mqtt_messages_) { auto content = message.content_; - LOG_INFO(F(" [%02d] (%d) topic=%s payload=%s"), message.id_, content->operation, content->topic.c_str(), content->payload.c_str()); + LOG_INFO((" [%02d] (%d) topic=%s payload=%s"), message.id_, content->operation, content->topic.c_str(), content->payload.c_str()); } */ } @@ -644,19 +644,19 @@ void Mqtt::ha_status() { // create the sensors - must match the MQTT payload keys if (!EMSESP::system_.ethernet_connected()) { - publish_system_ha_sensor_config(DeviceValueType::INT, F("WiFi RSSI"), F("rssi"), DeviceValueUOM::DBM); - publish_system_ha_sensor_config(DeviceValueType::INT, F("WiFi strength"), F("wifistrength"), DeviceValueUOM::PERCENT); + publish_system_ha_sensor_config(DeviceValueType::INT, ("WiFi RSSI"), ("rssi"), DeviceValueUOM::DBM); + publish_system_ha_sensor_config(DeviceValueType::INT, ("WiFi strength"), ("wifistrength"), DeviceValueUOM::PERCENT); } - publish_system_ha_sensor_config(DeviceValueType::INT, F("Uptime"), F("uptime"), DeviceValueUOM::NONE); - publish_system_ha_sensor_config(DeviceValueType::INT, F("Uptime (sec)"), F("uptime_sec"), DeviceValueUOM::SECONDS); - publish_system_ha_sensor_config(DeviceValueType::BOOL, F("NTP status"), F("ntp_status"), DeviceValueUOM::NONE); - publish_system_ha_sensor_config(DeviceValueType::INT, F("Free memory"), F("freemem"), DeviceValueUOM::KB); - publish_system_ha_sensor_config(DeviceValueType::INT, F("MQTT fails"), F("mqttfails"), DeviceValueUOM::NONE); - publish_system_ha_sensor_config(DeviceValueType::INT, F("Rx received"), F("rxreceived"), DeviceValueUOM::NONE); - publish_system_ha_sensor_config(DeviceValueType::INT, F("Rx fails"), F("rxfails"), DeviceValueUOM::NONE); - publish_system_ha_sensor_config(DeviceValueType::INT, F("Tx reads"), F("txreads"), DeviceValueUOM::NONE); - publish_system_ha_sensor_config(DeviceValueType::INT, F("Tx writes"), F("txwrites"), DeviceValueUOM::NONE); - publish_system_ha_sensor_config(DeviceValueType::INT, F("Tx fails"), F("txfails"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Uptime"), ("uptime"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Uptime (sec)"), ("uptime_sec"), DeviceValueUOM::SECONDS); + publish_system_ha_sensor_config(DeviceValueType::BOOL, ("NTP status"), ("ntp_status"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Free memory"), ("freemem"), DeviceValueUOM::KB); + publish_system_ha_sensor_config(DeviceValueType::INT, ("MQTT fails"), ("mqttfails"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Rx received"), ("rxreceived"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Rx fails"), ("rxfails"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Tx reads"), ("txreads"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Tx writes"), ("txwrites"), DeviceValueUOM::NONE); + publish_system_ha_sensor_config(DeviceValueType::INT, ("Tx fails"), ("txfails"), DeviceValueUOM::NONE); } // add sub or pub task to the queue. @@ -686,7 +686,7 @@ std::shared_ptr Mqtt::queue_message(const uint8_t operation, // if the queue is full, make room but removing the last one if (mqtt_messages_.size() >= MAX_MQTT_MESSAGES) { mqtt_messages_.pop_front(); - LOG_WARNING(F("Queue overflow, removing one message")); + LOG_WARNING(("Queue overflow, removing one message")); mqtt_publish_fails_++; } mqtt_messages_.emplace_back(mqtt_message_id_++, std::move(message)); @@ -718,17 +718,17 @@ void Mqtt::publish(const std::string & topic, const std::string & payload) { } // MQTT Publish, using a user's retain flag - except for char * strings -void Mqtt::publish(const __FlashStringHelper * topic, const char * payload) { - queue_publish_message(read_flash_string(topic), payload, mqtt_retain_); +void Mqtt::publish(const char * topic, const char * payload) { + queue_publish_message((topic), payload, mqtt_retain_); } // MQTT Publish, using a specific retain flag, topic is a flash string -void Mqtt::publish(const __FlashStringHelper * topic, const std::string & payload) { - queue_publish_message(read_flash_string(topic), payload, mqtt_retain_); +void Mqtt::publish(const char * topic, const std::string & payload) { + queue_publish_message((topic), payload, mqtt_retain_); } -void Mqtt::publish(const __FlashStringHelper * topic, const JsonObject & payload) { - publish(read_flash_string(topic), payload); +void Mqtt::publish(const char * topic, const JsonObject & payload) { + publish_retain(topic, payload, mqtt_retain_); } // publish json doc, only if its not empty @@ -737,12 +737,16 @@ void Mqtt::publish(const std::string & topic, const JsonObject & payload) { } // MQTT Publish, using a specific retain flag, topic is a flash string, forcing retain flag -void Mqtt::publish_retain(const __FlashStringHelper * topic, const std::string & payload, bool retain) { - queue_publish_message(read_flash_string(topic), payload, retain); +void Mqtt::publish_retain(const char * topic, const std::string & payload, bool retain) { + queue_publish_message((topic), payload, retain); } // publish json doc, only if its not empty, using the retain flag void Mqtt::publish_retain(const std::string & topic, const JsonObject & payload, bool retain) { + publish_retain(topic.c_str(), payload, retain); +} + +void Mqtt::publish_retain(const char * topic, const JsonObject & payload, bool retain) { if (enabled() && payload.size()) { std::string payload_text; serializeJson(payload, payload_text); // convert json to string @@ -750,12 +754,8 @@ void Mqtt::publish_retain(const std::string & topic, const JsonObject & payload, } } -void Mqtt::publish_retain(const __FlashStringHelper * topic, const JsonObject & payload, bool retain) { - publish_retain(read_flash_string(topic), payload, retain); -} - -void Mqtt::publish_ha(const __FlashStringHelper * topic, const JsonObject & payload) { - publish_ha(read_flash_string(topic), payload); +void Mqtt::publish_ha(const char * topic, const JsonObject & payload) { + publish_ha((topic), payload); } // publish empty payload to remove the topic @@ -766,7 +766,7 @@ void Mqtt::publish_ha(const std::string & topic) { std::string fulltopic = Mqtt::discovery_prefix() + topic; #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] Publishing empty HA topic=%s"), fulltopic.c_str()); + LOG_DEBUG(("[DEBUG] Publishing empty HA topic=%s"), fulltopic.c_str()); #endif queue_publish_message(fulltopic, "", true); // publish with retain to remove from broker @@ -784,9 +784,9 @@ void Mqtt::publish_ha(const std::string & topic, const JsonObject & payload) { std::string fulltopic = Mqtt::discovery_prefix() + topic; #if defined(EMSESP_STANDALONE) - LOG_DEBUG(F("Publishing HA topic=%s, payload=%s"), fulltopic.c_str(), payload_text.c_str()); + LOG_DEBUG(("Publishing HA topic=%s, payload=%s"), fulltopic.c_str(), payload_text.c_str()); #elif defined(EMSESP_DEBUG) - LOG_DEBUG(F("[debug] Publishing HA topic=%s, payload=%s"), fulltopic.c_str(), payload_text.c_str()); + LOG_DEBUG(("[debug] Publishing HA topic=%s, payload=%s"), fulltopic.c_str(), payload_text.c_str()); #endif // queue messages if the MQTT connection is not yet established. to ensure we don't miss messages @@ -815,7 +815,7 @@ void Mqtt::process_queue() { // it will have a real packet ID if (mqtt_message.packet_id_ > 0) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] Waiting for QOS-ACK")); + LOG_DEBUG(("[DEBUG] Waiting for QOS-ACK")); #endif // if we don't get the ack within 10 minutes, republish with new packet_id if (uuid::get_uptime_sec() - last_publish_queue_ < 600) { @@ -826,13 +826,13 @@ void Mqtt::process_queue() { // if we're subscribing... if (message->operation == Operation::SUBSCRIBE) { - LOG_DEBUG(F("Subscribing to topic '%s'"), topic); + LOG_DEBUG(("Subscribing to topic '%s'"), topic); uint16_t packet_id = mqttClient_->subscribe(topic, mqtt_qos_); if (!packet_id) { if (++mqtt_messages_.front().retry_count_ < MQTT_PUBLISH_MAX_RETRY) { return; } - LOG_ERROR(F("Error subscribing to topic '%s'"), topic); + LOG_ERROR(("Error subscribing to topic '%s'"), topic); mqtt_publish_fails_++; // increment failure counter } @@ -843,13 +843,13 @@ void Mqtt::process_queue() { // if we're unsubscribing... if (message->operation == Operation::UNSUBSCRIBE) { - LOG_DEBUG(F("Subscribing to topic '%s'"), topic); + LOG_DEBUG(("Subscribing to topic '%s'"), topic); uint16_t packet_id = mqttClient_->unsubscribe(topic); if (!packet_id) { if (++mqtt_messages_.front().retry_count_ < MQTT_PUBLISH_MAX_RETRY) { return; } - LOG_ERROR(F("Error unsubscribing to topic '%s'"), topic); + LOG_ERROR(("Error unsubscribing to topic '%s'"), topic); mqtt_publish_fails_++; // increment failure counter } @@ -860,7 +860,7 @@ void Mqtt::process_queue() { // else try and publish it uint16_t packet_id = mqttClient_->publish(topic, mqtt_qos_, message->retain, message->payload.c_str(), message->payload.size(), false, mqtt_message.id_); - LOG_DEBUG(F("Publishing topic %s (#%02d, retain=%d, retry=%d, size=%d, pid=%d)"), + LOG_DEBUG(("Publishing topic %s (#%02d, retain=%d, retry=%d, size=%d, pid=%d)"), topic, mqtt_message.id_, message->retain, @@ -871,14 +871,14 @@ void Mqtt::process_queue() { if (packet_id == 0) { // it failed. if we retried n times, give up. remove from queue if (mqtt_message.retry_count_ == (MQTT_PUBLISH_MAX_RETRY - 1)) { - LOG_ERROR(F("Failed to publish to %s after %d attempts"), topic, mqtt_message.retry_count_ + 1); + LOG_ERROR(("Failed to publish to %s after %d attempts"), topic, mqtt_message.retry_count_ + 1); mqtt_publish_fails_++; // increment failure counter mqtt_messages_.pop_front(); // delete return; } else { // update the record mqtt_messages_.front().retry_count_++; - LOG_DEBUG(F("Failed to publish to %s. Trying again, #%d"), topic, mqtt_message.retry_count_ + 1); + LOG_DEBUG(("Failed to publish to %s. Trying again, #%d"), topic, mqtt_message.retry_count_ + 1); return; // leave on queue for next time so it gets republished } } @@ -888,7 +888,7 @@ void Mqtt::process_queue() { if (mqtt_qos_ != 0) { mqtt_messages_.front().packet_id_ = packet_id; #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] Setting packetID for ACK to %d"), packet_id); + LOG_DEBUG(("[DEBUG] Setting packetID for ACK to %d"), packet_id); #endif return; } @@ -942,14 +942,14 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model, } // publish HA sensor for System using the heartbeat tag -void Mqtt::publish_system_ha_sensor_config(uint8_t type, const __FlashStringHelper * name, const __FlashStringHelper * entity, const uint8_t uom) { +void Mqtt::publish_system_ha_sensor_config(uint8_t type, const char * name, const char * entity, const uint8_t uom) { StaticJsonDocument doc; JsonObject dev_json = doc.createNestedObject("dev"); JsonArray ids = dev_json.createNestedArray("ids"); ids.add("ems-esp"); - auto fullname = read_flash_string(name); + auto fullname = (name); // TODO is this needed? publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, fullname, name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, nullptr, 0, 0, 0, dev_json); } @@ -957,20 +957,20 @@ void Mqtt::publish_system_ha_sensor_config(uint8_t type, const __FlashStringHelp // MQTT discovery configs // entity must match the key/value pair in the *_data topic // note: some extra string copying done here, it looks messy but does help with heap fragmentation issues -void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice::DeviceValueType - uint8_t tag, // EMSdevice::DeviceValueTAG - const std::string & fullname, // fullname, already translated - const __FlashStringHelper * const en_name, - const uint8_t device_type, // EMSdevice::DeviceType - const __FlashStringHelper * const entity, // same as shortname - const uint8_t uom, // EMSdevice::DeviceValueUOM (0=NONE) - const bool remove, // true if we want to remove this topic - const bool has_cmd, - const __FlashStringHelper * const ** options, - uint8_t options_size, - const int16_t dv_set_min, - const int16_t dv_set_max, - const JsonObject & dev_json) { +void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice::DeviceValueType + uint8_t tag, // EMSdevice::DeviceValueTAG + const std::string & fullname, // fullname, already translated + const char * const en_name, + const uint8_t device_type, // EMSdevice::DeviceType + const char * const entity, // same as shortname + const uint8_t uom, // EMSdevice::DeviceValueUOM (0=NONE) + const bool remove, // true if we want to remove this topic + const bool has_cmd, + const char * const ** options, + uint8_t options_size, + const int16_t dv_set_min, + const int16_t dv_set_max, + const JsonObject & dev_json) { // ignore if name (fullname) is empty if (fullname.empty() || en_name == nullptr) { return; @@ -983,9 +983,9 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // create entity by add the hc/wwc tag if present, separating with a . char new_entity[50]; if (tag >= DeviceValueTAG::TAG_HC1) { - snprintf(new_entity, sizeof(new_entity), "%s.%s", EMSdevice::tag_to_string(tag).c_str(), read_flash_string(entity).c_str()); + snprintf(new_entity, sizeof(new_entity), "%s.%s", EMSdevice::tag_to_string(tag).c_str(), (entity)); } else { - snprintf(new_entity, sizeof(new_entity), "%s", read_flash_string(entity).c_str()); + snprintf(new_entity, sizeof(new_entity), "%s", (entity)); } // build unique identifier which will be used in the topic, replacing all . with _ as not to break HA @@ -1037,7 +1037,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // if we're asking to remove this topic, send an empty payload and exit // https://github.com/emsesp/EMS-ESP32/issues/196 if (remove) { - LOG_DEBUG(F("Removing HA config for %s"), uniq); + LOG_DEBUG(("Removing HA config for %s"), uniq); publish_ha(topic); return; } @@ -1123,11 +1123,9 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // keep it compatible to v3.4, use english fullname, no prefix (basename prefix commmented out) char object_id[130]; if (have_tag) { - // snprintf(object_id, sizeof(object_id), "%s_%s_%s_%s", mqtt_basename_, device_name, EMSdevice::tag_to_string(tag).c_str(), read_flash_string(en_name).c_str()); - snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), read_flash_string(en_name).c_str()); + snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), (en_name)); } else { - // snprintf(object_id, sizeof(object_id), "%s_%s_%s", mqtt_basename_, device_name, read_flash_string(en_name).c_str()); - snprintf(object_id, sizeof(object_id), "%s_%s", device_name, read_flash_string(en_name).c_str()); + snprintf(object_id, sizeof(object_id), "%s_%s", device_name, (en_name)); } doc["object_id"] = object_id; @@ -1137,7 +1135,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, if (is_nested()) { snprintf(val_tpl, sizeof(val_tpl), "{{value_json.%s}}", new_entity); } else { - snprintf(val_tpl, sizeof(val_tpl), "{{value_json.%s}}", read_flash_string(entity).c_str()); + snprintf(val_tpl, sizeof(val_tpl), "{{value_json.%s}}", (entity)); } doc["val_tpl"] = val_tpl; @@ -1147,9 +1145,9 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // and has no unit of measure or icon if (type == DeviceValueType::BOOL) { char result[10]; - doc[F("payload_on")] = Helpers::render_boolean(result, true); - doc[F("payload_off")] = Helpers::render_boolean(result, false); - doc[sc_ha] = F_(measurement); + doc[("payload_on")] = Helpers::render_boolean(result, true); + doc[("payload_off")] = Helpers::render_boolean(result, false); + doc[sc_ha] = F_(measurement); } else { // always set the uom if (uom != DeviceValueUOM::NONE) { @@ -1169,11 +1167,11 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, case DeviceValueUOM::DEGREES: case DeviceValueUOM::DEGREES_R: doc[sc_ha] = F_(measurement); - doc[dc_ha] = F("temperature"); // no icon needed + doc[dc_ha] = ("temperature"); // no icon needed break; case DeviceValueUOM::PERCENT: doc[sc_ha] = F_(measurement); - doc[dc_ha] = F("power_factor"); // no icon needed + doc[dc_ha] = ("power_factor"); // no icon needed break; case DeviceValueUOM::SECONDS: case DeviceValueUOM::MINUTES: @@ -1198,11 +1196,11 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, } else { doc[sc_ha] = F_(measurement); } - doc[dc_ha] = F("energy"); // no icon needed + doc[dc_ha] = ("energy"); // no icon needed break; case DeviceValueUOM::KWH: doc[sc_ha] = F_(total_increasing); - doc[dc_ha] = F("energy"); // no icon needed + doc[dc_ha] = ("energy"); // no icon needed break; case DeviceValueUOM::UA: doc[ic_ha] = F_(iconua); @@ -1210,16 +1208,16 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, break; case DeviceValueUOM::BAR: doc[sc_ha] = F_(measurement); - doc[dc_ha] = F("pressure"); + doc[dc_ha] = ("pressure"); break; case DeviceValueUOM::W: case DeviceValueUOM::KW: doc[sc_ha] = F_(measurement); - doc[dc_ha] = F("power"); + doc[dc_ha] = ("power"); break; case DeviceValueUOM::DBM: doc[sc_ha] = F_(measurement); - doc[dc_ha] = F("signal_strength"); + doc[dc_ha] = ("signal_strength"); break; case DeviceValueUOM::NONE: // for device entities which have numerical values, with no UOM diff --git a/src/mqtt.h b/src/mqtt.h index 26cfb51dc..94584369e 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -79,35 +79,35 @@ class Mqtt { static void resubscribe(); static void publish(const std::string & topic, const std::string & payload); - static void publish(const __FlashStringHelper * topic, const char * payload); + static void publish(const char * topic, const char * payload); static void publish(const std::string & topic, const JsonObject & payload); - static void publish(const __FlashStringHelper * topic, const JsonObject & payload); - static void publish(const __FlashStringHelper * topic, const std::string & payload); + static void publish(const char * topic, const JsonObject & payload); + static void publish(const char * topic, const std::string & payload); static void publish_retain(const std::string & topic, const JsonObject & payload, bool retain); - static void publish_retain(const __FlashStringHelper * topic, const std::string & payload, bool retain); - static void publish_retain(const __FlashStringHelper * topic, const JsonObject & payload, bool retain); + static void publish_retain(const char * topic, const std::string & payload, bool retain); + static void publish_retain(const char * topic, const JsonObject & payload, bool retain); static void publish_ha(const std::string & topic, const JsonObject & payload); - static void publish_ha(const __FlashStringHelper * topic, const JsonObject & payload); + static void publish_ha(const char * topic, const JsonObject & payload); static void publish_ha(const std::string & topic); static void publish_ha_sensor_config(DeviceValue & dv, const std::string & model, const std::string & brand, const bool remove, const bool create_device_config = false); - static void publish_ha_sensor_config(uint8_t type, - uint8_t tag, - const std::string & fullname, - const __FlashStringHelper * const en_name, - const uint8_t device_type, - const __FlashStringHelper * const entity, - const uint8_t uom, - const bool remove, - const bool has_cmd, - const __FlashStringHelper * const ** options, - uint8_t options_size, - const int16_t dv_set_min, - const int16_t dv_set_max, - const JsonObject & dev_json); + static void publish_ha_sensor_config(uint8_t type, + uint8_t tag, + const std::string & fullname, + const char * const en_name, + const uint8_t device_type, + const char * const entity, + const uint8_t uom, + const bool remove, + const bool has_cmd, + const char * const ** options, + uint8_t options_size, + const int16_t dv_set_min, + const int16_t dv_set_max, + const JsonObject & dev_json); - static void publish_system_ha_sensor_config(uint8_t type, const __FlashStringHelper * name, const __FlashStringHelper * entity, const uint8_t uom); + static void publish_system_ha_sensor_config(uint8_t type, const char * name, const char * entity, const uint8_t uom); static void publish_ha_climate_config(uint8_t tag, bool has_roomtemp, bool remove = false); static void show_topic_handlers(uuid::console::Shell & shell, const uint8_t device_type); diff --git a/src/shower.cpp b/src/shower.cpp index a481cf281..56a98a8d3 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -57,7 +57,7 @@ void Shower::loop() { // first check to see if hot water has been on long enough to be recognized as a Shower/Bath if (!shower_state_ && (time_now - timer_start_) > SHOWER_MIN_DURATION) { set_shower_state(true); - LOG_DEBUG(F("[Shower] hot water still running, starting shower timer")); + LOG_DEBUG(("[Shower] hot water still running, starting shower timer")); } // check if the shower has been on too long else if ((time_now - timer_start_) > shower_alert_trigger_) { @@ -82,8 +82,8 @@ void Shower::loop() { char s[50]; snprintf(s, 50, "%d minutes and %d seconds", (uint8_t)(duration_ / 60000), (uint8_t)((duration_ / 1000) % 60)); doc["duration"] = s; - Mqtt::publish(F("shower_data"), doc.as()); - LOG_DEBUG(F("[Shower] finished with duration %d"), duration_); + Mqtt::publish(("shower_data"), doc.as()); + LOG_DEBUG(("[Shower] finished with duration %d"), duration_); } } @@ -109,7 +109,7 @@ void Shower::loop() { // turn back on the hot water for the shower void Shower::shower_alert_stop() { if (doing_cold_shot_) { - LOG_DEBUG(F("Shower Alert stopped")); + LOG_DEBUG(("Shower Alert stopped")); (void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "true"); doing_cold_shot_ = false; } @@ -117,7 +117,7 @@ void Shower::shower_alert_stop() { // turn off hot water to send a shot of cold void Shower::shower_alert_start() { if (shower_alert_) { - LOG_DEBUG(F("Shower Alert started")); + LOG_DEBUG(("Shower Alert started")); (void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "false"); doing_cold_shot_ = true; alert_timer_start_ = uuid::get_uptime(); // timer starts now @@ -144,7 +144,7 @@ void Shower::set_shower_state(bool state, bool force) { // always publish as a string char s[7]; - Mqtt::publish(F("shower_active"), Helpers::render_boolean(s, shower_state_)); // https://github.com/emsesp/EMS-ESP/issues/369 + Mqtt::publish(("shower_active"), Helpers::render_boolean(s, shower_state_)); // https://github.com/emsesp/EMS-ESP/issues/369 // send out HA MQTT Discovery config topic if ((Mqtt::ha_enabled()) && (!ha_configdone_ || force)) { @@ -158,8 +158,8 @@ void Shower::set_shower_state(bool state, bool force) { // always render boolean as strings for HA char result[10]; - doc[F("payload_on")] = Helpers::render_boolean(result, true); - doc[F("payload_off")] = Helpers::render_boolean(result, false); + doc[("payload_on")] = Helpers::render_boolean(result, true); + doc[("payload_off")] = Helpers::render_boolean(result, false); JsonObject dev = doc.createNestedObject("dev"); JsonArray ids = dev.createNestedArray("ids"); diff --git a/src/system.cpp b/src/system.cpp index 27008e1ae..a78044a21 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -77,19 +77,19 @@ bool System::command_fetch(const char * value, const int8_t id) { std::string value_s; if (Helpers::value2string(value, value_s)) { if (value_s == "all") { - LOG_INFO(F("Requesting data from EMS devices")); + LOG_INFO(("Requesting data from EMS devices")); EMSESP::fetch_device_values(); return true; - } else if (value_s == read_flash_string(F_(boiler))) { + } else if (value_s == (F_(boiler))) { EMSESP::fetch_device_values_type(EMSdevice::DeviceType::BOILER); return true; - } else if (value_s == read_flash_string(F_(thermostat))) { + } else if (value_s == (F_(thermostat))) { EMSESP::fetch_device_values_type(EMSdevice::DeviceType::THERMOSTAT); return true; - } else if (value_s == read_flash_string(F_(solar))) { + } else if (value_s == (F_(solar))) { EMSESP::fetch_device_values_type(EMSdevice::DeviceType::SOLAR); return true; - } else if (value_s == read_flash_string(F_(mixer))) { + } else if (value_s == (F_(mixer))) { EMSESP::fetch_device_values_type(EMSdevice::DeviceType::MIXER); return true; } @@ -105,31 +105,31 @@ bool System::command_publish(const char * value, const int8_t id) { if (Helpers::value2string(value, value_s)) { if (value_s == "ha") { EMSESP::publish_all(true); // includes HA - LOG_INFO(F("Publishing all data to MQTT, including HA configs")); + LOG_INFO(("Publishing all data to MQTT, including HA configs")); return true; - } else if (value_s == read_flash_string(F_(boiler))) { + } else if (value_s == (F_(boiler))) { EMSESP::publish_device_values(EMSdevice::DeviceType::BOILER); return true; - } else if (value_s == read_flash_string(F_(thermostat))) { + } else if (value_s == (F_(thermostat))) { EMSESP::publish_device_values(EMSdevice::DeviceType::THERMOSTAT); return true; - } else if (value_s == read_flash_string(F_(solar))) { + } else if (value_s == (F_(solar))) { EMSESP::publish_device_values(EMSdevice::DeviceType::SOLAR); return true; - } else if (value_s == read_flash_string(F_(mixer))) { + } else if (value_s == (F_(mixer))) { EMSESP::publish_device_values(EMSdevice::DeviceType::MIXER); return true; } else if (value_s == "other") { EMSESP::publish_other_values(); // switch and heat pump return true; - } else if ((value_s == read_flash_string(F_(dallassensor))) || (value_s == read_flash_string(F_(analogsensor)))) { + } else if ((value_s == (F_(dallassensor))) || (value_s == (F_(analogsensor)))) { EMSESP::publish_sensor_values(true); return true; } } EMSESP::publish_all(); - LOG_INFO(F("Publishing all data to MQTT")); + LOG_INFO(("Publishing all data to MQTT")); return true; } @@ -166,11 +166,9 @@ bool System::command_watch(const char * value, const int8_t id) { } if (Mqtt::publish_single() && w != EMSESP::watch()) { if (Mqtt::publish_single2cmd()) { - Mqtt::publish(F("system/watch"), - EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : read_flash_string(FL_(list_watch)[w]).c_str()); + Mqtt::publish(("system/watch"), EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : (FL_(list_watch)[w])); } else { - Mqtt::publish(F("system_data/watch"), - EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : read_flash_string(FL_(list_watch)[w]).c_str()); + Mqtt::publish(("system_data/watch"), EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : (FL_(list_watch)[w])); } } EMSESP::watch(w); @@ -178,9 +176,9 @@ bool System::command_watch(const char * value, const int8_t id) { } else if (i) { if (Mqtt::publish_single() && i != EMSESP::watch_id()) { if (Mqtt::publish_single2cmd()) { - Mqtt::publish(F("system/watch"), Helpers::hextoa(i)); + Mqtt::publish(("system/watch"), Helpers::hextoa(i)); } else { - Mqtt::publish(F("system_data/watch"), Helpers::hextoa(i)); + Mqtt::publish(("system_data/watch"), Helpers::hextoa(i)); } } EMSESP::watch_id(i); @@ -194,7 +192,7 @@ bool System::command_watch(const char * value, const int8_t id) { // restart EMS-ESP void System::system_restart() { - LOG_INFO(F("Restarting EMS-ESP...")); + LOG_INFO(("Restarting EMS-ESP...")); Shell::loop_all(); delay(1000); // wait a second #ifndef EMSESP_STANDALONE @@ -204,7 +202,7 @@ void System::system_restart() { // saves all settings void System::wifi_reconnect() { - LOG_INFO(F("WiFi reconnecting...")); + LOG_INFO(("WiFi reconnecting...")); Shell::loop_all(); EMSESP::console_.loop(); delay(1000); // wait a second @@ -214,7 +212,7 @@ void System::wifi_reconnect() { // format the FS. Wipes everything. void System::format(uuid::console::Shell & shell) { - auto msg = F("Formatting file system. This will reset all settings to their defaults"); + auto msg = ("Formatting file system. This will reset all settings to their defaults"); shell.logger().warning(msg); shell.flush(); @@ -243,7 +241,7 @@ void System::syslog_init() { // start & configure syslog if (!was_enabled) { syslog_.start(); - EMSESP::logger().info(F("Starting Syslog")); + EMSESP::logger().info(("Starting Syslog")); } syslog_.log_level((uuid::log::Level)syslog_level_); syslog_.mark_interval(syslog_mark_interval_); @@ -252,12 +250,12 @@ void System::syslog_init() { // register the command // TODO translate this - Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, F("change the syslog level"), CommandFlag::ADMIN_ONLY); + Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, ("change the syslog level"), CommandFlag::ADMIN_ONLY); } else if (was_enabled) { // in case service is still running, this flushes the queue // https://github.com/emsesp/EMS-ESP/issues/496 - EMSESP::logger().info(F("Stopping Syslog")); + EMSESP::logger().info(("Stopping Syslog")); syslog_.log_level((uuid::log::Level)-1); syslog_.mark_interval(0); syslog_.destination(""); @@ -265,23 +263,21 @@ void System::syslog_init() { if (Mqtt::publish_single()) { if (Mqtt::publish_single2cmd()) { - Mqtt::publish(F("system/syslog"), syslog_enabled_ ? read_flash_string(FL_(list_syslog_level)[syslog_level_ + 1]).c_str() : "off"); + Mqtt::publish(("system/syslog"), syslog_enabled_ ? (FL_(list_syslog_level)[syslog_level_ + 1]) : "off"); if (EMSESP::watch_id() == 0 || EMSESP::watch() == 0) { - Mqtt::publish(F("system/watch"), - EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(EMSESP::watch()) - : read_flash_string(FL_(list_watch)[EMSESP::watch()]).c_str()); + Mqtt::publish(("system/watch"), + EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(EMSESP::watch()) : (FL_(list_watch)[EMSESP::watch()])); } else { - Mqtt::publish(F("system/watch"), Helpers::hextoa(EMSESP::watch_id())); + Mqtt::publish(("system/watch"), Helpers::hextoa(EMSESP::watch_id())); } } else { - Mqtt::publish(F("system_data/syslog"), syslog_enabled_ ? read_flash_string(FL_(list_syslog_level)[syslog_level_ + 1]).c_str() : "off"); + Mqtt::publish(("system_data/syslog"), syslog_enabled_ ? (FL_(list_syslog_level)[syslog_level_ + 1]) : "off"); if (EMSESP::watch_id() == 0 || EMSESP::watch() == 0) { - Mqtt::publish(F("system_data/watch"), - EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(EMSESP::watch()) - : read_flash_string(FL_(list_watch)[EMSESP::watch()]).c_str()); + Mqtt::publish(("system_data/watch"), + EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(EMSESP::watch()) : (FL_(list_watch)[EMSESP::watch()])); } else { - Mqtt::publish(F("system_data/watch"), Helpers::hextoa(EMSESP::watch_id())); + Mqtt::publish(("system_data/watch"), Helpers::hextoa(EMSESP::watch_id())); } } } @@ -348,7 +344,7 @@ void System::wifi_tweak() { WiFi.setSleep(false); // turn off sleep - WIFI_PS_NONE bool s2 = WiFi.getSleep(); #if defined(EMSESP_DEBUG) - LOG_DEBUG(F("[DEBUG] Adjusting WiFi - Tx power %d->%d, Sleep %d->%d"), p1, p2, s1, s2); + LOG_DEBUG(("[DEBUG] Adjusting WiFi - Tx power %d->%d, Sleep %d->%d"), p1, p2, s1, s2); #endif #endif } @@ -403,7 +399,7 @@ void System::start() { // button single click void System::button_OnClick(PButton & b) { - LOG_DEBUG(F("Button pressed - single click")); + LOG_DEBUG(("Button pressed - single click")); #ifdef EMSESP_DEBUG #ifndef EMSESP_STANDALONE @@ -414,20 +410,20 @@ void System::button_OnClick(PButton & b) { // button double click void System::button_OnDblClick(PButton & b) { - LOG_DEBUG(F("Button pressed - double click - reconnect")); + LOG_DEBUG(("Button pressed - double click - reconnect")); EMSESP::system_.wifi_reconnect(); } // button long press void System::button_OnLongPress(PButton & b) { - LOG_DEBUG(F("Button pressed - long press")); + LOG_DEBUG(("Button pressed - long press")); } // button indefinite press void System::button_OnVLongPress(PButton & b) { - LOG_DEBUG(F("Button pressed - very long press")); + LOG_DEBUG(("Button pressed - very long press")); #ifndef EMSESP_STANDALONE - LOG_WARNING(F("Performing factory reset...")); + LOG_WARNING(("Performing factory reset...")); EMSESP::console_.loop(); EMSESP::esp8266React.factoryReset(); #endif @@ -441,12 +437,12 @@ void System::button_init(bool refresh) { if (is_valid_gpio(pbutton_gpio_)) { if (!myPButton_.init(pbutton_gpio_, HIGH)) { - LOG_DEBUG(F("Multi-functional button not detected")); + LOG_DEBUG(("Multi-functional button not detected")); } else { - LOG_DEBUG(F("Multi-functional button enabled")); + LOG_DEBUG(("Multi-functional button enabled")); } } else { - LOG_WARNING(F("Invalid button GPIO. Check config.")); + LOG_WARNING(("Invalid button GPIO. Check config.")); } myPButton_.onClick(BUTTON_Debounce, button_OnClick); @@ -668,25 +664,25 @@ void System::system_check() { // commands - takes static function pointers void System::commands_init() { - // TODO these should be translated too - Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, F("send a telegram"), CommandFlag::ADMIN_ONLY); - Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, F("refresh all EMS values"), CommandFlag::ADMIN_ONLY); - Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, F("restart EMS-ESP"), CommandFlag::ADMIN_ONLY); - Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, F("watch incoming telegrams")); + // TODO translate this + Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, ("send a telegram"), CommandFlag::ADMIN_ONLY); + Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, ("refresh all EMS values"), CommandFlag::ADMIN_ONLY); + Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, ("restart EMS-ESP"), CommandFlag::ADMIN_ONLY); + Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, ("watch incoming telegrams")); // register syslog command in syslog init - // Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, F("set syslog level"), CommandFlag::ADMIN_ONLY); + // Command::add(EMSdevice::DeviceType::SYSTEM, F_(syslog), System::command_syslog_level, ("set syslog level"), CommandFlag::ADMIN_ONLY); if (Mqtt::enabled()) { - Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, F("force a MQTT publish")); + Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, ("force a MQTT publish")); } // these commands will return data in JSON format - Command::add(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, F("show system status")); - Command::add(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, F("fetch system commands")); + Command::add(EMSdevice::DeviceType::SYSTEM, F_(info), System::command_info, ("show system status")); + Command::add(EMSdevice::DeviceType::SYSTEM, F_(commands), System::command_commands, ("fetch system commands")); #if defined(EMSESP_DEBUG) - Command::add(EMSdevice::DeviceType::SYSTEM, F("test"), System::command_test, F("run a specific test")); + Command::add(EMSdevice::DeviceType::SYSTEM, ("test"), System::command_test, ("run a specific test")); #endif // MQTT subscribe "ems-esp/system/#" @@ -776,12 +772,12 @@ int8_t System::wifi_quality(int8_t dBm) { // print users to console void System::show_users(uuid::console::Shell & shell) { - shell.printfln(F("Users:")); + shell.printfln(("Users:")); #ifndef EMSESP_STANDALONE EMSESP::esp8266React.getSecuritySettingsService()->read([&](SecuritySettings & securitySettings) { for (const User & user : securitySettings.users) { - shell.printfln(F(" username: %s, password: %s, is_admin: %s"), user.username.c_str(), user.password.c_str(), user.admin ? F("yes") : F("no")); + shell.printfln((" username: %s, password: %s, is_admin: %s"), user.username.c_str(), user.password.c_str(), user.admin ? ("yes") : ("no")); } }); #endif @@ -791,94 +787,94 @@ void System::show_users(uuid::console::Shell & shell) { void System::show_system(uuid::console::Shell & shell) { shell.println("System:"); - shell.printfln(F(" Board profile: %s"), board_profile().c_str()); - shell.printfln(F(" Uptime: %s"), uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str()); + shell.printfln((" Board profile: %s"), board_profile().c_str()); + shell.printfln((" Uptime: %s"), uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str()); #ifndef EMSESP_STANDALONE - shell.printfln(F(" SDK version: %s"), ESP.getSdkVersion()); - shell.printfln(F(" CPU frequency: %lu MHz"), ESP.getCpuFreqMHz()); - shell.printfln(F(" Free heap: %lu KB"), (uint32_t)ESP.getFreeHeap() / 1024); - shell.printfln(F(" App used/free: %lu KB / %lu KB"), appUsed(), appFree()); + shell.printfln((" SDK version: %s"), ESP.getSdkVersion()); + shell.printfln((" CPU frequency: %lu MHz"), ESP.getCpuFreqMHz()); + shell.printfln((" Free heap: %lu KB"), (uint32_t)ESP.getFreeHeap() / 1024); + shell.printfln((" App used/free: %lu KB / %lu KB"), appUsed(), appFree()); uint32_t FSused = LittleFS.usedBytes() / 1024; - shell.printfln(F(" FS used/free: %lu KB / %lu KB"), FSused, FStotal() - FSused); + shell.printfln((" FS used/free: %lu KB / %lu KB"), FSused, FStotal() - FSused); shell.println(); shell.println("Network:"); switch (WiFi.status()) { case WL_IDLE_STATUS: - shell.printfln(F(" Network: Idle")); + shell.printfln((" Network: Idle")); break; case WL_NO_SSID_AVAIL: - shell.printfln(F(" Network: Network not found")); + shell.printfln((" Network: Network not found")); break; case WL_SCAN_COMPLETED: - shell.printfln(F(" Network: Network scan complete")); + shell.printfln((" Network: Network scan complete")); break; case WL_CONNECTED: - shell.printfln(F(" Network: connected")); - shell.printfln(F(" SSID: %s"), WiFi.SSID().c_str()); - shell.printfln(F(" BSSID: %s"), WiFi.BSSIDstr().c_str()); - shell.printfln(F(" RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI())); - shell.printfln(F(" MAC address: %s"), WiFi.macAddress().c_str()); - shell.printfln(F(" Hostname: %s"), WiFi.getHostname()); - shell.printfln(F(" IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str()); - shell.printfln(F(" IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str()); - shell.printfln(F(" IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str()); + shell.printfln((" Network: connected")); + shell.printfln((" SSID: %s"), WiFi.SSID().c_str()); + shell.printfln((" BSSID: %s"), WiFi.BSSIDstr().c_str()); + shell.printfln((" RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI())); + shell.printfln((" MAC address: %s"), WiFi.macAddress().c_str()); + shell.printfln((" Hostname: %s"), WiFi.getHostname()); + shell.printfln((" IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str()); + shell.printfln((" IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str()); + shell.printfln((" IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str()); if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { - shell.printfln(F(" IPv6 address: %s"), uuid::printable_to_string(WiFi.localIPv6()).c_str()); + shell.printfln((" IPv6 address: %s"), uuid::printable_to_string(WiFi.localIPv6()).c_str()); } break; case WL_CONNECT_FAILED: - shell.printfln(F(" WiFi Network: Connection failed")); + shell.printfln((" WiFi Network: Connection failed")); break; case WL_CONNECTION_LOST: - shell.printfln(F(" WiFi Network: Connection lost")); + shell.printfln((" WiFi Network: Connection lost")); break; case WL_DISCONNECTED: - shell.printfln(F(" WiFi Network: Disconnected")); + shell.printfln((" WiFi Network: Disconnected")); break; case WL_NO_SHIELD: default: - shell.printfln(F(" WiFi Network: Unknown")); + shell.printfln((" WiFi Network: Unknown")); break; } // show Ethernet if connected if (ethernet_connected_) { shell.println(); - shell.printfln(F(" Ethernet Network: connected")); - shell.printfln(F(" MAC address: %s"), ETH.macAddress().c_str()); - shell.printfln(F(" Hostname: %s"), ETH.getHostname()); - shell.printfln(F(" IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str()); - shell.printfln(F(" IPv4 gateway: %s"), uuid::printable_to_string(ETH.gatewayIP()).c_str()); - shell.printfln(F(" IPv4 nameserver: %s"), uuid::printable_to_string(ETH.dnsIP()).c_str()); + shell.printfln((" Ethernet Network: connected")); + shell.printfln((" MAC address: %s"), ETH.macAddress().c_str()); + shell.printfln((" Hostname: %s"), ETH.getHostname()); + shell.printfln((" IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str()); + shell.printfln((" IPv4 gateway: %s"), uuid::printable_to_string(ETH.gatewayIP()).c_str()); + shell.printfln((" IPv4 nameserver: %s"), uuid::printable_to_string(ETH.dnsIP()).c_str()); if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { - shell.printfln(F(" IPv6 address: %s"), uuid::printable_to_string(ETH.localIPv6()).c_str()); + shell.printfln((" IPv6 address: %s"), uuid::printable_to_string(ETH.localIPv6()).c_str()); } } shell.println(); shell.println("Syslog:"); if (!syslog_enabled_) { - shell.printfln(F(" Syslog: disabled")); + shell.printfln((" Syslog: disabled")); } else { - shell.printfln(F(" Syslog: %s"), syslog_.started() ? "started" : "stopped"); - shell.print(F(" ")); - shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : read_flash_string(F_(unset)).c_str()); - shell.printfln(F(" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str()); - shell.print(F(" ")); + shell.printfln((" Syslog: %s"), syslog_.started() ? "started" : "stopped"); + shell.print((" ")); + shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : (F_(unset))); + shell.printfln((" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str()); + shell.print((" ")); shell.printfln(F_(port_fmt), syslog_port_); - shell.print(F(" ")); + shell.print((" ")); shell.printfln(F_(log_level_fmt), uuid::log::format_level_lowercase(static_cast(syslog_level_))); - shell.print(F(" ")); + shell.print((" ")); shell.printfln(F_(mark_interval_fmt), syslog_mark_interval_); - shell.printfln(F(" Queued: %d"), syslog_.queued()); + shell.printfln((" Queued: %d"), syslog_.queued()); } #endif @@ -912,10 +908,10 @@ bool System::check_upgrade() { // it's a customization file, just replace it and there's no need to reboot saveSettings(EMSESP_CUSTOMIZATION_FILE, "Customizations", input); } else { - LOG_ERROR(F("Unrecognized file uploaded")); + LOG_ERROR(("Unrecognized file uploaded")); } } else { - LOG_ERROR(F("Unrecognized file uploaded, not json")); + LOG_ERROR(("Unrecognized file uploaded, not json")); } // close (just in case) and remove the temp file @@ -958,7 +954,7 @@ bool System::saveSettings(const char * filename, const char * section, JsonObjec if (section_json) { File section_file = LittleFS.open(filename, "w"); if (section_file) { - LOG_INFO(F("Applying new %s settings"), section); + LOG_INFO(("Applying new %s settings"), section); serializeJson(section_json, section_file); section_file.close(); return true; // reboot required @@ -988,7 +984,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp // Network Status node = output.createNestedObject("Network Status"); if (WiFi.status() == WL_CONNECTED) { - node["connection"] = F("WiFi"); + node["connection"] = ("WiFi"); node["hostname"] = WiFi.getHostname(); // node["SSID"] = WiFi.SSID(); // node["BSSID"] = WiFi.BSSIDstr(); @@ -1001,7 +997,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp node["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6()); } } else if (EMSESP::system_.ethernet_connected()) { - node["connection"] = F("Ethernet"); + node["connection"] = ("Ethernet"); node["hostname"] = ETH.getHostname(); node["MAC"] = ETH.macAddress(); node["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask()); @@ -1115,20 +1111,20 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp node = output.createNestedObject("Bus Status"); switch (EMSESP::bus_status()) { case EMSESP::BUS_STATUS_OFFLINE: - node["bus status"] = (F("disconnected")); + node["bus status"] = (("disconnected")); break; case EMSESP::BUS_STATUS_TX_ERRORS: - node["bus status"] = (F("connected, tx issues - try a different Tx Mode")); + node["bus status"] = (("connected, tx issues - try a different Tx Mode")); break; case EMSESP::BUS_STATUS_CONNECTED: - node["bus status"] = (F("connected")); + node["bus status"] = (("connected")); break; default: - node["bus status"] = (F("unknown")); + node["bus status"] = (("unknown")); break; } if (EMSESP::bus_status() != EMSESP::BUS_STATUS_OFFLINE) { - node["bus protocol"] = EMSbus::is_ht3() ? F("HT3") : F("Buderus"); + node["bus protocol"] = EMSbus::is_ht3() ? ("HT3") : ("Buderus"); node["bus telegrams received (rx)"] = EMSESP::rxservice_.telegram_count(); node["bus reads (tx)"] = EMSESP::txservice_.telegram_read_count(); node["bus writes (tx)"] = EMSESP::txservice_.telegram_write_count(); @@ -1320,7 +1316,7 @@ std::string System::reset_reason(uint8_t cpu) const { // set NTP status void System::ntp_connected(bool b) { if (b != ntp_connected_) { - LOG_INFO(b ? F("NTP connected") : F("NTP disconnected")); + LOG_INFO(b ? ("NTP connected") : ("NTP disconnected")); } ntp_connected_ = b; ntp_last_check_ = b ? uuid::get_uptime_sec() : 0; diff --git a/src/telegram.cpp b/src/telegram.cpp index f96cdf43e..eb02f3b6d 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -120,7 +120,7 @@ std::string Telegram::to_string() const { // returns telegram's message body only, in hex std::string Telegram::to_string_message() const { if (this->message_length == 0) { - return read_flash_string(F("")); + return (("")); } return Helpers::data_to_hex(this->message_data, this->message_length); @@ -150,9 +150,9 @@ void RxService::add(uint8_t * data, uint8_t length) { if (data[length - 1] != crc) { if ((data[0] & 0x7F) != ems_bus_id()) { // do not count echos as errors telegram_error_count_++; - LOG_WARNING(F("Incomplete Rx: %s"), Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC + LOG_WARNING(("Incomplete Rx: %s"), Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC } else { - LOG_TRACE(F("Incomplete Rx: %s"), Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC + LOG_TRACE(("Incomplete Rx: %s"), Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC } return; } @@ -203,16 +203,16 @@ void RxService::add(uint8_t * data, uint8_t length) { uint16_t trace_watch_id = EMSESP::watch_id(); if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id) || ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) { - LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); + LOG_NOTICE(("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); } else if (EMSESP::trace_raw()) { - LOG_TRACE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE(("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); } } else if (EMSESP::trace_raw()) { - LOG_TRACE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE(("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); } #ifdef EMSESP_DEBUG - LOG_DEBUG(F("[DEBUG] New Rx telegram, message length %d"), message_length); + LOG_DEBUG(("[DEBUG] New Rx telegram, message length %d"), message_length); #endif // if we don't have a type_id exit, @@ -262,7 +262,7 @@ void TxService::start() { // sends a 1 byte poll which is our own deviceID void TxService::send_poll() const { - //LOG_DEBUG(F("Ack %02X"),ems_bus_id() ^ ems_mask()); + //LOG_DEBUG(("Ack %02X"),ems_bus_id() ^ ems_mask()); if (tx_mode()) { EMSuart::send_poll(ems_bus_id() ^ ems_mask()); } @@ -363,13 +363,13 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { // if we're in simulation mode, don't send anything, just quit if (EMSESP::system_.readonly_mode() && (telegram->operation == Telegram::Operation::TX_WRITE)) { - LOG_INFO(F("[readonly] Sending write Tx telegram: %s"), Helpers::data_to_hex(telegram_raw, length - 1).c_str()); + LOG_INFO(("[readonly] Sending write Tx telegram: %s"), Helpers::data_to_hex(telegram_raw, length - 1).c_str()); tx_state(Telegram::Operation::NONE); return; } - LOG_DEBUG(F("Sending %s Tx [#%d], telegram: %s"), - (telegram->operation == Telegram::Operation::TX_WRITE) ? F("write") : F("read"), + LOG_DEBUG(("Sending %s Tx [#%d], telegram: %s"), + (telegram->operation == Telegram::Operation::TX_WRITE) ? ("write") : ("read"), tx_telegram.id_, Helpers::data_to_hex(telegram_raw, length - 1).c_str()); // exclude the last CRC byte @@ -381,7 +381,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { uint16_t status = EMSuart::transmit(telegram_raw, length); if (status == EMS_TX_STATUS_ERR) { - LOG_ERROR(F("Failed to transmit Tx via UART.")); + LOG_ERROR(("Failed to transmit Tx via UART.")); if (telegram->operation == Telegram::Operation::TX_READ) { increment_telegram_read_fail_count(); // another Tx fail } else { @@ -412,7 +412,7 @@ void TxService::send_telegram(const uint8_t * data, const uint8_t length) { uint16_t status = EMSuart::transmit(telegram_raw, length); if (status == EMS_TX_STATUS_ERR) { - LOG_ERROR(F("Failed to transmit Tx via UART.")); + LOG_ERROR(("Failed to transmit Tx via UART.")); increment_telegram_fail_count(); // another Tx fail } } @@ -429,7 +429,7 @@ void TxService::add(const uint8_t operation, auto telegram = std::make_shared(operation, ems_bus_id(), dest, type_id, offset, message_data, message_length); #ifdef EMSESP_DEBUG - LOG_DEBUG(F("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length); + LOG_DEBUG(("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length); #endif // if the queue is full, make room but removing the last one @@ -488,7 +488,7 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt // if we don't have a type_id or empty data block, exit if ((type_id == 0) || (message_length == 0)) { #ifdef EMSESP_DEBUG - LOG_DEBUG(F("[DEBUG] Tx telegram type %d failed, length %d"), type_id, message_length); + LOG_DEBUG(("[DEBUG] Tx telegram type %d failed, length %d"), type_id, message_length); #endif return; } @@ -511,7 +511,7 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt } #ifdef EMSESP_DEBUG - LOG_DEBUG(F("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length); + LOG_DEBUG(("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length); #endif if (front) { @@ -528,7 +528,7 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt // send a Tx telegram to request data from an EMS device void TxService::read_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset, const uint8_t length) { - LOG_DEBUG(F("Tx read request to device 0x%02X for type ID 0x%02X"), dest, type_id); + LOG_DEBUG(("Tx read request to device 0x%02X for type ID 0x%02X"), dest, type_id); uint8_t message_data = (type_id > 0xFF) ? (EMS_MAX_TELEGRAM_MESSAGE_LENGTH - 2) : EMS_MAX_TELEGRAM_MESSAGE_LENGTH; // if length set, publish result and set telegram to front @@ -593,7 +593,7 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui EMSESP::wait_validate(0); // do not wait for validation if (operation == Telegram::Operation::TX_READ) { if (telegram_last_->offset > 0) { // ignore errors for higher offsets - LOG_DEBUG(F("Last Tx Read operation failed after %d retries. Ignoring request: %s"), MAXIMUM_TX_RETRIES, telegram_last_->to_string().c_str()); + LOG_DEBUG(("Last Tx Read operation failed after %d retries. Ignoring request: %s"), MAXIMUM_TX_RETRIES, telegram_last_->to_string().c_str()); return; } increment_telegram_read_fail_count(); // another Tx fail @@ -601,8 +601,8 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui increment_telegram_write_fail_count(); // another Tx fail } - LOG_ERROR(F("Last Tx %s operation failed after %d retries. Ignoring request: %s"), - (operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"), + LOG_ERROR(("Last Tx %s operation failed after %d retries. Ignoring request: %s"), + (operation == Telegram::Operation::TX_WRITE) ? ("Write") : ("Read"), MAXIMUM_TX_RETRIES, telegram_last_->to_string().c_str()); @@ -613,8 +613,8 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui } #ifdef EMSESP_DEBUG - LOG_DEBUG(F("[DEBUG] Last Tx %s operation failed. Retry #%d. sent message: %s, received: %s"), - (operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"), + LOG_DEBUG(("[DEBUG] Last Tx %s operation failed. Retry #%d. sent message: %s, received: %s"), + (operation == Telegram::Operation::TX_WRITE) ? ("Write") : ("Read"), retry_count_, telegram_last_->to_string().c_str(), Helpers::data_to_hex(data, length - 1).c_str()); @@ -665,7 +665,7 @@ uint16_t TxService::post_send_query() { (this->telegram_last_->type_id > 0xFF) ? (EMS_MAX_TELEGRAM_MESSAGE_LENGTH - 2) : EMS_MAX_TELEGRAM_MESSAGE_LENGTH; // request all data, 32 bytes this->add(Telegram::Operation::TX_READ, dest, post_typeid, offset, &message_data, 1, 0, true); // add to top/front of queue // read_request(telegram_last_post_send_query_, dest, 0); // no offset - LOG_DEBUG(F("Sending post validate read, type ID 0x%02X to dest 0x%02X"), post_typeid, dest); + LOG_DEBUG(("Sending post validate read, type ID 0x%02X to dest 0x%02X"), post_typeid, dest); set_post_send_query(0); // reset // delay the request if we have a different type_id for post_send_query delayed_send_ = (this->telegram_last_->type_id == post_typeid) ? 0 : (uuid::get_uptime() + POST_SEND_DELAY); diff --git a/src/test/test.cpp b/src/test/test.cpp index 7652fff36..092a12ca0 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -30,7 +30,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "general") == 0) { - EMSESP::logger().info(F("Testing general. Adding a Boiler and Thermostat")); + EMSESP::logger().info(("Testing general. Adding a Boiler and Thermostat")); add_device(0x08, 123); // Nefit Trendline add_device(0x18, 157); // Bosch CR100 @@ -54,7 +54,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "2thermostats") == 0) { - EMSESP::logger().info(F("Testing with multiple thermostats...")); + EMSESP::logger().info(("Testing with multiple thermostats...")); add_device(0x08, 123); // GB072 add_device(0x10, 158); // RC310 @@ -86,7 +86,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "310") == 0) { - EMSESP::logger().info(F("Adding a GB072/RC310 combo...")); + EMSESP::logger().info(("Adding a GB072/RC310 combo...")); add_device(0x08, 123); // GB072 add_device(0x10, 158); // RC310 @@ -113,7 +113,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "gateway") == 0) { - EMSESP::logger().info(F("Adding a Gateway...")); + EMSESP::logger().info(("Adding a Gateway...")); // add 0x48 KM200, via a version command rx_telegram({0x48, 0x0B, 0x02, 0x00, 0xBD, 0x04, 0x06, 00, 00, 00, 00, 00, 00, 00}); @@ -133,7 +133,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "mixer") == 0) { - EMSESP::logger().info(F("Adding a mixer...")); + EMSESP::logger().info(("Adding a mixer...")); // add controller add_device(0x09, 114); @@ -155,7 +155,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "boiler") == 0) { - EMSESP::logger().info(F("Adding boiler...")); + EMSESP::logger().info(("Adding boiler...")); add_device(0x08, 123); // Nefit Trendline // UBAuptime @@ -172,7 +172,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "thermostat") == 0) { - EMSESP::logger().info(F("Adding thermostat...")); + EMSESP::logger().info(("Adding thermostat...")); add_device(0x10, 192); // FW120 @@ -185,7 +185,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "solar") == 0) { - EMSESP::logger().info(F("Adding solar...")); + EMSESP::logger().info(("Adding solar...")); add_device(0x30, 163); // SM100 @@ -204,7 +204,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "heatpump") == 0) { - EMSESP::logger().info(F("Adding heatpump...")); + EMSESP::logger().info(("Adding heatpump...")); add_device(0x38, 200); // Enviline module add_device(0x10, 192); // FW120 thermostat @@ -238,7 +238,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "general") { - shell.printfln(F("Testing adding a general boiler & thermostat...")); + shell.printfln(("Testing adding a general boiler & thermostat...")); run_test("general"); shell.invoke_command("show devices"); shell.invoke_command("show"); @@ -247,7 +247,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "render") { - shell.printfln(F("Testing render...")); + shell.printfln(("Testing render...")); // check read_value to make sure it handles all the data type correctly uint8_t message_data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; // message_length is 9 @@ -315,7 +315,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "devices") { - shell.printfln(F("Testing devices...")); + shell.printfln(("Testing devices...")); // A fake response - UBADevices(0x07) rx_telegram({0x08, 0x00, 0x07, 0x00, 0x0B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); @@ -323,7 +323,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // check for boiler and controller on same product_id if (command == "double") { - shell.printfln(F("Testing double...")); + shell.printfln(("Testing double...")); add_device(0x08, 206); // Nefit Excellent HR30 add_device(0x09, 206); // Nefit Excellent HR30 Controller @@ -333,7 +333,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "620") { - EMSESP::logger().info(F("Testing 620...")); + EMSESP::logger().info(("Testing 620...")); // Version Controller uart_telegram({0x09, 0x0B, 0x02, 0x00, 0x5F, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); @@ -344,7 +344,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // unknown device if (command == "unknown") { - shell.printfln(F("Testing unknown...")); + shell.printfln(("Testing unknown...")); // add boiler add_device(0x08, 84); @@ -361,19 +361,19 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "unknown2") { - shell.printfln(F("Testing unknown2...")); + shell.printfln(("Testing unknown2...")); // simulate getting version information back from an unknown device rx_telegram({0x09, 0x0B, 0x02, 0x00, 0x5A, 0x01, 0x02}); // productID is 90 which doesn't exist } if (command == "gateway") { - shell.printfln(F("Testing Gateway...")); + shell.printfln(("Testing Gateway...")); run_test("gateway"); } if (command == "310") { - shell.printfln(F("Testing RC310...")); + shell.printfln(("Testing RC310...")); run_test("310"); shell.invoke_command("show devices"); shell.invoke_command("show"); @@ -382,14 +382,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "2thermostats") { - shell.printfln(F("Testing multiple thermostats...")); + shell.printfln(("Testing multiple thermostats...")); run_test("2thermostats"); shell.invoke_command("show"); shell.invoke_command("show devices"); } if (command == "web") { - shell.printfln(F("Testing Web...")); + shell.printfln(("Testing Web...")); Mqtt::enabled(false); // turn off mqtt Mqtt::ha_enabled(false); // turn off ha @@ -438,7 +438,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "board_profile") { - shell.printfln(F("Testing board profile...")); + shell.printfln(("Testing board profile...")); shell.invoke_command("system"); shell.invoke_command("set board_profile wemos"); @@ -447,7 +447,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "boiler") { - shell.printfln(F("Testing boiler...")); + shell.printfln(("Testing boiler...")); // Mqtt::ha_enabled(false); Mqtt::ha_enabled(true); Mqtt::nested_format(1); @@ -475,7 +475,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "shower_alert") { - shell.printfln(F("Testing Shower Alert...")); + shell.printfln(("Testing Shower Alert...")); run_test("boiler"); @@ -484,7 +484,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "fr120") { - shell.printfln(F("Testing adding a thermostat FR120...")); + shell.printfln(("Testing adding a thermostat FR120...")); add_device(0x10, 191); // FR120 thermostat @@ -496,7 +496,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "ha") { - shell.printfln(F("Testing HA mqtt discovery")); + shell.printfln(("Testing HA mqtt discovery")); Mqtt::ha_enabled(true); // Mqtt::ha_enabled(false); @@ -518,7 +518,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "lastcode") { - shell.printfln(F("Testing lastcode")); + shell.printfln(("Testing lastcode")); Mqtt::ha_enabled(false); Mqtt::nested_format(1); @@ -536,7 +536,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "dv") { - shell.printfln(F("Testing device value rendering")); + shell.printfln(("Testing device value rendering")); Mqtt::ha_enabled(true); Mqtt::nested_format(1); @@ -550,12 +550,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "dallas") { - shell.printfln(F("Testing adding Dallas sensor")); + shell.printfln(("Testing adding Dallas sensor")); emsesp::EMSESP::dallassensor_.test(); } if (command == "dallas_full") { - shell.printfln(F("Testing adding and changing Dallas sensor")); + shell.printfln(("Testing adding and changing Dallas sensor")); Mqtt::ha_enabled(true); Mqtt::nested_format(1); // Mqtt::nested_format(0); @@ -571,7 +571,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "analog") { - shell.printfln(F("Testing adding Analog sensor")); + shell.printfln(("Testing adding Analog sensor")); Mqtt::ha_enabled(true); // Mqtt::ha_enabled(false); Mqtt::nested_format(1); @@ -597,12 +597,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // n=1 = EMSESP::system_.HEALTHCHECK_NO_BUS // n=2 = EMSESP::system_.HEALTHCHECK_NO_NETWORK - shell.printfln(F("Testing healthcheck with %d"), n); + shell.printfln(("Testing healthcheck with %d"), n); EMSESP::system_.healthcheck(n); } if (command == "masked") { - shell.printfln(F("Testing masked entities")); + shell.printfln(("Testing masked entities")); Mqtt::ha_enabled(true); Mqtt::send_response(false); @@ -626,7 +626,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "dv2") { - shell.printfln(F("Testing device value lost")); + shell.printfln(("Testing device value lost")); Mqtt::ha_enabled(true); Mqtt::send_response(false); @@ -647,7 +647,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const if (command == "api_values") { #if defined(EMSESP_STANDALONE) - shell.printfln(F("Testing API getting values")); + shell.printfln(("Testing API getting values")); Mqtt::ha_enabled(false); Mqtt::nested_format(1); Mqtt::send_response(false); @@ -680,7 +680,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "mqtt_post") { - shell.printfln(F("Testing MQTT incoming changes")); + shell.printfln(("Testing MQTT incoming changes")); Mqtt::ha_enabled(false); Mqtt::nested_format(1); Mqtt::send_response(false); @@ -696,7 +696,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const #if defined(EMSESP_STANDALONE) // https://github.com/emsesp/EMS-ESP32/issues/541 if (command == "api_wwmode") { - shell.printfln(F("Testing API wwmode")); + shell.printfln(("Testing API wwmode")); Mqtt::ha_enabled(false); Mqtt::nested_format(1); run_test("310"); @@ -715,7 +715,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const #endif if (command == "api") { - shell.printfln(F("Testing API with MQTT and REST, standalone")); + shell.printfln(("Testing API with MQTT and REST, standalone")); Mqtt::ha_enabled(true); // Mqtt::ha_enabled(false); @@ -990,7 +990,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "mqtt_nested") { - shell.printfln(F("Testing nested MQTT")); + shell.printfln(("Testing nested MQTT")); Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter run_test("boiler"); @@ -1010,7 +1010,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "thermostat") { - shell.printfln(F("Testing adding a thermostat FW120...")); + shell.printfln(("Testing adding a thermostat FW120...")); run_test("thermostat"); shell.invoke_command("show"); @@ -1026,7 +1026,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "tc100") { - shell.printfln(F("Testing adding a TC100 thermostat to the EMS bus...")); + shell.printfln(("Testing adding a TC100 thermostat to the EMS bus...")); // add a thermostat add_device(0x18, 202); // Bosch TC100 - https://github.com/emsesp/EMS-ESP/issues/474 @@ -1037,7 +1037,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "solar") { - shell.printfln(F("Testing Solar")); + shell.printfln(("Testing Solar")); run_test("solar"); uart_telegram("30 00 FF 0A 02 6A 04"); // SM100 pump on (1)sh @@ -1050,14 +1050,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "heatpump") { - shell.printfln(F("Testing Heat Pump")); + shell.printfln(("Testing Heat Pump")); run_test("heatpump"); shell.invoke_command("call"); shell.invoke_command("call heatpump info"); } if (command == "solar200") { - shell.printfln(F("Testing Solar SM200")); + shell.printfln(("Testing Solar SM200")); add_device(0x30, 164); // SM200 @@ -1082,7 +1082,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "km") { - shell.printfln(F("Testing KM200 Gateway")); + shell.printfln(("Testing KM200 Gateway")); add_device(0x10, 158); // RC300 add_device(0x48, 189); // KM200 @@ -1140,7 +1140,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "cr100") { - shell.printfln(F("Testing CR100")); + shell.printfln(("Testing CR100")); add_device(0x18, 157); // Bosch CR100 - https://github.com/emsesp/EMS-ESP/issues/355 @@ -1165,14 +1165,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "rx2") { - shell.printfln(F("Testing Rx2...")); + shell.printfln(("Testing Rx2...")); for (uint8_t i = 0; i < 30; i++) { uart_telegram({0x08, 0x0B, 0x33, 0x00, 0x08, 0xFF, 0x34, 0xFB, 0x00, 0x28, 0x00, 0x00, 0x46, 0x00, 0xFF, 0xFF, 0x00}); } } if (command == "rx") { - shell.printfln(F("Testing Rx...")); + shell.printfln(("Testing Rx...")); // fake telegrams. length includes CRC // Boiler -> Me, UBAMonitorFast(0x18), telegram: 08 00 18 00 00 02 5A 73 3D 0A 10 65 40 02 1A 80 00 01 E1 01 76 0E 3D 48 00 C9 44 02 00 (#data=25) @@ -1229,7 +1229,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "tx") { - shell.printfln(F("Testing Tx...")); + shell.printfln(("Testing Tx...")); // TX queue example - Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4) uint8_t t11[] = {0x44, 0x45, 0x46, 0x47}; @@ -1266,7 +1266,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "poll") { - shell.printfln(F("Testing Poll...")); + shell.printfln(("Testing Poll...")); // simulate sending a read request // uint8_t t16[] = {0x44, 0x45, 0x46, 0x47}; // Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4) @@ -1291,7 +1291,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "cmd") { - shell.printfln(F("Testing Commands...")); + shell.printfln(("Testing Commands...")); // add a thermostat with 3 HCs add_device(0x10, 192); // FW120 @@ -1318,13 +1318,13 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "pin") { - shell.printfln(F("Testing pin...")); + shell.printfln(("Testing pin...")); shell.invoke_command("call system pin"); shell.invoke_command("call system pin 1 true"); } if (command == "mqtt2") { - shell.printfln(F("Testing MQTT large payloads...")); + shell.printfln(("Testing MQTT large payloads...")); DynamicJsonDocument doc(EMSESP_JSON_SIZE_XXLARGE_DYN); @@ -1339,15 +1339,15 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } doc.shrinkToFit(); JsonObject jo = doc.as(); - shell.printfln(F("Size of JSON payload = %d"), jo.memoryUsage()); - shell.printfln(F("Length of JSON payload = %d"), measureJson(jo)); + shell.printfln(("Size of JSON payload = %d"), jo.memoryUsage()); + shell.printfln(("Length of JSON payload = %d"), measureJson(jo)); Mqtt::publish("test", jo); Mqtt::show_mqtt(shell); // show queue } if (command == "mqtt") { - shell.printfln(F("Testing MQTT...")); + shell.printfln(("Testing MQTT...")); Mqtt::ha_enabled(false); Mqtt::enabled(true); @@ -1422,7 +1422,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "poll2") { - shell.printfln(F("Testing Tx Sending last message on queue...")); + shell.printfln(("Testing Tx Sending last message on queue...")); EMSESP::show_ems(shell); @@ -1433,7 +1433,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "rx2") { - shell.printfln(F("Testing rx2...")); + shell.printfln(("Testing rx2...")); uart_telegram({0x1B, 0x5B, 0xFD, 0x2D, 0x9E, 0x3A, 0xB6, 0xE5, 0x02, 0x20, 0x33, 0x30, 0x32, 0x3A, 0x20, 0x5B, 0x73, 0xFF, 0xFF, 0xCB, 0xDF, 0xB7, 0xA7, 0xB5, 0x67, 0x77, 0x77, 0xE4, 0xFF, 0xFD, 0x77, 0xFF}); @@ -1441,14 +1441,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // https://github.com/emsesp/EMS-ESP/issues/380#issuecomment-633663007 if (command == "rx3") { - shell.printfln(F("Testing rx3...")); + shell.printfln(("Testing rx3...")); uart_telegram({0x21, 0x0B, 0xFF, 0x00}); } // testing the UART tx command, without a queue if (command == "tx2") { - shell.printfln(F("Testing tx2...")); + shell.printfln(("Testing tx2...")); uint8_t t[] = {0x0B, 0x88, 0x18, 0x00, 0x20, 0xD4}; // including CRC EMSuart::transmit(t, sizeof(t)); @@ -1456,14 +1456,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // send read request with offset if (command == "offset") { - shell.printfln(F("Testing offset...")); + shell.printfln(("Testing offset...")); // send_read_request(0x18, 0x08); EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset } if (command == "mixer") { - shell.printfln(F("Testing Mixer...")); + shell.printfln(("Testing Mixer...")); run_test("mixer"); @@ -1477,13 +1477,13 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "crash") { - shell.printfln(F("Forcing a crash...")); + shell.printfln(("Forcing a crash...")); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdiv-by-zero" #pragma GCC diagnostic ignored "-Wunused-variable" uint8_t a = 2 / 0; - shell.printfln(F("Testing %s"), a); + shell.printfln(("Testing %s"), a); #pragma GCC diagnostic pop } diff --git a/src/web/WebAPIService.cpp b/src/web/WebAPIService.cpp index 0ae29df9b..b0e48b233 100644 --- a/src/web/WebAPIService.cpp +++ b/src/web/WebAPIService.cpp @@ -117,7 +117,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) { emsesp::EMSESP::logger().err(error); api_fails_++; } else { - // emsesp::EMSESP::logger().debug(F("API command called successfully")); + // emsesp::EMSESP::logger().debug(("API command called successfully")); // if there was no json output from the call, default to the output message 'OK'. if (!output.size()) { output["message"] = "OK"; diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index 847990edf..38c1146d7 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -236,9 +236,9 @@ void WebDataService::write_value(AsyncWebServerRequest * request, JsonVariant & // write debug if (return_code != CommandRet::OK) { - EMSESP::logger().err(F("Write command failed %s (%s)"), (const char *)output["message"], Command::return_code_string(return_code).c_str()); + EMSESP::logger().err(("Write command failed %s (%s)"), (const char *)output["message"], Command::return_code_string(return_code).c_str()); } else { - EMSESP::logger().debug(F("Write command successful")); + EMSESP::logger().debug(("Write command successful")); } response->setCode((return_code == CommandRet::OK) ? 200 : 204); diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index e85eb8ccd..4a1ae6352 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -34,13 +34,13 @@ WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * se void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { switch (event) { case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: - EMSESP::logger().warning(F("WiFi disconnected. Reason code=%d"), info.wifi_sta_disconnected.reason); // IDF 4.0 + EMSESP::logger().warning(("WiFi disconnected. Reason code=%d"), info.wifi_sta_disconnected.reason); // IDF 4.0 WiFi.disconnect(true); break; case ARDUINO_EVENT_WIFI_STA_GOT_IP: #ifndef EMSESP_STANDALONE - EMSESP::logger().info(F("WiFi connected with IP=%s, hostname=%s"), WiFi.localIP().toString().c_str(), WiFi.getHostname()); + EMSESP::logger().info(("WiFi connected with IP=%s, hostname=%s"), WiFi.localIP().toString().c_str(), WiFi.getHostname()); #endif // EMSESP::system_.send_heartbeat(); // send from mqtt start EMSESP::system_.syslog_init(); @@ -48,7 +48,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { break; case ARDUINO_EVENT_ETH_START: - // EMSESP::logger().info(F("Ethernet initialized")); + // EMSESP::logger().info(("Ethernet initialized")); ETH.setHostname(EMSESP::system_.hostname().c_str()); // configure for static IP @@ -64,7 +64,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { // prevent double calls if (!EMSESP::system_.ethernet_connected()) { #ifndef EMSESP_STANDALONE - EMSESP::logger().info(F("Ethernet connected with IP=%s, speed %d Mbps"), ETH.localIP().toString().c_str(), ETH.linkSpeed()); + EMSESP::logger().info(("Ethernet connected with IP=%s, speed %d Mbps"), ETH.localIP().toString().c_str(), ETH.linkSpeed()); #endif // EMSESP::system_.send_heartbeat(); EMSESP::system_.syslog_init(); @@ -74,12 +74,12 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { break; case ARDUINO_EVENT_ETH_DISCONNECTED: - EMSESP::logger().warning(F("Ethernet disconnected")); + EMSESP::logger().warning(("Ethernet disconnected")); EMSESP::system_.ethernet_connected(false); break; case ARDUINO_EVENT_ETH_STOP: - EMSESP::logger().info(F("Ethernet stopped")); + EMSESP::logger().info(("Ethernet stopped")); EMSESP::system_.ethernet_connected(false); break; @@ -103,9 +103,9 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { case ARDUINO_EVENT_WIFI_STA_GOT_IP6: case ARDUINO_EVENT_ETH_GOT_IP6: if (EMSESP::system_.ethernet_connected()) { - EMSESP::logger().info(F("Ethernet connected with IPv6=%s, speed %d Mbps"), ETH.localIPv6().toString().c_str(), ETH.linkSpeed()); + EMSESP::logger().info(("Ethernet connected with IPv6=%s, speed %d Mbps"), ETH.localIPv6().toString().c_str(), ETH.linkSpeed()); } else { - EMSESP::logger().info(F("WiFi connected with IPv6=%s, hostname=%s"), WiFi.localIPv6().toString().c_str(), WiFi.getHostname()); + EMSESP::logger().info(("WiFi connected with IPv6=%s, hostname=%s"), WiFi.localIPv6().toString().c_str(), WiFi.getHostname()); } // EMSESP::system_.send_heartbeat(); EMSESP::system_.syslog_init(); @@ -202,7 +202,7 @@ void WebStatusService::mDNS_start() const { EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) { if (networkSettings.enableMDNS) { if (!MDNS.begin(EMSESP::system_.hostname().c_str())) { - EMSESP::logger().warning(F("Failed to start mDNS responder service")); + EMSESP::logger().warning(("Failed to start mDNS responder service")); return; } @@ -214,13 +214,13 @@ void WebStatusService::mDNS_start() const { MDNS.addServiceTxt("http", "tcp", "version", EMSESP_APP_VERSION); MDNS.addServiceTxt("http", "tcp", "address", address_s.c_str()); - EMSESP::logger().info(F("mDNS responder service started")); + EMSESP::logger().info(("mDNS responder service started")); } }); #else EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) { if (networkSettings.enableMDNS) { - EMSESP::logger().info(F("mDNS responder service started")); + EMSESP::logger().info(("mDNS responder service started")); } }); #endif From 87d0db0b5cbda0a88de52bf09df870d67f15b0a9 Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 28 Sep 2022 20:27:48 +0200 Subject: [PATCH 03/28] auto formatting --- interface/package-lock.json | 132 +++--- interface/package.json | 8 +- lib/framework/APSettingsService.cpp | 6 +- lib/framework/NTPSettingsService.h | 3 +- lib/framework/NetworkSettingsService.cpp | 6 +- lib/uuid-console/src/shell.cpp | 26 +- lib/uuid-console/src/uuid/console.h | 32 +- lib/uuid-log/src/uuid/log.h | 4 +- lib/uuid-telnet/src/stream.cpp | 487 ++++++++++----------- lib/uuid-telnet/src/uuid/telnet.h | 279 ++++++------ lib_standalone/AsyncMqttClient.h | 10 +- lib_standalone/HttpEndpoint.h | 189 ++++---- lib_standalone/Network.h | 42 +- lib_standalone/SecuritySettingsService.cpp | 173 ++++---- lib_standalone/StatefulService.h | 6 +- src/analogsensor.cpp | 2 +- src/command.cpp | 2 +- src/console.cpp | 56 +-- src/dallassensor.cpp | 12 +- src/devices/boiler.cpp | 16 +- src/devices/thermostat.cpp | 8 +- src/emsdevice.cpp | 26 +- src/emsesp.cpp | 40 +- src/mqtt.cpp | 24 +- src/shower.cpp | 6 +- src/system.cpp | 72 +-- src/telegram.cpp | 6 +- src/test/test.cpp | 118 ++--- src/version.h | 2 +- src/web/WebAPIService.cpp | 2 +- src/web/WebDataService.cpp | 2 +- src/web/WebStatusService.cpp | 12 +- 32 files changed, 893 insertions(+), 916 deletions(-) diff --git a/interface/package-lock.json b/interface/package-lock.json index 03ebd707e..96f64bf37 100644 --- a/interface/package-lock.json +++ b/interface/package-lock.json @@ -12,10 +12,10 @@ "@emotion/styled": "^11.10.4", "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.10.6", - "@mui/material": "^5.10.6", + "@mui/material": "^5.10.7", "@table-library/react-table-library": "4.0.18", "@types/lodash": "^4.14.185", - "@types/node": "^18.7.20", + "@types/node": "^18.7.23", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", "@types/react-router-dom": "^5.3.3", @@ -34,8 +34,8 @@ "react-router-dom": "^6.4.1", "react-scripts": "5.0.1", "sockette": "^2.0.6", - "typesafe-i18n": "^5.13.0", - "typescript": "^4.8.3" + "typesafe-i18n": "^5.13.1", + "typescript": "^4.8.4" }, "devDependencies": { "nodemon": "^2.0.20", @@ -3103,9 +3103,9 @@ } }, "node_modules/@mui/base": { - "version": "5.0.0-alpha.98", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.98.tgz", - "integrity": "sha512-c0U51+K2m57MASpRrmNs6qTXSvktDbVcSjD8zCRPbfuwYWERGGwNxwM3/jsBa4dSojTSmLPnOBFDypl74Ds6yQ==", + "version": "5.0.0-alpha.99", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.99.tgz", + "integrity": "sha512-D04H6O1c0Jv561yI0SVbpa8MpqpW3G43CwJxV2o6ALfI0DMJ45w07dGafmDchb6aCWTRTdggd3rjgmuzyNwPiQ==", "dependencies": { "@babel/runtime": "^7.19.0", "@emotion/is-prop-valid": "^1.2.0", @@ -3135,9 +3135,9 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.6.tgz", - "integrity": "sha512-dmyQBqrKmVU6yCSM4GGal5qNXpViXX+/V1t0GA1A5i9QF5Gx6noV/cw0hrSS2ffLT8L2oScq1oTdA6NVIiQ8lg==", + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.7.tgz", + "integrity": "sha512-3N0UYVy3MbrHzM3j6f7fIUCZ+bQ1/sSZq143tLxwSssW3Z4AqE83brpr5flEY1Lx+Aowv/cPyQMmZxzRlFCGqw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui" @@ -3169,19 +3169,19 @@ } }, "node_modules/@mui/material": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.6.tgz", - "integrity": "sha512-QilW5PAAGSQdN7Cpp4rwSQ1doJAt3ca1a2PHZtr8RLVlpHnXb+qQ8CeDo9+9V2fK5CDNdtTN1F+iJKO43aFBpQ==", + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.7.tgz", + "integrity": "sha512-o1jcQGii+q7ORrXhBiMmGzFDaboc1qTgOOC3zDW+NR9ryVzWzL7qEeqoORbgDB5zk9OBsXCjB91fUH/ls5xMwg==", "dependencies": { "@babel/runtime": "^7.19.0", - "@mui/base": "5.0.0-alpha.98", - "@mui/core-downloads-tracker": "^5.10.6", - "@mui/system": "^5.10.6", + "@mui/base": "5.0.0-alpha.99", + "@mui/core-downloads-tracker": "^5.10.7", + "@mui/system": "^5.10.7", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "@types/react-transition-group": "^4.4.5", "clsx": "^1.2.1", - "csstype": "^3.1.0", + "csstype": "^3.1.1", "prop-types": "^15.8.1", "react-is": "^18.2.0", "react-transition-group": "^4.4.5" @@ -3239,13 +3239,13 @@ } }, "node_modules/@mui/styled-engine": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.6.tgz", - "integrity": "sha512-OnVw5xnO4l0XzlJFhKif/RlLenBNhyEQQlSTwB9ApSWB05UAU5ZSbjNsRfyEKvgmQ/fPa+MqPD/dzxbIRCwyeg==", + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.7.tgz", + "integrity": "sha512-CCrtW+vvCKEm6pOE/QcutQ+ORC/iE6D1ghscN4l7LE2JXPvTXO/z0yu8Wxug1JEDlWm4r1Qa0PzJe1P9bjKzNA==", "dependencies": { "@babel/runtime": "^7.19.0", "@emotion/cache": "^11.10.3", - "csstype": "^3.1.0", + "csstype": "^3.1.1", "prop-types": "^15.8.1" }, "engines": { @@ -3270,17 +3270,17 @@ } }, "node_modules/@mui/system": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.6.tgz", - "integrity": "sha512-HfQVX7e2xpQ3jtdB/WwtkFVtozMOozyN575/63u8ILHkE8wGDhblmCieAsnyJPFbm7WBW5PCMyzmfr4QyKLaYg==", + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.7.tgz", + "integrity": "sha512-kwyhjjKGsgtBRFl6vSqidDZcNKU5S1juTgm4Xi2fyWxaEbIQb9Sh9y0iVP2bNCJzgDr0alLaENOZOEaDWHISAQ==", "dependencies": { "@babel/runtime": "^7.19.0", "@mui/private-theming": "^5.10.6", - "@mui/styled-engine": "^5.10.6", + "@mui/styled-engine": "^5.10.7", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "clsx": "^1.2.1", - "csstype": "^3.1.0", + "csstype": "^3.1.1", "prop-types": "^15.8.1" }, "engines": { @@ -4029,9 +4029,9 @@ "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" }, "node_modules/@types/node": { - "version": "18.7.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.20.tgz", - "integrity": "sha512-adzY4vLLr5Uivmx8+zfSJ5fbdgKxX8UMtjtl+17n0B1q1Nz8JEmE151vefMdpD+1gyh+77weN4qEhej/O7budQ==" + "version": "18.7.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", + "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==" }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -16420,9 +16420,9 @@ } }, "node_modules/typesafe-i18n": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.0.tgz", - "integrity": "sha512-Q72l+LqB37kNT2R39mkTwQy1tuQ7URAahD1QXbR84itO864xvVgdoS8xaRAatp0y2/oU7f+2EzpAK3YGp0g+eA==", + "version": "5.13.1", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.1.tgz", + "integrity": "sha512-9Cgikxcj+2LAWQGZ8pOQAf14P+aOOcOel/G1kSAXAObA4Htj8R+qgCx9DqUnxjRfugWzM/19ZqGss7dl8Dw7Gg==", "bin": { "typesafe-i18n": "cli/typesafe-i18n.mjs" }, @@ -16435,9 +16435,9 @@ } }, "node_modules/typescript": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", - "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==", + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -19643,9 +19643,9 @@ "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==" }, "@mui/base": { - "version": "5.0.0-alpha.98", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.98.tgz", - "integrity": "sha512-c0U51+K2m57MASpRrmNs6qTXSvktDbVcSjD8zCRPbfuwYWERGGwNxwM3/jsBa4dSojTSmLPnOBFDypl74Ds6yQ==", + "version": "5.0.0-alpha.99", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.99.tgz", + "integrity": "sha512-D04H6O1c0Jv561yI0SVbpa8MpqpW3G43CwJxV2o6ALfI0DMJ45w07dGafmDchb6aCWTRTdggd3rjgmuzyNwPiQ==", "requires": { "@babel/runtime": "^7.19.0", "@emotion/is-prop-valid": "^1.2.0", @@ -19658,9 +19658,9 @@ } }, "@mui/core-downloads-tracker": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.6.tgz", - "integrity": "sha512-dmyQBqrKmVU6yCSM4GGal5qNXpViXX+/V1t0GA1A5i9QF5Gx6noV/cw0hrSS2ffLT8L2oScq1oTdA6NVIiQ8lg==" + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.7.tgz", + "integrity": "sha512-3N0UYVy3MbrHzM3j6f7fIUCZ+bQ1/sSZq143tLxwSssW3Z4AqE83brpr5flEY1Lx+Aowv/cPyQMmZxzRlFCGqw==" }, "@mui/icons-material": { "version": "5.10.6", @@ -19671,19 +19671,19 @@ } }, "@mui/material": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.6.tgz", - "integrity": "sha512-QilW5PAAGSQdN7Cpp4rwSQ1doJAt3ca1a2PHZtr8RLVlpHnXb+qQ8CeDo9+9V2fK5CDNdtTN1F+iJKO43aFBpQ==", + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.7.tgz", + "integrity": "sha512-o1jcQGii+q7ORrXhBiMmGzFDaboc1qTgOOC3zDW+NR9ryVzWzL7qEeqoORbgDB5zk9OBsXCjB91fUH/ls5xMwg==", "requires": { "@babel/runtime": "^7.19.0", - "@mui/base": "5.0.0-alpha.98", - "@mui/core-downloads-tracker": "^5.10.6", - "@mui/system": "^5.10.6", + "@mui/base": "5.0.0-alpha.99", + "@mui/core-downloads-tracker": "^5.10.7", + "@mui/system": "^5.10.7", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "@types/react-transition-group": "^4.4.5", "clsx": "^1.2.1", - "csstype": "^3.1.0", + "csstype": "^3.1.1", "prop-types": "^15.8.1", "react-is": "^18.2.0", "react-transition-group": "^4.4.5" @@ -19700,28 +19700,28 @@ } }, "@mui/styled-engine": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.6.tgz", - "integrity": "sha512-OnVw5xnO4l0XzlJFhKif/RlLenBNhyEQQlSTwB9ApSWB05UAU5ZSbjNsRfyEKvgmQ/fPa+MqPD/dzxbIRCwyeg==", + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.7.tgz", + "integrity": "sha512-CCrtW+vvCKEm6pOE/QcutQ+ORC/iE6D1ghscN4l7LE2JXPvTXO/z0yu8Wxug1JEDlWm4r1Qa0PzJe1P9bjKzNA==", "requires": { "@babel/runtime": "^7.19.0", "@emotion/cache": "^11.10.3", - "csstype": "^3.1.0", + "csstype": "^3.1.1", "prop-types": "^15.8.1" } }, "@mui/system": { - "version": "5.10.6", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.6.tgz", - "integrity": "sha512-HfQVX7e2xpQ3jtdB/WwtkFVtozMOozyN575/63u8ILHkE8wGDhblmCieAsnyJPFbm7WBW5PCMyzmfr4QyKLaYg==", + "version": "5.10.7", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.7.tgz", + "integrity": "sha512-kwyhjjKGsgtBRFl6vSqidDZcNKU5S1juTgm4Xi2fyWxaEbIQb9Sh9y0iVP2bNCJzgDr0alLaENOZOEaDWHISAQ==", "requires": { "@babel/runtime": "^7.19.0", "@mui/private-theming": "^5.10.6", - "@mui/styled-engine": "^5.10.6", + "@mui/styled-engine": "^5.10.7", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "clsx": "^1.2.1", - "csstype": "^3.1.0", + "csstype": "^3.1.1", "prop-types": "^15.8.1" } }, @@ -20233,9 +20233,9 @@ "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" }, "@types/node": { - "version": "18.7.20", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.20.tgz", - "integrity": "sha512-adzY4vLLr5Uivmx8+zfSJ5fbdgKxX8UMtjtl+17n0B1q1Nz8JEmE151vefMdpD+1gyh+77weN4qEhej/O7budQ==" + "version": "18.7.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", + "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==" }, "@types/parse-json": { "version": "4.0.0", @@ -29096,15 +29096,15 @@ } }, "typesafe-i18n": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.0.tgz", - "integrity": "sha512-Q72l+LqB37kNT2R39mkTwQy1tuQ7URAahD1QXbR84itO864xvVgdoS8xaRAatp0y2/oU7f+2EzpAK3YGp0g+eA==", + "version": "5.13.1", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.1.tgz", + "integrity": "sha512-9Cgikxcj+2LAWQGZ8pOQAf14P+aOOcOel/G1kSAXAObA4Htj8R+qgCx9DqUnxjRfugWzM/19ZqGss7dl8Dw7Gg==", "requires": {} }, "typescript": { - "version": "4.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", - "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==" + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", + "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==" }, "unbox-primitive": { "version": "1.0.2", diff --git a/interface/package.json b/interface/package.json index 80fa0fc84..ee3976892 100644 --- a/interface/package.json +++ b/interface/package.json @@ -8,10 +8,10 @@ "@emotion/styled": "^11.10.4", "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.10.6", - "@mui/material": "^5.10.6", + "@mui/material": "^5.10.7", "@table-library/react-table-library": "4.0.18", "@types/lodash": "^4.14.185", - "@types/node": "^18.7.20", + "@types/node": "^18.7.23", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", "@types/react-router-dom": "^5.3.3", @@ -30,8 +30,8 @@ "react-router-dom": "^6.4.1", "react-scripts": "5.0.1", "sockette": "^2.0.6", - "typesafe-i18n": "^5.13.0", - "typescript": "^4.8.3" + "typesafe-i18n": "^5.13.1", + "typescript": "^4.8.4" }, "scripts": { "start": "react-app-rewired start", diff --git a/lib/framework/APSettingsService.cpp b/lib/framework/APSettingsService.cpp index 0f9967aff..065f10bd2 100644 --- a/lib/framework/APSettingsService.cpp +++ b/lib/framework/APSettingsService.cpp @@ -49,9 +49,9 @@ void APSettingsService::startAP() { WiFi.softAPConfig(_state.localIP, _state.gatewayIP, _state.subnetMask); esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_AP, WIFI_BW_HT20); WiFi.softAP(_state.ssid.c_str(), _state.password.c_str(), _state.channel, _state.ssidHidden, _state.maxClients); - #ifdef ARDUINO_LOLIN_C3_MINI - WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi - #endif +#ifdef ARDUINO_LOLIN_C3_MINI + WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi +#endif if (!_dnsServer) { IPAddress apIp = WiFi.softAPIP(); emsesp::EMSESP::logger().info(F("Starting Access Point with captive portal on %s"), apIp.toString().c_str()); diff --git a/lib/framework/NTPSettingsService.h b/lib/framework/NTPSettingsService.h index 69125628a..6871ac053 100644 --- a/lib/framework/NTPSettingsService.h +++ b/lib/framework/NTPSettingsService.h @@ -56,7 +56,7 @@ class NTPSettingsService : public StatefulService { public: NTPSettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager); - void begin(); + void begin(); static void ntp_received(struct timeval * tv); private: @@ -68,7 +68,6 @@ class NTPSettingsService : public StatefulService { void WiFiEvent(WiFiEvent_t event); void configureNTP(); void configureTime(AsyncWebServerRequest * request, JsonVariant & json); - }; #endif diff --git a/lib/framework/NetworkSettingsService.cpp b/lib/framework/NetworkSettingsService.cpp index 814bd5dde..075857a14 100644 --- a/lib/framework/NetworkSettingsService.cpp +++ b/lib/framework/NetworkSettingsService.cpp @@ -75,9 +75,9 @@ void NetworkSettingsService::manageSTA() { }); WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network - #ifdef ARDUINO_LOLIN_C3_MINI - WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi - #endif +#ifdef ARDUINO_LOLIN_C3_MINI + WiFi.setTxPower(WIFI_POWER_8_5dBm); //https://www.wemos.cc/en/latest/c3/c3_mini.html#about-wifi +#endif } } diff --git a/lib/uuid-console/src/shell.cpp b/lib/uuid-console/src/shell.cpp index 54d2f2079..489ea69f3 100644 --- a/lib/uuid-console/src/shell.cpp +++ b/lib/uuid-console/src/shell.cpp @@ -262,32 +262,30 @@ void Shell::loop_normal() { } else if (esc_ == 1) { // pos1 cursor_ = line_buffer_.length(); } else if (esc_ == 11) { // F1 - - // TODO use flash here? - set_command_str(("help")); + set_command_str("help"); } else if (esc_ == 12) { // F2 - set_command_str(("show")); + set_command_str("show"); } else if (esc_ == 13) { // F3 - set_command_str(("log notice")); + set_command_str("log notice"); } else if (esc_ == 14) { // F4 - set_command_str(("log info")); + set_command_str("log info"); } else if (esc_ == 15) { // F5 - set_command_str(("log debug")); + set_command_str("log debug"); } else if (esc_ == 17) { // F6 - set_command_str(("watch off")); + set_command_str("watch off"); } else if (esc_ == 18) { // F7 - set_command_str(("watch on")); + set_command_str("watch on"); } else if (esc_ == 19) { // F8 - set_command_str(("watch raw")); + set_command_str("watch raw"); } else if (esc_ == 20) { // F9 - set_command_str(("call system info")); + set_command_str("call system info"); } else if (esc_ == 21) { // F10 - set_command_str(("call system settings")); + set_command_str("call system settings"); } else if (esc_ == 23) { // F11 - line_buffer_ = (("call send \"0B \"")); + line_buffer_ = ("call send \"0B \""); cursor_ = 1; } else if (esc_ == 24) { // F12 - set_command_str(("log debug; watch raw")); + set_command_str("log debug; watch raw"); } esc_ = 0; } else if (c >= '0' && (c <= '9')) { // numbers diff --git a/lib/uuid-console/src/uuid/console.h b/lib/uuid-console/src/uuid/console.h index d2c8a3727..fc15563d7 100644 --- a/lib/uuid-console/src/uuid/console.h +++ b/lib/uuid-console/src/uuid/console.h @@ -685,8 +685,8 @@ class Shell : public std::enable_shared_from_this, public uuid::log::Hand PasswordData(const char * password_prompt, password_function && password_function); ~PasswordData() override = default; - const char * password_prompt_; /*!< Prompt requesting password input. @since 0.1.0 */ - password_function password_function_; /*!< Function to execute after password entry. @since 0.1.0 */ + const char * password_prompt_; /*!< Prompt requesting password input. @since 0.1.0 */ + password_function password_function_; /*!< Function to execute after password entry. @since 0.1.0 */ }; /** @@ -761,7 +761,7 @@ class Shell : public std::enable_shared_from_this, public uuid::log::Hand const std::shared_ptr content_; /*!< Log message content. @since 0.1.0 */ }; - Shell(const Shell &) = delete; + Shell(const Shell &) = delete; Shell & operator=(const Shell &) = delete; /** @@ -906,7 +906,7 @@ class Shell : public std::enable_shared_from_this, public uuid::log::Hand size_t maximum_log_messages_ = MAX_LOG_MESSAGES; /*!< Maximum command line length in bytes. @since 0.6.0 */ std::string line_buffer_; /*!< Command line buffer. Limited to maximum_command_line_length() bytes. @since 0.1.0 */ std::string line_old_[MAX_LINES]; /*!< old Command line buffer.*/ - uint8_t line_no_ = 0; + uint8_t line_no_ = 0; size_t maximum_command_line_length_ = MAX_COMMAND_LINE_LENGTH; /*!< Maximum command line length in bytes. @since 0.6.0 */ unsigned char previous_ = 0; /*!< Previous character that was entered on the command line. Used to detect CRLF line endings. @since 0.1.0 */ uint8_t cursor_ = 0; /*!< cursor position from end of line */ @@ -955,9 +955,9 @@ class CommandLine { ~CommandLine() = default; #ifdef UNIT_TEST - CommandLine(CommandLine &&) = default; - CommandLine & operator=(CommandLine &&) = default; - CommandLine(const CommandLine &) __attribute__((deprecated)) = default; + CommandLine(CommandLine &&) = default; + CommandLine & operator=(CommandLine &&) = default; + CommandLine(const CommandLine &) __attribute__((deprecated)) = default; CommandLine & operator=(const CommandLine &) __attribute__((deprecated)) = default; #endif @@ -1279,8 +1279,8 @@ class Commands { */ void add_command(unsigned int context, unsigned int flags, - const string_vector & name, - const string_vector & arguments, + const string_vector & name, + const string_vector & arguments, command_function function, argument_completion_function arg_function); @@ -1344,11 +1344,7 @@ class Commands { * completions for this command. * @since 0.1.0 */ - Command(unsigned int flags, - const string_vector name, - const string_vector arguments, - command_function function, - argument_completion_function arg_function); + Command(unsigned int flags, const string_vector name, const string_vector arguments, command_function function, argument_completion_function arg_function); ~Command(); /** @@ -1372,13 +1368,13 @@ class Commands { } unsigned int flags_; /*!< Shell flags that must be set for this command to be available. @since 0.1.0 */ - const string_vector name_; /*!< Name of the command as a std::vector of flash strings. @since 0.1.0 */ - const string_vector arguments_; /*!< Help text for arguments that the command accepts as a std::vector of flash strings. @since 0.1.0 */ + const string_vector name_; /*!< Name of the command as a std::vector of flash strings. @since 0.1.0 */ + const string_vector arguments_; /*!< Help text for arguments that the command accepts as a std::vector of flash strings. @since 0.1.0 */ command_function function_; /*!< Function to be used when the command is executed. @since 0.1.0 */ argument_completion_function arg_function_; /*!< Function to be used to perform argument completions for this command. @since 0.1.0 */ private: - Command(const Command &) = delete; + Command(const Command &) = delete; Command & operator=(const Command &) = delete; }; @@ -1487,7 +1483,7 @@ class StreamConsole : virtual public Shell { explicit StreamConsole(Stream & stream); private: - StreamConsole(const StreamConsole &) = delete; + StreamConsole(const StreamConsole &) = delete; StreamConsole & operator=(const StreamConsole &) = delete; /** diff --git a/lib/uuid-log/src/uuid/log.h b/lib/uuid-log/src/uuid/log.h index 956e4615f..615bc7577 100644 --- a/lib/uuid-log/src/uuid/log.h +++ b/lib/uuid-log/src/uuid/log.h @@ -626,8 +626,8 @@ class Logger { static std::map handlers_; /*!< Registered log handlers. @since 1.0.0 */ static Level level_; /*!< Minimum global log level across all handlers. @since 1.0.0 */ - const char * name_; /*!< Logger name (flash string). @since 1.0.0 */ - const Facility facility_; /*!< Default logging facility for messages. @since 1.0.0 */ + const char * name_; /*!< Logger name (flash string). @since 1.0.0 */ + const Facility facility_; /*!< Default logging facility for messages. @since 1.0.0 */ }; } // namespace log diff --git a/lib/uuid-telnet/src/stream.cpp b/lib/uuid-telnet/src/stream.cpp index bafe3e392..adf5f16ec 100644 --- a/lib/uuid-telnet/src/stream.cpp +++ b/lib/uuid-telnet/src/stream.cpp @@ -28,329 +28,322 @@ namespace uuid { namespace telnet { -TelnetStream::TelnetStream(WiFiClient &client) - : client_(client) { - output_buffer_.reserve(BUFFER_SIZE); +TelnetStream::TelnetStream(WiFiClient & client) + : client_(client) { + output_buffer_.reserve(BUFFER_SIZE); } void TelnetStream::start() { - raw_write({ - IAC, WILL, OPT_ECHO, - IAC, WILL, OPT_BINARY, - IAC, WILL, OPT_SGA, - IAC, DONT, OPT_ECHO, - IAC, DO, OPT_BINARY, - IAC, DO, OPT_SGA - }); + raw_write({IAC, WILL, OPT_ECHO, IAC, WILL, OPT_BINARY, IAC, WILL, OPT_SGA, IAC, DONT, OPT_ECHO, IAC, DO, OPT_BINARY, IAC, DO, OPT_SGA}); } int TelnetStream::available() { - if (peek() == -1) { - return 0; - } else { - return 1; - } + if (peek() == -1) { + return 0; + } else { + return 1; + } } int TelnetStream::read() { - if (peek_ != -1) { - int data = peek_; - peek_ = -1; - return data; - } + if (peek_ != -1) { + int data = peek_; + peek_ = -1; + return data; + } - buffer_flush(); + buffer_flush(); restart: - int data = raw_read(); + int data = raw_read(); - if (data == -1) { - return -1; - } + if (data == -1) { + return -1; + } - unsigned char c = data; + unsigned char c = data; - if (sub_negotiation_) { - if (previous_raw_in_ == IAC) { - switch (c) { - case SE: - sub_negotiation_ = false; - previous_raw_in_ = 0; - goto restart; + if (sub_negotiation_) { + if (previous_raw_in_ == IAC) { + switch (c) { + case SE: + sub_negotiation_ = false; + previous_raw_in_ = 0; + goto restart; - case IAC: - previous_raw_in_ = 0; - goto restart; - } - } else { - switch (c) { - case IAC: - previous_raw_in_ = c; - goto restart; + case IAC: + previous_raw_in_ = 0; + goto restart; + } + } else { + switch (c) { + case IAC: + previous_raw_in_ = c; + goto restart; - default: - previous_raw_in_ = 0; - goto restart; - } - } - } else { - if (previous_raw_in_ == IAC) { - switch (c) { - case IP: - // Interrupt (^C) - previous_raw_in_ = 0; - c = '\x03'; - break; + default: + previous_raw_in_ = 0; + goto restart; + } + } + } else { + if (previous_raw_in_ == IAC) { + switch (c) { + case IP: + // Interrupt (^C) + previous_raw_in_ = 0; + c = '\x03'; + break; - case EC: - // Backspace (^H) - previous_raw_in_ = 0; - c = '\x08'; - break; + case EC: + // Backspace (^H) + previous_raw_in_ = 0; + c = '\x08'; + break; - case EL: - // Delete line (^U) - previous_raw_in_ = 0; - c = '\x15'; - break; + case EL: + // Delete line (^U) + previous_raw_in_ = 0; + c = '\x15'; + break; - case IAC: - previous_raw_in_ = 0; - break; + case IAC: + previous_raw_in_ = 0; + break; - case SB: - case WILL: - case WONT: - case DO: - case DONT: - previous_raw_in_ = c; - goto restart; + case SB: + case WILL: + case WONT: + case DO: + case DONT: + previous_raw_in_ = c; + goto restart; - case SE: - case DM: - case BRK: - case AO: - case AYT: - case GA: - case NOP: - default: - previous_raw_in_ = 0; - goto restart; - } - } else if (previous_raw_in_ == SB) { - sub_negotiation_ = true; - previous_raw_in_ = 0; - goto restart; - } else if (previous_raw_in_ == WILL || previous_raw_in_ == WONT) { - switch (c) { - case OPT_ECHO: - // Don't do these - raw_write({IAC, DONT, c}); - break; + case SE: + case DM: + case BRK: + case AO: + case AYT: + case GA: + case NOP: + default: + previous_raw_in_ = 0; + goto restart; + } + } else if (previous_raw_in_ == SB) { + sub_negotiation_ = true; + previous_raw_in_ = 0; + goto restart; + } else if (previous_raw_in_ == WILL || previous_raw_in_ == WONT) { + switch (c) { + case OPT_ECHO: + // Don't do these + raw_write({IAC, DONT, c}); + break; - case OPT_BINARY: - case OPT_SGA: - // Do these - raw_write({IAC, DO, c}); - break; + case OPT_BINARY: + case OPT_SGA: + // Do these + raw_write({IAC, DO, c}); + break; - default: - // Don't do anything else - raw_write({IAC, DONT, c}); - break; - } + default: + // Don't do anything else + raw_write({IAC, DONT, c}); + break; + } - previous_raw_in_ = 0; - goto restart; - } else if (previous_raw_in_ == DO) { - switch (c) { - case OPT_ECHO: - case OPT_BINARY: - case OPT_SGA: - // These are always enabled - break; + previous_raw_in_ = 0; + goto restart; + } else if (previous_raw_in_ == DO) { + switch (c) { + case OPT_ECHO: + case OPT_BINARY: + case OPT_SGA: + // These are always enabled + break; - default: - // Refuse to do anything else - raw_write({IAC, WONT, c}); - break; - } + default: + // Refuse to do anything else + raw_write({IAC, WONT, c}); + break; + } - previous_raw_in_ = 0; - goto restart; - } else if (previous_raw_in_ == DONT) { - switch (c) { - case OPT_ECHO: - case OPT_BINARY: - case OPT_SGA: - // Insist that we do these - raw_write({IAC, WILL, c}); - break; + previous_raw_in_ = 0; + goto restart; + } else if (previous_raw_in_ == DONT) { + switch (c) { + case OPT_ECHO: + case OPT_BINARY: + case OPT_SGA: + // Insist that we do these + raw_write({IAC, WILL, c}); + break; - default: - // Everything else is always disabled - break; - } + default: + // Everything else is always disabled + break; + } - previous_raw_in_ = 0; - goto restart; - } else { - switch (c) { - case IAC: - previous_raw_in_ = c; - goto restart; + previous_raw_in_ = 0; + goto restart; + } else { + switch (c) { + case IAC: + previous_raw_in_ = c; + goto restart; - default: - previous_raw_in_ = 0; - break; - } - } - } + default: + previous_raw_in_ = 0; + break; + } + } + } - if (previous_in_ == CR) { - if (c == NUL) { - previous_in_ = 0; - goto restart; - } - } + if (previous_in_ == CR) { + if (c == NUL) { + previous_in_ = 0; + goto restart; + } + } - previous_in_ = c; - return c; + previous_in_ = c; + return c; } int TelnetStream::peek() { - buffer_flush(); + buffer_flush(); - // It's too complicated to implement this by calling peek() - // on the original stream, especially if the original stream - // doesn't actually support peeking. - if (peek_ == -1) { - peek_ = read(); - } + // It's too complicated to implement this by calling peek() + // on the original stream, especially if the original stream + // doesn't actually support peeking. + if (peek_ == -1) { + peek_ = read(); + } - return peek_; + return peek_; } size_t TelnetStream::write(uint8_t data) { - if (previous_out_ == CR && data != LF) { - previous_out_ = data; + if (previous_out_ == CR && data != LF) { + previous_out_ = data; - if (raw_write({NUL, data}) != 2) { - return 0; - } - } else { - previous_out_ = data; - } + if (raw_write({NUL, data}) != 2) { + return 0; + } + } else { + previous_out_ = data; + } - if (data == IAC) { - if (raw_write({IAC, IAC}) != 2) { - return 0; - } - } else { - if (raw_write(data) != 1) { - return 0; - } - } + if (data == IAC) { + if (raw_write({IAC, IAC}) != 2) { + return 0; + } + } else { + if (raw_write(data) != 1) { + return 0; + } + } - return 1; + return 1; } -size_t TelnetStream::write(const uint8_t *buffer, size_t size) { - std::vector data; - data.reserve(size); +size_t TelnetStream::write(const uint8_t * buffer, size_t size) { + std::vector data; + data.reserve(size); - while (size-- > 0) { - unsigned char c = *buffer++; + while (size-- > 0) { + unsigned char c = *buffer++; - if (previous_out_ == CR && c != LF) { - data.push_back((unsigned char)NUL); - } + if (previous_out_ == CR && c != LF) { + data.push_back((unsigned char)NUL); + } - if (c == IAC) { - data.push_back((unsigned char)IAC); - } + if (c == IAC) { + data.push_back((unsigned char)IAC); + } - previous_out_ = c; - data.push_back(c); - } + previous_out_ = c; + data.push_back(c); + } - size_t len = raw_write(data); - if (len < size) { - len = 0; - } - return len; + size_t len = raw_write(data); + if (len < size) { + len = 0; + } + return len; } void TelnetStream::flush() { - // This is a pure virtual function in Arduino's Stream class, which - // makes no sense because that class is for input and this is an - // output function. Later versions move it to Print as an empty - // virtual function so this is here for backward compatibility. + // This is a pure virtual function in Arduino's Stream class, which + // makes no sense because that class is for input and this is an + // output function. Later versions move it to Print as an empty + // virtual function so this is here for backward compatibility. } int TelnetStream::raw_available() { - return client_.available(); + return client_.available(); } int TelnetStream::raw_read() { - return client_.read(); + return client_.read(); } void TelnetStream::buffer_flush() { - if (!output_buffer_.empty()) { - size_t len = client_.write(reinterpret_cast(output_buffer_.data()), output_buffer_.size()); - if (len != output_buffer_.size()) { - client_.stop(); - } - output_buffer_.clear(); - output_buffer_.shrink_to_fit(); - } + if (!output_buffer_.empty()) { + size_t len = client_.write(reinterpret_cast(output_buffer_.data()), output_buffer_.size()); + if (len != output_buffer_.size()) { + client_.stop(); + } + output_buffer_.clear(); + output_buffer_.shrink_to_fit(); + } } size_t TelnetStream::raw_write(unsigned char data) { - output_buffer_.push_back(data); + output_buffer_.push_back(data); - if (output_buffer_.size() >= BUFFER_SIZE) { - buffer_flush(); - } + if (output_buffer_.size() >= BUFFER_SIZE) { + buffer_flush(); + } - return 1; + return 1; } -size_t TelnetStream::raw_write(const std::vector &data) { - return raw_write(reinterpret_cast(data.data()), data.size()); +size_t TelnetStream::raw_write(const std::vector & data) { + return raw_write(reinterpret_cast(data.data()), data.size()); } -size_t TelnetStream::raw_write(const uint8_t *buffer, size_t size) { - size_t offset = 0; - size_t remaining = size; +size_t TelnetStream::raw_write(const uint8_t * buffer, size_t size) { + size_t offset = 0; + size_t remaining = size; - if (!output_buffer_.empty()) { - // Fill the rest of the buffer - size_t block = std::min(remaining, BUFFER_SIZE - output_buffer_.size()); + if (!output_buffer_.empty()) { + // Fill the rest of the buffer + size_t block = std::min(remaining, BUFFER_SIZE - output_buffer_.size()); - output_buffer_.insert(output_buffer_.end(), buffer, buffer + block); - offset += block; - remaining -= block; + output_buffer_.insert(output_buffer_.end(), buffer, buffer + block); + offset += block; + remaining -= block; - if (output_buffer_.size() >= BUFFER_SIZE) { - buffer_flush(); - } - } + if (output_buffer_.size() >= BUFFER_SIZE) { + buffer_flush(); + } + } - if (remaining >= BUFFER_SIZE) { - // Output directly if it won't fit in the buffer - size_t len = client_.write(buffer + offset, remaining); - if (len != remaining) { - client_.stop(); - return offset + len; - } - } else if (remaining > 0) { - // Put the rest in the buffer - output_buffer_.insert(output_buffer_.end(), buffer + offset, buffer + offset + remaining); - } + if (remaining >= BUFFER_SIZE) { + // Output directly if it won't fit in the buffer + size_t len = client_.write(buffer + offset, remaining); + if (len != remaining) { + client_.stop(); + return offset + len; + } + } else if (remaining > 0) { + // Put the rest in the buffer + output_buffer_.insert(output_buffer_.end(), buffer + offset, buffer + offset + remaining); + } - return size; + return size; } } // namespace telnet diff --git a/lib/uuid-telnet/src/uuid/telnet.h b/lib/uuid-telnet/src/uuid/telnet.h index 1338ae590..46ece1d01 100644 --- a/lib/uuid-telnet/src/uuid/telnet.h +++ b/lib/uuid-telnet/src/uuid/telnet.h @@ -21,9 +21,9 @@ #include #ifdef ARDUINO_ARCH_ESP8266 -# include +#include #else -# include +#include #endif #include @@ -51,47 +51,47 @@ namespace telnet { * * @since 0.1.0 */ -class TelnetStream: public ::Stream { -public: - /** +class TelnetStream : public ::Stream { + public: + /** * Create a new telnet stream wrapper. * * @param[in] client Client connection. * @since 0.1.0 */ - explicit TelnetStream(WiFiClient &client); - virtual ~TelnetStream() = default; + explicit TelnetStream(WiFiClient & client); + virtual ~TelnetStream() = default; - /** + /** * Perform initial negotiation. * * @since 0.1.0 */ - void start(); + void start(); - /** + /** * Check for available input. * * @return The number of bytes available to read. * @since 0.1.0 */ - int available() override; - /** + int available() override; + /** * Read one byte from the available input. * * @return An unsigned char if input is available, otherwise -1. * @since 0.1.0 */ - int read() override; - /** + int read() override; + /** * Read one byte from the available input without advancing to the * next one. * * @return An unsigned char if input is available, otherwise -1. * @since 0.1.0 */ - int peek() override; - /** + int peek() override; + /** * Write one byte to the output stream. * * Disconnect the client if the socket buffer is full. @@ -100,8 +100,8 @@ public: * @return The number of bytes that were output. * @since 0.1.0 */ - size_t write(uint8_t data) override; - /** + size_t write(uint8_t data) override; + /** * Write an array of bytes to the output stream. * * Disconnect the client if the socket buffer is full. @@ -111,8 +111,8 @@ public: * @return The number of bytes that were output. * @since 0.1.0 */ - size_t write(const uint8_t *buffer, size_t size) override; - /** + size_t write(const uint8_t * buffer, size_t size) override; + /** * Does nothing. * * This is a pure virtual function in Arduino's Stream class, which @@ -122,66 +122,69 @@ public: * * @since 0.1.0 */ - void flush() override; + void flush() override; -private: - static constexpr const unsigned char NUL = 0; /*!< No operation. @since 0.1.0 */ - static constexpr const unsigned char BEL = 7; /*!< Produces an audible or visible signal. @since 0.1.0 */ - static constexpr const unsigned char BS = 8; /*!< Moves the print head one character position towards the left margin. @since 0.1.0 */ - static constexpr const unsigned char HT = 9; /*!< Moves the printer to the next horizontal tab stop. @since 0.1.0 */ - static constexpr const unsigned char LF = 10; /*!< Line Feed. @since 0.1.0 */ - static constexpr const unsigned char VT = 11; /*!< Moves the printer to the next vertical tab stop. @since 0.1.0 */ - static constexpr const unsigned char FF = 12; /*!< Moves the printer to the top of the next page, keeping the same horizontal position. @since 0.1.0 */ - static constexpr const unsigned char CR = 13; /*!< Carriage Return. @since 0.1.0 */ - static constexpr const unsigned char SE = 240; /*!< End of sub-negotiation parameters. @since 0.1.0 */ - static constexpr const unsigned char NOP = 241; /*!< No operation. @since 0.1.0 */ - static constexpr const unsigned char DM = 242; /*!< The data stream portion of a Synch. @since 0.1.0 */ - static constexpr const unsigned char BRK = 243; /*!< NVT character BRK. @since 0.1.0 */ - static constexpr const unsigned char IP = 244; /*!< Interrupt Process function. @since 0.1.0 */ - static constexpr const unsigned char AO = 245; /*!< Abort Output function. @since 0.1.0 */ - static constexpr const unsigned char AYT = 246; /*!< Are You There function. @since 0.1.0 */ - static constexpr const unsigned char EC = 247; /*!< Erase Character function. @since 0.1.0 */ - static constexpr const unsigned char EL = 248; /*!< Erase Line function. @since 0.1.0 */ - static constexpr const unsigned char GA = 249; /*!< Go Ahead signal. @since 0.1.0 */ - static constexpr const unsigned char SB = 250; /*!< Sub-negotiation of the indicated option. @since 0.1.0 */ - static constexpr const unsigned char WILL = 251; /*!< Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. @since 0.1.0 */ - static constexpr const unsigned char WONT = 252; /*!< Indicates the refusal to perform, or continue performing, the indicated option. @since 0.1.0 */ - static constexpr const unsigned char DO = 253; /*!< Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. @since 0.1.0 */ - static constexpr const unsigned char DONT = 254; /*!< Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. @since 0.1.0 */ - static constexpr const unsigned char IAC = 255; /*!< Interpret As Command escape character. @since 0.1.0 */ + private: + static constexpr const unsigned char NUL = 0; /*!< No operation. @since 0.1.0 */ + static constexpr const unsigned char BEL = 7; /*!< Produces an audible or visible signal. @since 0.1.0 */ + static constexpr const unsigned char BS = 8; /*!< Moves the print head one character position towards the left margin. @since 0.1.0 */ + static constexpr const unsigned char HT = 9; /*!< Moves the printer to the next horizontal tab stop. @since 0.1.0 */ + static constexpr const unsigned char LF = 10; /*!< Line Feed. @since 0.1.0 */ + static constexpr const unsigned char VT = 11; /*!< Moves the printer to the next vertical tab stop. @since 0.1.0 */ + static constexpr const unsigned char FF = 12; /*!< Moves the printer to the top of the next page, keeping the same horizontal position. @since 0.1.0 */ + static constexpr const unsigned char CR = 13; /*!< Carriage Return. @since 0.1.0 */ + static constexpr const unsigned char SE = 240; /*!< End of sub-negotiation parameters. @since 0.1.0 */ + static constexpr const unsigned char NOP = 241; /*!< No operation. @since 0.1.0 */ + static constexpr const unsigned char DM = 242; /*!< The data stream portion of a Synch. @since 0.1.0 */ + static constexpr const unsigned char BRK = 243; /*!< NVT character BRK. @since 0.1.0 */ + static constexpr const unsigned char IP = 244; /*!< Interrupt Process function. @since 0.1.0 */ + static constexpr const unsigned char AO = 245; /*!< Abort Output function. @since 0.1.0 */ + static constexpr const unsigned char AYT = 246; /*!< Are You There function. @since 0.1.0 */ + static constexpr const unsigned char EC = 247; /*!< Erase Character function. @since 0.1.0 */ + static constexpr const unsigned char EL = 248; /*!< Erase Line function. @since 0.1.0 */ + static constexpr const unsigned char GA = 249; /*!< Go Ahead signal. @since 0.1.0 */ + static constexpr const unsigned char SB = 250; /*!< Sub-negotiation of the indicated option. @since 0.1.0 */ + static constexpr const unsigned char WILL = + 251; /*!< Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. @since 0.1.0 */ + static constexpr const unsigned char WONT = 252; /*!< Indicates the refusal to perform, or continue performing, the indicated option. @since 0.1.0 */ + static constexpr const unsigned char DO = + 253; /*!< Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. @since 0.1.0 */ + static constexpr const unsigned char DONT = + 254; /*!< Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. @since 0.1.0 */ + static constexpr const unsigned char IAC = 255; /*!< Interpret As Command escape character. @since 0.1.0 */ - static constexpr const unsigned char OPT_BINARY = 0; /*!< Binary (8-bit) transmission mode. (RFC 856). @since 0.1.0 */ - static constexpr const unsigned char OPT_ECHO = 1; /*!< Remote Echo (RFC 857). @since 0.1.0 */ - static constexpr const unsigned char OPT_SGA = 3; /*!< Suppress Go Ahead (RFC 858). @since 0.1.0 */ + static constexpr const unsigned char OPT_BINARY = 0; /*!< Binary (8-bit) transmission mode. (RFC 856). @since 0.1.0 */ + static constexpr const unsigned char OPT_ECHO = 1; /*!< Remote Echo (RFC 857). @since 0.1.0 */ + static constexpr const unsigned char OPT_SGA = 3; /*!< Suppress Go Ahead (RFC 858). @since 0.1.0 */ - static constexpr const size_t BUFFER_SIZE = 536; /*!< Output buffer size. @since 0.1.0 */ + static constexpr const size_t BUFFER_SIZE = 536; /*!< Output buffer size. @since 0.1.0 */ - TelnetStream(const TelnetStream&) = delete; - TelnetStream& operator=(const TelnetStream&) = delete; + TelnetStream(const TelnetStream &) = delete; + TelnetStream & operator=(const TelnetStream &) = delete; - /** + /** * Directly check for available input. * * @return The number of bytes available to read. * @since 0.1.0 */ - int raw_available(); - /** + int raw_available(); + /** * Read one byte directly from the available input. * * @return An unsigned char if input is available, otherwise -1. * @since 0.1.0 */ - int raw_read(); - /** + int raw_read(); + /** * Flush output stream buffer. * * Disconnect the client if the socket buffer is full. * * @since 0.1.0 */ - void buffer_flush(); - /** + void buffer_flush(); + /** * Write one byte directly to the output stream. * * Disconnect the client if the socket buffer is full. @@ -190,8 +193,8 @@ private: * @return The number of bytes that were output. * @since 0.1.0 */ - size_t raw_write(unsigned char data); - /** + size_t raw_write(unsigned char data); + /** * Write a vector of bytes directly to the output stream. * * Disconnect the client if the socket buffer is full. @@ -200,8 +203,8 @@ private: * @return The number of bytes that were output. * @since 0.1.0 */ - size_t raw_write(const std::vector &data); - /** + size_t raw_write(const std::vector & data); + /** * Write an array of bytes directly to the output stream. * * Disconnect the client if the socket buffer is full. @@ -211,15 +214,15 @@ private: * @return The number of bytes that were output. * @since 0.1.0 */ - size_t raw_write(const uint8_t *buffer, size_t size); + size_t raw_write(const uint8_t * buffer, size_t size); - WiFiClient &client_; /*!< Client connection. @since 0.1.0 */ - unsigned char previous_raw_in_ = 0; /*!< Previous raw character that was received. Used to detect commands. @since 0.1.0 */ - bool sub_negotiation_ = false; /*!< Sub-negotiation mode. @since 0.1.0 */ - unsigned char previous_in_ = 0; /*!< Previous character that was received. Used to detect CR NUL. @since 0.1.0 */ - unsigned char previous_out_ = 0; /*!< Previous character that was sent. Used to insert NUL after CR without LF. @since 0.1.0 */ - int peek_ = -1; /*!< Previously read data cached by peek(). @since 0.1.0 */ - std::vector output_buffer_; /*!< Buffer data to be output until a read function is called. @since 0.1.0 */ + WiFiClient & client_; /*!< Client connection. @since 0.1.0 */ + unsigned char previous_raw_in_ = 0; /*!< Previous raw character that was received. Used to detect commands. @since 0.1.0 */ + bool sub_negotiation_ = false; /*!< Sub-negotiation mode. @since 0.1.0 */ + unsigned char previous_in_ = 0; /*!< Previous character that was received. Used to detect CR NUL. @since 0.1.0 */ + unsigned char previous_out_ = 0; /*!< Previous character that was sent. Used to insert NUL after CR without LF. @since 0.1.0 */ + int peek_ = -1; /*!< Previously read data cached by peek(). @since 0.1.0 */ + std::vector output_buffer_; /*!< Buffer data to be output until a read function is called. @since 0.1.0 */ }; /** @@ -228,13 +231,13 @@ private: * @since 0.1.0 */ class TelnetService { -public: - static constexpr size_t MAX_CONNECTIONS = 3; /*!< Maximum number of concurrent open connections. @since 0.1.0 */ - static constexpr uint16_t DEFAULT_PORT = 23; /*!< Default TCP port to listen on. @since 0.1.0 */ - static constexpr unsigned long DEFAULT_IDLE_TIMEOUT = 600; /*!< Default initial idle timeout (in seconds). @since 0.1.0 */ - static constexpr unsigned long DEFAULT_WRITE_TIMEOUT = 0; /*!< Default write timeout (in milliseconds). @ since 0.1.0 */ + public: + static constexpr size_t MAX_CONNECTIONS = 3; /*!< Maximum number of concurrent open connections. @since 0.1.0 */ + static constexpr uint16_t DEFAULT_PORT = 23; /*!< Default TCP port to listen on. @since 0.1.0 */ + static constexpr unsigned long DEFAULT_IDLE_TIMEOUT = 600; /*!< Default initial idle timeout (in seconds). @since 0.1.0 */ + static constexpr unsigned long DEFAULT_WRITE_TIMEOUT = 0; /*!< Default write timeout (in milliseconds). @ since 0.1.0 */ - /** + /** * Function to handle the creation of a shell. * * @param[in] stream Stream for the telnet connection. @@ -242,9 +245,9 @@ public: * @param[in] port Remote port. * @since 0.1.0 */ - using shell_factory_function = std::function(Stream &stream, const IPAddress &addr, uint16_t port)>; + using shell_factory_function = std::function(Stream & stream, const IPAddress & addr, uint16_t port)>; - /** + /** * Create a new telnet service listening on the default port. * * @param[in] commands Commands available for execution in shells. @@ -252,9 +255,9 @@ public: * @param[in] flags Initial flags for shells. * @since 0.1.0 */ - TelnetService(std::shared_ptr commands, unsigned int context = 0, unsigned int flags = 0); + TelnetService(std::shared_ptr commands, unsigned int context = 0, unsigned int flags = 0); - /** + /** * Create a new telnet service listening on a specific port. * * @param[in] port TCP listening port. @@ -263,74 +266,74 @@ public: * @param[in] flags Initial flags for shells. * @since 0.1.0 */ - TelnetService(uint16_t port, std::shared_ptr commands, unsigned int context = 0, unsigned int flags = 0); + TelnetService(uint16_t port, std::shared_ptr commands, unsigned int context = 0, unsigned int flags = 0); - /** + /** * Create a new telnet service listening on the default port. * * @param[in] shell_factory Function to create a shell for new connections. * @since 0.1.0 */ - explicit TelnetService(shell_factory_function shell_factory); + explicit TelnetService(shell_factory_function shell_factory); - /** + /** * Create a new telnet service listening on a specific port. * * @param[in] port TCP listening port. * @param[in] shell_factory Function to create a shell for new connections. * @since 0.1.0 */ - TelnetService(uint16_t port, shell_factory_function shell_factory); + TelnetService(uint16_t port, shell_factory_function shell_factory); - ~TelnetService() = default; + ~TelnetService() = default; - /** + /** * Start listening for connections on the configured port. * * @since 0.1.0 */ - void start(); - /** + void start(); + /** * Close all connections. * * The listening status is not affected. * * @since 0.1.0 */ - void close_all(); - /** + void close_all(); + /** * Stop listening for connections. * * Existing connections are not affected. * * @since 0.1.0 */ - void stop(); + void stop(); - /** + /** * Get the maximum number of concurrent open connections. * * @return The maximum number of concurrent open connections. * @since 0.1.0 */ - size_t maximum_connections() const; - /** + size_t maximum_connections() const; + /** * Set the maximum number of concurrent open connections. * * Defaults to TelnetService::MAX_CONNECTIONS. * * @since 0.1.0 */ - void maximum_connections(size_t count); + void maximum_connections(size_t count); - /** + /** * Get the initial idle timeout for new connections. * * @return The initial idle timeout in seconds (or 0 for disabled). * @since 0.1.0 */ - unsigned long initial_idle_timeout() const; - /** + unsigned long initial_idle_timeout() const; + /** * Set the initial idle timeout for new connections. * * Defaults to TelnetService::DEFAULT_IDLE_TIMEOUT. @@ -338,17 +341,17 @@ public: * @param[in] timeout Idle timeout in seconds (or 0 to disable). * @since 0.1.0 */ - void initial_idle_timeout(unsigned long timeout); + void initial_idle_timeout(unsigned long timeout); - /** + /** * Get the default socket write timeout for new connections. * * @return The default socket write timeout in seconds (or 0 for * platform default). * @since 0.1.0 */ - unsigned long default_write_timeout() const; - /** + unsigned long default_write_timeout() const; + /** * Set the default socket write timeout for new connections. * * Defaults to TelnetService::DEFAULT_WRITE_TIMEOUT (platform @@ -358,26 +361,26 @@ public: * platform default). * @since 0.1.0 */ - void default_write_timeout(unsigned long timeout); + void default_write_timeout(unsigned long timeout); - /** + /** * Accept new connections. * * @since 0.1.0 */ - void loop(); + void loop(); -private: - /** + private: + /** * Telnet connection. * * Holds the client and stream instance for the lifetime of the shell. * * @since 0.1.0 */ - class Connection { - public: - /** + class Connection { + public: + /** * Create a telnet connection shell. * * @param[in] shell_factory Function to create a shell for new connections. @@ -386,52 +389,52 @@ private: * @param[in] write_timeout Idle timeout in milliseconds. * @since 0.1.0 */ - Connection(shell_factory_function &shell_factory, WiFiClient &&client, unsigned long idle_timeout, unsigned long write_timeout); - ~Connection() = default; + Connection(shell_factory_function & shell_factory, WiFiClient && client, unsigned long idle_timeout, unsigned long write_timeout); + ~Connection() = default; - /** + /** * Check if the shell is still active. * * @return Active status of the shell. * @since 0.1.0 */ - bool active(); - /** + bool active(); + /** * Stop the shell if the client is not connected. * * @return Active status of the shell. * @since 0.1.0 */ - bool loop(); - /** + bool loop(); + /** * Stop the shell. * * @since 0.1.0 */ - void stop(); + void stop(); - private: - Connection(const Connection&) = delete; - Connection& operator=(const Connection&) = delete; + private: + Connection(const Connection &) = delete; + Connection & operator=(const Connection &) = delete; - WiFiClient client_; /*!< Client connection. @since 0.1.0 */ - TelnetStream stream_; /*!< Telnet stream for the connection. @since 0.1.0 */ - std::shared_ptr shell_; /*!< Shell for connection. @since 0.1.0 */ - IPAddress addr_; /*!< Remote address of connection. @since 0.1.0 */ - uint16_t port_; /*!< Remote port of connection. @since 0.1.0 */ - }; + WiFiClient client_; /*!< Client connection. @since 0.1.0 */ + TelnetStream stream_; /*!< Telnet stream for the connection. @since 0.1.0 */ + std::shared_ptr shell_; /*!< Shell for connection. @since 0.1.0 */ + IPAddress addr_; /*!< Remote address of connection. @since 0.1.0 */ + uint16_t port_; /*!< Remote port of connection. @since 0.1.0 */ + }; - TelnetService(const TelnetService&) = delete; - TelnetService& operator=(const TelnetService&) = delete; + TelnetService(const TelnetService &) = delete; + TelnetService & operator=(const TelnetService &) = delete; - static uuid::log::Logger logger_; /*!< uuid::log::Logger instance for telnet services. @since 0.1.0 */ + static uuid::log::Logger logger_; /*!< uuid::log::Logger instance for telnet services. @since 0.1.0 */ - WiFiServer server_; /*!< TCP server. @since 0.1.0 */ - size_t maximum_connections_ = MAX_CONNECTIONS; /*!< Maximum number of concurrent open connections. @since 0.1.0 */ - std::list connections_; /*!< Open connections. @since 0.1.0 */ - shell_factory_function shell_factory_; /*!< Function to create a shell. @since 0.1.0 */ - unsigned long initial_idle_timeout_ = DEFAULT_IDLE_TIMEOUT; /*!< Initial idle timeout (in seconds). @since 0.1.0 */ - unsigned long write_timeout_ = DEFAULT_WRITE_TIMEOUT; /*!< Write timeout (in milliseconds). @since 0.1.0 */ + WiFiServer server_; /*!< TCP server. @since 0.1.0 */ + size_t maximum_connections_ = MAX_CONNECTIONS; /*!< Maximum number of concurrent open connections. @since 0.1.0 */ + std::list connections_; /*!< Open connections. @since 0.1.0 */ + shell_factory_function shell_factory_; /*!< Function to create a shell. @since 0.1.0 */ + unsigned long initial_idle_timeout_ = DEFAULT_IDLE_TIMEOUT; /*!< Initial idle timeout (in seconds). @since 0.1.0 */ + unsigned long write_timeout_ = DEFAULT_WRITE_TIMEOUT; /*!< Write timeout (in milliseconds). @since 0.1.0 */ }; } // namespace telnet diff --git a/lib_standalone/AsyncMqttClient.h b/lib_standalone/AsyncMqttClient.h index 1a7e6d29f..770480242 100644 --- a/lib_standalone/AsyncMqttClient.h +++ b/lib_standalone/AsyncMqttClient.h @@ -26,12 +26,12 @@ struct AsyncMqttClientMessageProperties { namespace AsyncMqttClientInternals { -typedef std::function OnConnectUserCallback; -typedef std::function OnDisconnectUserCallback; -typedef std::function OnSubscribeUserCallback; -typedef std::function OnUnsubscribeUserCallback; +typedef std::function OnConnectUserCallback; +typedef std::function OnDisconnectUserCallback; +typedef std::function OnSubscribeUserCallback; +typedef std::function OnUnsubscribeUserCallback; typedef std::function OnMessageUserCallback; -typedef std::function OnPublishUserCallback; +typedef std::function OnPublishUserCallback; }; // namespace AsyncMqttClientInternals class AsyncMqttClient { diff --git a/lib_standalone/HttpEndpoint.h b/lib_standalone/HttpEndpoint.h index 10442d03f..f06662702 100644 --- a/lib_standalone/HttpEndpoint.h +++ b/lib_standalone/HttpEndpoint.h @@ -13,120 +13,111 @@ template class HttpGetEndpoint { - public: - HttpGetEndpoint(JsonStateReader stateReader, - StatefulService* statefulService, - AsyncWebServer* server, - const String& servicePath, - SecurityManager* securityManager, - AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN, - size_t bufferSize = DEFAULT_BUFFER_SIZE) : - _stateReader(stateReader), _statefulService(statefulService), _bufferSize(bufferSize) { - } + public: + HttpGetEndpoint(JsonStateReader stateReader, + StatefulService * statefulService, + AsyncWebServer * server, + const String & servicePath, + SecurityManager * securityManager, + AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN, + size_t bufferSize = DEFAULT_BUFFER_SIZE) + : _stateReader(stateReader) + , _statefulService(statefulService) + , _bufferSize(bufferSize) { + } - HttpGetEndpoint(JsonStateReader stateReader, - StatefulService* statefulService, - AsyncWebServer* server, - const String& servicePath, - size_t bufferSize = DEFAULT_BUFFER_SIZE) : - _stateReader(stateReader), _statefulService(statefulService), _bufferSize(bufferSize) { - } + HttpGetEndpoint(JsonStateReader stateReader, + StatefulService * statefulService, + AsyncWebServer * server, + const String & servicePath, + size_t bufferSize = DEFAULT_BUFFER_SIZE) + : _stateReader(stateReader) + , _statefulService(statefulService) + , _bufferSize(bufferSize) { + } - protected: - JsonStateReader _stateReader; - StatefulService* _statefulService; - size_t _bufferSize; + protected: + JsonStateReader _stateReader; + StatefulService * _statefulService; + size_t _bufferSize; - void fetchSettings(AsyncWebServerRequest* request) { - } + void fetchSettings(AsyncWebServerRequest * request) { + } }; template class HttpPostEndpoint { - public: - HttpPostEndpoint(JsonStateReader stateReader, - JsonStateUpdater stateUpdater, - StatefulService* statefulService, - AsyncWebServer* server, - const String& servicePath, - SecurityManager* securityManager, - AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN, - size_t bufferSize = DEFAULT_BUFFER_SIZE) : - _stateReader(stateReader), - _stateUpdater(stateUpdater), - _statefulService(statefulService), - _bufferSize(bufferSize) { - } - - HttpPostEndpoint(JsonStateReader stateReader, - JsonStateUpdater stateUpdater, - StatefulService* statefulService, - AsyncWebServer* server, - const String& servicePath, - size_t bufferSize = DEFAULT_BUFFER_SIZE) : - _stateReader(stateReader), - _stateUpdater(stateUpdater), - _statefulService(statefulService), - _bufferSize(bufferSize) { - } - - protected: - JsonStateReader _stateReader; - JsonStateUpdater _stateUpdater; - StatefulService* _statefulService; - size_t _bufferSize; - - void updateSettings(AsyncWebServerRequest* request, JsonVariant& json) { - if (!json.is()) { - return; + public: + HttpPostEndpoint(JsonStateReader stateReader, + JsonStateUpdater stateUpdater, + StatefulService * statefulService, + AsyncWebServer * server, + const String & servicePath, + SecurityManager * securityManager, + AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN, + size_t bufferSize = DEFAULT_BUFFER_SIZE) + : _stateReader(stateReader) + , _stateUpdater(stateUpdater) + , _statefulService(statefulService) + , _bufferSize(bufferSize) { } - JsonObject jsonObject = json.as(); - StateUpdateResult outcome = _statefulService->updateWithoutPropagation(jsonObject, _stateUpdater); - if (outcome == StateUpdateResult::ERROR) { - return; + + HttpPostEndpoint(JsonStateReader stateReader, + JsonStateUpdater stateUpdater, + StatefulService * statefulService, + AsyncWebServer * server, + const String & servicePath, + size_t bufferSize = DEFAULT_BUFFER_SIZE) + : _stateReader(stateReader) + , _stateUpdater(stateUpdater) + , _statefulService(statefulService) + , _bufferSize(bufferSize) { } - if (outcome == StateUpdateResult::CHANGED) { + + protected: + JsonStateReader _stateReader; + JsonStateUpdater _stateUpdater; + StatefulService * _statefulService; + size_t _bufferSize; + + void updateSettings(AsyncWebServerRequest * request, JsonVariant & json) { + if (!json.is()) { + return; + } + JsonObject jsonObject = json.as(); + StateUpdateResult outcome = _statefulService->updateWithoutPropagation(jsonObject, _stateUpdater); + if (outcome == StateUpdateResult::ERROR) { + return; + } + if (outcome == StateUpdateResult::CHANGED) { + } } - } }; template class HttpEndpoint : public HttpGetEndpoint, public HttpPostEndpoint { - public: - HttpEndpoint(JsonStateReader stateReader, - JsonStateUpdater stateUpdater, - StatefulService* statefulService, - AsyncWebServer* server, - const String& servicePath, - SecurityManager* securityManager, - AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN, - size_t bufferSize = DEFAULT_BUFFER_SIZE) : - HttpGetEndpoint(stateReader, - statefulService, - server, - servicePath, - securityManager, - authenticationPredicate, - bufferSize), - HttpPostEndpoint(stateReader, - stateUpdater, - statefulService, - server, - servicePath, - securityManager, - authenticationPredicate, - bufferSize) { - } + public: + HttpEndpoint(JsonStateReader stateReader, + JsonStateUpdater stateUpdater, + StatefulService * statefulService, + AsyncWebServer * server, + const String & servicePath, + SecurityManager * securityManager, + AuthenticationPredicate authenticationPredicate = AuthenticationPredicates::IS_ADMIN, + size_t bufferSize = DEFAULT_BUFFER_SIZE) + : HttpGetEndpoint(stateReader, statefulService, server, servicePath, securityManager, authenticationPredicate, bufferSize) + , HttpPostEndpoint(stateReader, stateUpdater, statefulService, server, servicePath, securityManager, authenticationPredicate, bufferSize) { + } - HttpEndpoint(JsonStateReader stateReader, - JsonStateUpdater stateUpdater, - StatefulService* statefulService, - AsyncWebServer* server, - const String& servicePath, - size_t bufferSize = DEFAULT_BUFFER_SIZE) : - HttpGetEndpoint(stateReader, statefulService, server, servicePath, bufferSize), - HttpPostEndpoint(stateReader, stateUpdater, statefulService, server, servicePath, bufferSize) { - } + HttpEndpoint(JsonStateReader stateReader, + JsonStateUpdater stateUpdater, + StatefulService * statefulService, + AsyncWebServer * server, + const String & servicePath, + size_t bufferSize = DEFAULT_BUFFER_SIZE) + : HttpGetEndpoint(stateReader, statefulService, server, servicePath, bufferSize) + , HttpPostEndpoint(stateReader, stateUpdater, statefulService, server, servicePath, bufferSize) { + } }; #endif diff --git a/lib_standalone/Network.h b/lib_standalone/Network.h index 857ff4a0e..836167df5 100644 --- a/lib_standalone/Network.h +++ b/lib_standalone/Network.h @@ -61,51 +61,51 @@ typedef enum { } wifi_auth_mode_t; typedef struct { - uint32_t status; /**< status of scanning APs: 0 — success, 1 - failure */ - uint8_t number; /**< number of scan results */ - uint8_t scan_id; /**< scan sequence number, used for block scan */ + uint32_t status; /**< status of scanning APs: 0 — success, 1 - failure */ + uint8_t number; /**< number of scan results */ + uint8_t scan_id; /**< scan sequence number, used for block scan */ } wifi_event_sta_scan_done_t; /** Argument structure for WIFI_EVENT_STA_CONNECTED event */ typedef struct { - uint8_t ssid[32]; /**< SSID of connected AP */ - uint8_t ssid_len; /**< SSID length of connected AP */ - uint8_t bssid[6]; /**< BSSID of connected AP*/ - uint8_t channel; /**< channel of connected AP*/ - wifi_auth_mode_t authmode;/**< authentication mode used by AP*/ + uint8_t ssid[32]; /**< SSID of connected AP */ + uint8_t ssid_len; /**< SSID length of connected AP */ + uint8_t bssid[6]; /**< BSSID of connected AP*/ + uint8_t channel; /**< channel of connected AP*/ + wifi_auth_mode_t authmode; /**< authentication mode used by AP*/ } wifi_event_sta_connected_t; /** Argument structure for WIFI_EVENT_STA_DISCONNECTED event */ typedef struct { - uint8_t ssid[32]; /**< SSID of disconnected AP */ - uint8_t ssid_len; /**< SSID length of disconnected AP */ - uint8_t bssid[6]; /**< BSSID of disconnected AP */ - uint8_t reason; /**< reason of disconnection */ + uint8_t ssid[32]; /**< SSID of disconnected AP */ + uint8_t ssid_len; /**< SSID length of disconnected AP */ + uint8_t bssid[6]; /**< BSSID of disconnected AP */ + uint8_t reason; /**< reason of disconnection */ } wifi_event_sta_disconnected_t; /** Argument structure for WIFI_EVENT_STA_AUTHMODE_CHANGE event */ typedef struct { - wifi_auth_mode_t old_mode; /**< the old auth mode of AP */ - wifi_auth_mode_t new_mode; /**< the new auth mode of AP */ + wifi_auth_mode_t old_mode; /**< the old auth mode of AP */ + wifi_auth_mode_t new_mode; /**< the new auth mode of AP */ } wifi_event_sta_authmode_change_t; /** Argument structure for WIFI_EVENT_STA_WPS_ER_PIN event */ typedef struct { - uint8_t pin_code[8]; /**< PIN code of station in enrollee mode */ + uint8_t pin_code[8]; /**< PIN code of station in enrollee mode */ } wifi_event_sta_wps_er_pin_t; /** Argument structure for WIFI_EVENT_STA_WPS_ER_FAILED event */ typedef enum { - WPS_FAIL_REASON_NORMAL = 0, /**< ESP32 WPS normal fail reason */ - WPS_FAIL_REASON_RECV_M2D, /**< ESP32 WPS receive M2D frame */ + WPS_FAIL_REASON_NORMAL = 0, /**< ESP32 WPS normal fail reason */ + WPS_FAIL_REASON_RECV_M2D, /**< ESP32 WPS receive M2D frame */ WPS_FAIL_REASON_MAX } wifi_event_sta_wps_fail_reason_t; typedef union { - wifi_event_sta_scan_done_t wifi_scan_done; - wifi_event_sta_authmode_change_t wifi_sta_authmode_change; - wifi_event_sta_connected_t wifi_sta_connected; - wifi_event_sta_disconnected_t wifi_sta_disconnected; + wifi_event_sta_scan_done_t wifi_scan_done; + wifi_event_sta_authmode_change_t wifi_sta_authmode_change; + wifi_event_sta_connected_t wifi_sta_connected; + wifi_event_sta_disconnected_t wifi_sta_disconnected; } arduino_event_info_t; typedef struct { diff --git a/lib_standalone/SecuritySettingsService.cpp b/lib_standalone/SecuritySettingsService.cpp index bfdc0a211..fbe83bf7f 100644 --- a/lib_standalone/SecuritySettingsService.cpp +++ b/lib_standalone/SecuritySettingsService.cpp @@ -4,139 +4,136 @@ #include "../../src/emsesp_stub.h" // proddy added -SecuritySettingsService::SecuritySettingsService(AsyncWebServer* server, FS* fs) : - _httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this), - _fsPersistence(SecuritySettings::read, SecuritySettings::update, this, fs, SECURITY_SETTINGS_FILE), - _jwtHandler(FACTORY_JWT_SECRET) { - addUpdateHandler([&](const String& originId) { configureJWTHandler(); }, false); +SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs) + : _httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this) + , _fsPersistence(SecuritySettings::read, SecuritySettings::update, this, fs, SECURITY_SETTINGS_FILE) + , _jwtHandler(FACTORY_JWT_SECRET) { + addUpdateHandler([&](const String & originId) { configureJWTHandler(); }, false); } void SecuritySettingsService::begin() { - _fsPersistence.readFromFS(); - configureJWTHandler(); + _fsPersistence.readFromFS(); + configureJWTHandler(); } -Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest* request) { - AsyncWebHeader* authorizationHeader = request->getHeader(AUTHORIZATION_HEADER); - if (authorizationHeader) { - String value = authorizationHeader->value(); - if (value.startsWith(AUTHORIZATION_HEADER_PREFIX)) { - value = value.substring(AUTHORIZATION_HEADER_PREFIX_LEN); - return authenticateJWT(value); +Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest * request) { + AsyncWebHeader * authorizationHeader = request->getHeader(AUTHORIZATION_HEADER); + if (authorizationHeader) { + String value = authorizationHeader->value(); + if (value.startsWith(AUTHORIZATION_HEADER_PREFIX)) { + value = value.substring(AUTHORIZATION_HEADER_PREFIX_LEN); + return authenticateJWT(value); + } + } else if (request->hasParam(ACCESS_TOKEN_PARAMATER)) { + AsyncWebParameter * tokenParamater = request->getParam(ACCESS_TOKEN_PARAMATER); + String value = tokenParamater->value(); + return authenticateJWT(value); } - } else if (request->hasParam(ACCESS_TOKEN_PARAMATER)) { - AsyncWebParameter* tokenParamater = request->getParam(ACCESS_TOKEN_PARAMATER); - String value = tokenParamater->value(); - return authenticateJWT(value); - } - return Authentication(); + return Authentication(); } void SecuritySettingsService::configureJWTHandler() { - _jwtHandler.setSecret(_state.jwtSecret); + _jwtHandler.setSecret(_state.jwtSecret); } -Authentication SecuritySettingsService::authenticateJWT(String& jwt) { - DynamicJsonDocument payloadDocument(MAX_JWT_SIZE); - _jwtHandler.parseJWT(jwt, payloadDocument); - if (payloadDocument.is()) { - JsonObject parsedPayload = payloadDocument.as(); - String username = parsedPayload["username"]; +Authentication SecuritySettingsService::authenticateJWT(String & jwt) { + DynamicJsonDocument payloadDocument(MAX_JWT_SIZE); + _jwtHandler.parseJWT(jwt, payloadDocument); + if (payloadDocument.is()) { + JsonObject parsedPayload = payloadDocument.as(); + String username = parsedPayload["username"]; + for (User _user : _state.users) { + if (_user.username == username && validatePayload(parsedPayload, &_user)) { + return Authentication(_user); + } + } + } + return Authentication(); +} + +Authentication SecuritySettingsService::authenticate(const String & username, const String & password) { for (User _user : _state.users) { - if (_user.username == username && validatePayload(parsedPayload, &_user)) { - return Authentication(_user); - } + if (_user.username == username && _user.password == password) { + return Authentication(_user); + } } - } - return Authentication(); + return Authentication(); } -Authentication SecuritySettingsService::authenticate(const String& username, const String& password) { - for (User _user : _state.users) { - if (_user.username == username && _user.password == password) { - return Authentication(_user); - } - } - return Authentication(); +inline void populateJWTPayload(JsonObject & payload, User * user) { + payload["username"] = user->username; + payload["admin"] = user->admin; } -inline void populateJWTPayload(JsonObject& payload, User* user) { - payload["username"] = user->username; - payload["admin"] = user->admin; +boolean SecuritySettingsService::validatePayload(JsonObject & parsedPayload, User * user) { + DynamicJsonDocument jsonDocument(MAX_JWT_SIZE); + JsonObject payload = jsonDocument.to(); + populateJWTPayload(payload, user); + return payload == parsedPayload; } -boolean SecuritySettingsService::validatePayload(JsonObject& parsedPayload, User* user) { - DynamicJsonDocument jsonDocument(MAX_JWT_SIZE); - JsonObject payload = jsonDocument.to(); - populateJWTPayload(payload, user); - return payload == parsedPayload; -} - -String SecuritySettingsService::generateJWT(User* user) { - DynamicJsonDocument jsonDocument(MAX_JWT_SIZE); - JsonObject payload = jsonDocument.to(); - populateJWTPayload(payload, user); - return _jwtHandler.buildJWT(payload); +String SecuritySettingsService::generateJWT(User * user) { + DynamicJsonDocument jsonDocument(MAX_JWT_SIZE); + JsonObject payload = jsonDocument.to(); + populateJWTPayload(payload, user); + return _jwtHandler.buildJWT(payload); } ArRequestFilterFunction SecuritySettingsService::filterRequest(AuthenticationPredicate predicate) { - return [this, predicate](AsyncWebServerRequest* request) { - Authentication authentication = authenticateRequest(request); - return predicate(authentication); - }; + return [this, predicate](AsyncWebServerRequest * request) { + Authentication authentication = authenticateRequest(request); + return predicate(authentication); + }; } -ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest, - AuthenticationPredicate predicate) { - return [this, onRequest, predicate](AsyncWebServerRequest* request) { - Authentication authentication = authenticateRequest(request); - if (!predicate(authentication)) { - request->send(401); - return; - } - onRequest(request); - }; +ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest, AuthenticationPredicate predicate) { + return [this, onRequest, predicate](AsyncWebServerRequest * request) { + Authentication authentication = authenticateRequest(request); + if (!predicate(authentication)) { + request->send(401); + return; + } + onRequest(request); + }; } -ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest, - AuthenticationPredicate predicate) { - return [this, onRequest, predicate](AsyncWebServerRequest* request, JsonVariant& json) { - Authentication authentication = authenticateRequest(request); - if (!predicate(authentication)) { - request->send(401); - return; - } - onRequest(request, json); - }; +ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest, AuthenticationPredicate predicate) { + return [this, onRequest, predicate](AsyncWebServerRequest * request, JsonVariant & json) { + Authentication authentication = authenticateRequest(request); + if (!predicate(authentication)) { + request->send(401); + return; + } + onRequest(request, json); + }; } #else User ADMIN_USER = User(FACTORY_ADMIN_USERNAME, FACTORY_ADMIN_PASSWORD, true); -SecuritySettingsService::SecuritySettingsService(AsyncWebServer* server, FS* fs) : SecurityManager() { +SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs) + : SecurityManager() { } SecuritySettingsService::~SecuritySettingsService() { } ArRequestFilterFunction SecuritySettingsService::filterRequest(AuthenticationPredicate predicate) { - return [this, predicate](AsyncWebServerRequest* request) { return true; }; + return [this, predicate](AsyncWebServerRequest * request) { return true; }; } // Return the admin user on all request - disabling security features -Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest* request) { - return Authentication(ADMIN_USER); +Authentication SecuritySettingsService::authenticateRequest(AsyncWebServerRequest * request) { + return Authentication(ADMIN_USER); } // Return the function unwrapped -ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest, - AuthenticationPredicate predicate) { - return onRequest; +ArRequestHandlerFunction SecuritySettingsService::wrapRequest(ArRequestHandlerFunction onRequest, AuthenticationPredicate predicate) { + return onRequest; } -ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest, - AuthenticationPredicate predicate) { - return onRequest; +ArJsonRequestHandlerFunction SecuritySettingsService::wrapCallback(ArJsonRequestHandlerFunction onRequest, AuthenticationPredicate predicate) { + return onRequest; } #endif diff --git a/lib_standalone/StatefulService.h b/lib_standalone/StatefulService.h index 4b9d8dea1..d45195cc2 100644 --- a/lib_standalone/StatefulService.h +++ b/lib_standalone/StatefulService.h @@ -16,10 +16,10 @@ #endif enum class StateUpdateResult { - CHANGED = 0, // The update changed the state and propagation should take place if required + CHANGED = 0, // The update changed the state and propagation should take place if required CHANGED_RESTART, // The update changed the state and the service should be restarted - UNCHANGED, // The state was unchanged, propagation should not take place - ERROR // There was a problem updating the state, propagation should not take place + UNCHANGED, // The state was unchanged, propagation should not take place + ERROR // There was a problem updating the state, propagation should not take place }; template diff --git a/src/analogsensor.cpp b/src/analogsensor.cpp index 531e7a339..2070d8e95 100644 --- a/src/analogsensor.cpp +++ b/src/analogsensor.cpp @@ -32,7 +32,7 @@ void AnalogSensor::start() { analogSetAttenuation(ADC_2_5db); // for all channels 1.5V - LOG_INFO(("Starting Analog sensor service")); + LOG_INFO("Starting Analog sensor service"); // Add API call for /info Command::add( diff --git a/src/command.cpp b/src/command.cpp index 277c6135e..e7446c215 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -376,7 +376,7 @@ bool Command::list(const uint8_t device_type, JsonObject & output) { // output list of all commands to console for a specific DeviceType void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbose) { if (cmdfunctions_.empty()) { - shell.println(("No commands available")); + shell.println("No commands available"); return; } diff --git a/src/console.cpp b/src/console.cpp index 18880809e..f76bfb71e 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -59,12 +59,12 @@ void EMSESPShell::stopped() { // this is one of the first functions called when the shell is started void EMSESPShell::display_banner() { println(); - printfln(("┌──────────────────────────────────────┐")); + printfln("┌──────────────────────────────────────┐"); printfln(("│ %sEMS-ESP version %-10s%s │"), COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF); printfln(("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │"), COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET); - printfln(("│ │")); + printfln("│ │"); printfln(("│ type %shelp%s to show available commands │"), COLOR_UNDERLINE, COLOR_RESET); - printfln(("└──────────────────────────────────────┘")); + printfln("└──────────────────────────────────────┘"); println(); // set console name @@ -151,16 +151,16 @@ void EMSESPShell::add_console_commands() { }, "local"); } else { - shell.println(("Must be 0B, 0D, 0A, 0F or 12")); + shell.println("Must be 0B, 0D, 0A, 0F or 12"); } }, [](Shell & shell __attribute__((unused)), const std::vector & arguments __attribute__((unused))) -> const std::vector { return std::vector{ - (("0B")), - (("0D")), - (("0A")), - (("0F")), - (("12")), + ("0B"), + ("0D"), + ("0A"), + ("0F"), + ("12"), }; }); @@ -189,7 +189,7 @@ void EMSESPShell::add_console_commands() { if (arguments.size() == 0) { EMSESP::scan_devices(); } else { - shell.printfln(("Performing a deep scan...")); + shell.printfln("Performing a deep scan..."); EMSESP::clear_all_devices(); std::vector Device_Ids; @@ -240,7 +240,7 @@ void EMSESPShell::add_console_commands() { uint8_t device_id = Helpers::hextoint(arguments.front().c_str()); if (!EMSESP::valid_device(device_id)) { - shell.printfln(("Invalid deviceID")); + shell.printfln("Invalid deviceID"); return; } @@ -305,28 +305,28 @@ void EMSESPShell::add_console_commands() { EMSESP::watch_id(watch_id); } else { - shell.printfln(("Invalid: use watch raw|on|off|unknown|id [id]")); + shell.printfln("Invalid: use watch raw|on|off|unknown|id [id]"); return; } uint8_t watch = EMSESP::watch(); if (watch == EMSESP::WATCH_OFF) { - shell.printfln(("Watching telegrams is off")); + shell.printfln("Watching telegrams is off"); return; } // if logging is off, the watch won't show anything, show force it back to NOTICE if (shell.log_level() < Level::NOTICE) { shell.log_level(Level::NOTICE); - shell.printfln(("Setting log level to Notice")); + shell.printfln("Setting log level to Notice"); } if (watch == EMSESP::WATCH_ON) { - shell.printfln(("Watching incoming telegrams, displayed in decoded format")); + shell.printfln("Watching incoming telegrams, displayed in decoded format"); } else if (watch == EMSESP::WATCH_RAW) { - shell.printfln(("Watching incoming telegrams, displayed as raw bytes")); // WATCH_RAW + shell.printfln("Watching incoming telegrams, displayed as raw bytes"); // WATCH_RAW } else { - shell.printfln(("Watching unknown telegrams")); // WATCH_UNKNOWN + shell.printfln("Watching unknown telegrams"); // WATCH_UNKNOWN } watch_id = EMSESP::watch_id(); @@ -351,7 +351,7 @@ void EMSESPShell::add_console_commands() { // validate the device_type uint8_t device_type = EMSdevice::device_name_2_device_type(arguments[0].c_str()); if (!Command::device_has_commands(device_type)) { - shell.print(("Invalid device. Available devices are: ")); + shell.print("Invalid device. Available devices are: "); Command::show_devices(shell); return; } @@ -359,7 +359,7 @@ void EMSESPShell::add_console_commands() { // validate that a command is present if (arguments.size() < 2) { - shell.print(("Missing command. Available commands are: ")); + shell.print("Missing command. Available commands are: "); Command::show(shell, device_type, false); // non-verbose mode return; } @@ -399,8 +399,8 @@ void EMSESPShell::add_console_commands() { } if (return_code == CommandRet::NOT_FOUND) { - shell.println(("Unknown command")); - shell.print(("Available commands are: ")); + shell.println("Unknown command"); + shell.print("Available commands are: "); Command::show(shell, device_type, false); // non-verbose mode } else if (return_code != CommandRet::OK) { shell.printfln(("Bad syntax (error code %d)"), return_code); @@ -494,7 +494,7 @@ void Console::load_standard_commands(unsigned int context) { return; } } else { - shell.print(("levels: ")); + shell.print("levels: "); std::vector v = uuid::log::levels_lowercase(); size_t i = v.size(); while (i--) { @@ -543,7 +543,7 @@ void Console::load_standard_commands(unsigned int context) { } else { shell.delay_until(now + INVALID_PASSWORD_DELAY_MS, [](Shell & shell) { shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, ("Invalid su password on console")); - shell.println(("su: incorrect password")); + shell.println("su: incorrect password"); }); } }); @@ -579,7 +579,7 @@ void Console::load_system_commands(unsigned int context) { if (securitySettings.jwtSecret.equals(password.c_str())) { EMSESP::system_.format(shell); } else { - shell.println(("incorrect password")); + shell.println("incorrect password"); } }); } @@ -602,9 +602,9 @@ void Console::load_system_commands(unsigned int context) { return StateUpdateResult::CHANGED; }, "local"); - shell.println(("su password updated")); + shell.println("su password updated"); } else { - shell.println(("Passwords do not match")); + shell.println("Passwords do not match"); } } }); @@ -675,7 +675,7 @@ void Console::load_system_commands(unsigned int context) { }); shell.println("Use `wifi reconnect` to save and apply the new settings"); } else { - shell.println(("Passwords do not match")); + shell.println("Passwords do not match"); } } }); @@ -737,7 +737,7 @@ EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, bool local) : uuid::console::Shell(commands, ShellContext::MAIN, local ? (CommandFlags::USER | CommandFlags::LOCAL) : CommandFlags::USER) , uuid::console::StreamConsole(stream) , EMSESPShell() - , name_((("Serial"))) + , name_(("Serial")) , pty_(SIZE_MAX) , addr_() , port_(0) { diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index 32635c748..1c2d211bb 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -42,7 +42,7 @@ void DallasSensor::start() { #ifndef EMSESP_STANDALONE bus_.begin(dallas_gpio_); - LOG_INFO(("Starting Dallas sensor service")); + LOG_INFO("Starting Dallas sensor service"); #endif // Add API calls @@ -84,7 +84,7 @@ void DallasSensor::loop() { if (state_ == State::IDLE) { if (time_now - last_activity_ >= READ_INTERVAL_MS) { #ifdef EMSESP_DEBUG_SENSOR - LOG_DEBUG(("[DEBUG] Read sensor temperature")); + LOG_DEBUG("[DEBUG] Read sensor temperature"); #endif if (bus_.reset() || parasite_) { YIELD; @@ -99,7 +99,7 @@ void DallasSensor::loop() { if (++scanretry_ > SCAN_MAX) { // every 30 sec scanretry_ = 0; #ifdef EMSESP_DEBUG_SENSOR - LOG_ERROR(("Bus reset failed")); + LOG_ERROR("Bus reset failed"); #endif for (auto & sensor : sensors_) { sensor.temperature_c = EMS_VALUE_SHORT_NOTSET; @@ -112,13 +112,13 @@ void DallasSensor::loop() { } else if (state_ == State::READING) { if (temperature_convert_complete() && (time_now - last_activity_ > CONVERSION_MS)) { #ifdef EMSESP_DEBUG_SENSOR - LOG_DEBUG(("Scanning for sensors")); + LOG_DEBUG("Scanning for sensors"); #endif bus_.reset_search(); state_ = State::SCANNING; } else if (time_now - last_activity_ > READ_TIMEOUT_MS) { #ifdef EMSESP_DEBUG_SENSOR - LOG_WARNING(("Dallas sensor read timeout")); + LOG_WARNING("Dallas sensor read timeout"); #endif state_ = State::IDLE; sensorfails_++; @@ -126,7 +126,7 @@ void DallasSensor::loop() { } else if (state_ == State::SCANNING) { if (time_now - last_activity_ > SCAN_TIMEOUT_MS) { #ifdef EMSESP_DEBUG_SENSOR - LOG_ERROR(("Dallas sensor scan timeout")); + LOG_ERROR("Dallas sensor scan timeout"); #endif state_ = State::IDLE; sensorfails_++; diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index def57f8c4..281f3f8dc 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -2083,9 +2083,9 @@ bool Boiler::set_ww_circulation_mode(const char * value, const int8_t id) { if (v < 7) { // LOG_INFO(("Setting dhw circulation mode %dx3min"), v); } else if (v == 7) { - // LOG_INFO(("Setting dhw circulation mode continuous")); + // LOG_INFO("Setting dhw circulation mode continuous"); } else { - // LOG_WARNING(("Set dhw circulation mode: Invalid value")); + // LOG_WARNING("Set dhw circulation mode: Invalid value"); return false; } @@ -2109,12 +2109,12 @@ bool Boiler::set_reset(const char * value, const int8_t id) { } if (num == 1) { - // LOG_INFO(("Reset boiler maintenance message")); + // LOG_INFO("Reset boiler maintenance message"); write_command(0x05, 0x08, 0xFF, 0x1C); has_update(&reset_); return true; } else if (num == 2) { - // LOG_INFO(("Reset boiler error message")); + // LOG_INFO("Reset boiler error message"); write_command(0x05, 0x00, 0x5A); // error reset has_update(&reset_); return true; @@ -2131,7 +2131,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { std::string s; if (Helpers::value2string(value, s)) { if (s == Helpers::translated_word(FL_(reset))) { - // LOG_INFO(("Reset boiler maintenance message")); + // LOG_INFO("Reset boiler maintenance message"); write_command(0x05, 0x08, 0xFF, 0x1C); return true; } @@ -2169,7 +2169,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { return true; } - LOG_WARNING(("Setting maintenance: wrong format")); + LOG_WARNING("Setting maintenance: wrong format"); return false; } //maintenance @@ -2183,7 +2183,7 @@ bool Boiler::set_maintenancetime(const char * value, const int8_t id) { return true; } } - LOG_WARNING(("Setting maintenance: wrong format")); + LOG_WARNING("Setting maintenance: wrong format"); return false; } @@ -2204,7 +2204,7 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) { return true; } - LOG_WARNING(("Setting maintenance: wrong format")); + LOG_WARNING("Setting maintenance: wrong format"); return false; } diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index b67926910..4486e09bb 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -1369,7 +1369,7 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { double difference = difftime(now, ttime); if (difference > 15 || difference < -15) { set_datetime("ntp", -1); // set from NTP - LOG_INFO(("thermostat time correction from ntp")); + LOG_INFO("thermostat time correction from ntp"); } } #ifndef EMSESP_STANDALONE @@ -1380,7 +1380,7 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { } struct timeval newnow = {.tv_sec = ttime}; settimeofday(&newnow, nullptr); - LOG_INFO(("ems-esp time set from thermostat")); + LOG_INFO("ems-esp time set from thermostat"); } #endif } @@ -2132,7 +2132,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { return false; } if (!EMSESP::system_.ntp_connected()) { - LOG_WARNING(("Set date: no valid NTP data, setting from ESP Clock")); + LOG_WARNING("Set date: no valid NTP data, setting from ESP Clock"); } data[0] = tm_->tm_year - 100; // Bosch counts from 2000 @@ -2153,7 +2153,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { data[6] = (dt[20] - '0'); // day of week, Mo:0 data[7] = (dt[22] - '0') + 2; // DST and flag } else { - LOG_WARNING(("Set date: invalid data, wrong length")); + LOG_WARNING("Set date: invalid data, wrong length"); return false; } if (data[1] == 0 || data[1] > 12 || data[2] > 23 || data[3] == 0 || data[3] > 31 || data[4] > 59 || data[5] > 59 || data[6] > 6 || data[7] > 3) { diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index d0f259d8d..093f18dec 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -62,19 +62,19 @@ std::string EMSdevice::uom_to_string(uint8_t uom) { std::string EMSdevice::brand_to_string() const { switch (brand_) { case EMSdevice::Brand::BOSCH: - return (("Bosch")); + return ("Bosch"); case EMSdevice::Brand::JUNKERS: - return (("Junkers")); + return ("Junkers"); case EMSdevice::Brand::BUDERUS: - return (("Buderus")); + return ("Buderus"); case EMSdevice::Brand::NEFIT: - return (("Nefit")); + return ("Nefit"); case EMSdevice::Brand::SIEGER: - return (("Sieger")); + return ("Sieger"); case EMSdevice::Brand::WORCESTER: - return (("Worcester")); + return ("Worcester"); case EMSdevice::Brand::IVT: - return (("IVT")); + return ("IVT"); default: return (("")); } @@ -302,28 +302,28 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const { } shell.printf(COLOR_RESET); */ - shell.printf((" Received telegram type IDs: ")); + shell.printf(" Received telegram type IDs: "); for (const auto & tf : telegram_functions_) { if (tf.received_ && !tf.fetch_) { shell.printf(("0x%02X "), tf.telegram_type_id_); } } shell.println(); - shell.printf((" Fetched telegram type IDs: ")); + shell.printf(" Fetched telegram type IDs: "); for (const auto & tf : telegram_functions_) { if (tf.fetch_) { shell.printf(("0x%02X "), tf.telegram_type_id_); } } shell.println(); - shell.printf((" Pending telegram type IDs: ")); + shell.printf(" Pending telegram type IDs: "); for (const auto & tf : telegram_functions_) { if (!tf.received_ && !tf.fetch_) { shell.printf(("0x%02X "), tf.telegram_type_id_); } } shell.println(); - shell.printf((" Ignored telegram type IDs: ")); + shell.printf(" Ignored telegram type IDs: "); for (auto handlers : handlers_ignored_) { shell.printf(("0x%02X "), handlers); } @@ -1467,9 +1467,9 @@ bool EMSdevice::has_telegram_id(uint16_t id) const { std::string EMSdevice::telegram_type_name(std::shared_ptr telegram) const { // see if it's one of the common ones, like Version if (telegram->type_id == EMS_TYPE_VERSION) { - return (("Version")); + return ("Version"); } else if (telegram->type_id == EMS_TYPE_UBADevices) { - return (("UBADevices")); + return ("UBADevices"); } for (const auto & tf : telegram_functions_) { diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 95b9a1bce..0582a7384 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -190,7 +190,7 @@ void EMSESP::uart_init() { if (System::is_valid_gpio(rx_gpio) && System::is_valid_gpio(tx_gpio)) { EMSuart::start(tx_mode, rx_gpio, tx_gpio); // start UART } else { - LOG_WARNING(("Invalid UART Rx/Tx GPIOs. Check config.")); + LOG_WARNING("Invalid UART Rx/Tx GPIOs. Check config."); } txservice_.start(); // sends out request to EMS bus for all devices @@ -234,20 +234,20 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { // EMS bus information switch (bus_status()) { case BUS_STATUS_OFFLINE: - shell.printfln(("EMS Bus is disconnected.")); + shell.printfln("EMS Bus is disconnected."); break; case BUS_STATUS_TX_ERRORS: - shell.printfln(("EMS Bus is connected, but Tx is not stable.")); + shell.printfln("EMS Bus is connected, but Tx is not stable."); break; default: - shell.printfln(("EMS Bus is connected.")); + shell.printfln("EMS Bus is connected."); break; } shell.println(); if (bus_status() != BUS_STATUS_OFFLINE) { - shell.printfln(("EMS Bus info:")); + shell.printfln("EMS Bus info:"); EMSESP::webSettingsService.read([&](WebSettings & settings) { shell.printfln((" Tx mode: %d"), settings.tx_mode); }); shell.printfln((" Bus protocol: %s"), EMSbus::is_ht3() ? ("HT3") : ("Buderus")); shell.printfln((" #recognized EMS devices: %d"), EMSESP::emsdevices.size()); @@ -265,7 +265,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { // Rx queue auto rx_telegrams = rxservice_.queue(); if (rx_telegrams.empty()) { - shell.printfln(("Rx Queue is empty")); + shell.printfln("Rx Queue is empty"); } else { shell.printfln(("Rx Queue (%ld telegram%s):"), rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s"); for (const auto & it : rx_telegrams) { @@ -278,7 +278,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { // Tx queue auto tx_telegrams = txservice_.queue(); if (tx_telegrams.empty()) { - shell.printfln(("Tx Queue is empty")); + shell.printfln("Tx Queue is empty"); } else { shell.printfln(("Tx Queue (%ld telegram%s):"), tx_telegrams.size(), tx_telegrams.size() == 1 ? "" : "s"); @@ -301,7 +301,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { // show EMS device values to the shell console void EMSESP::show_device_values(uuid::console::Shell & shell) { if (emsdevices.empty()) { - shell.printfln(("No EMS devices detected.")); + shell.printfln("No EMS devices detected."); shell.println(); return; } @@ -359,7 +359,7 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) { // show Dallas temperature sensors and Analog sensors void EMSESP::show_sensor_values(uuid::console::Shell & shell) { if (dallassensor_.have_sensors()) { - shell.printfln(("Temperature sensors:")); + shell.printfln("Temperature sensors:"); char s[10]; char s2[10]; uint8_t fahrenheit = EMSESP::system_.fahrenheit() ? 2 : 0; @@ -384,7 +384,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) { if (analogsensor_.have_sensors()) { char s[10]; char s2[10]; - shell.printfln(("Analog sensors:")); + shell.printfln("Analog sensors:"); for (const auto & sensor : analogsensor_.sensors()) { switch (sensor.type()) { case AnalogSensor::AnalogType::ADC: @@ -537,7 +537,7 @@ void EMSESP::publish_device_values(uint8_t device_type) { } if (need_publish) { if (doc.overflowed()) { - LOG_WARNING(("MQTT buffer overflow, please use individual topics")); + LOG_WARNING("MQTT buffer overflow, please use individual topics"); } Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_NONE), json); } @@ -808,7 +808,7 @@ bool EMSESP::process_telegram(std::shared_ptr telegram) { // only process broadcast telegrams or ones sent to us on request // if ((telegram->dest != 0x00) && (telegram->dest != rxservice_.ems_bus_id())) { if (telegram->operation == Telegram::Operation::RX_READ) { - // LOG_DEBUG(("read telegram received, not processing")); + // LOG_DEBUG("read telegram received, not processing"); return false; } @@ -884,12 +884,12 @@ bool EMSESP::device_exists(const uint8_t device_id) { // for each associated EMS device go and get its system information void EMSESP::show_devices(uuid::console::Shell & shell) { if (emsdevices.empty()) { - shell.printfln(("No EMS devices detected. Try using 'scan devices' from the ems menu.")); + shell.printfln("No EMS devices detected. Try using 'scan devices' from the ems menu."); shell.println(); return; } - shell.printfln(("These EMS devices are currently active:")); + shell.printfln("These EMS devices are currently active:"); shell.println(); // count the number of thermostats @@ -1018,7 +1018,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const name = "generic boiler"; device_type = DeviceType::BOILER; flags = DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP; - LOG_WARNING(("Unknown EMS boiler. Using generic profile. Please report on GitHub.")); + LOG_WARNING("Unknown EMS boiler. Using generic profile. Please report on GitHub."); } else { LOG_WARNING(("Unrecognized EMS device (device ID 0x%02X, no product ID). Please report on GitHub."), device_id); return false; @@ -1190,14 +1190,14 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { // if we're waiting on a Write operation, we want a single byte 1 or 4 if ((tx_state == Telegram::Operation::TX_WRITE) && (length == 1)) { if (first_value == TxService::TX_WRITE_SUCCESS) { - LOG_DEBUG(("Last Tx write successful")); + LOG_DEBUG("Last Tx write successful"); txservice_.increment_telegram_write_count(); // last tx/write was confirmed ok txservice_.send_poll(); // close the bus publish_id_ = txservice_.post_send_query(); // follow up with any post-read if set txservice_.reset_retry_count(); tx_successful = true; } else if (first_value == TxService::TX_WRITE_FAIL) { - LOG_ERROR(("Last Tx write rejected by host")); + LOG_ERROR("Last Tx write rejected by host"); txservice_.send_poll(); // close the bus txservice_.reset_retry_count(); } @@ -1206,7 +1206,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { uint8_t src = data[0]; uint8_t dest = data[1]; if (txservice_.is_last_tx(src, dest)) { - LOG_DEBUG(("Last Tx read successful")); + LOG_DEBUG("Last Tx read successful"); txservice_.increment_telegram_read_count(); txservice_.send_poll(); // close the bus txservice_.reset_retry_count(); @@ -1289,14 +1289,14 @@ void EMSESP::start() { webLogService.begin(); // start web log service. now we can start capturing logs to the web log #ifdef EMSESP_DEBUG - LOG_NOTICE(("System is running in Debug mode")); + LOG_NOTICE("System is running in Debug mode"); #endif LOG_INFO(("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str()); // do any system upgrades if (system_.check_upgrade()) { - LOG_INFO(("System needs a restart to apply new settings. Please wait.")); + LOG_INFO("System needs a restart to apply new settings. Please wait."); system_.system_restart(); }; diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 1b17f41ae..83a405129 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -192,7 +192,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) { shell.println(); // show subscriptions - shell.printfln(("MQTT topic subscriptions:")); + shell.printfln("MQTT topic subscriptions:"); for (const auto & mqtt_subfunction : mqtt_subfunctions_) { shell.printfln((" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str()); } @@ -200,7 +200,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) { // show queues if (mqtt_messages_.empty()) { - shell.printfln(("MQTT queue is empty")); + shell.printfln("MQTT queue is empty"); shell.println(); return; } @@ -341,7 +341,7 @@ void Mqtt::show_topic_handlers(uuid::console::Shell & shell, const uint8_t devic return; } - // shell.print((" Subscribed MQTT topics: ")); + // shell.print(" Subscribed MQTT topics: "); // for (const auto & mqtt_subfunction : mqtt_subfunctions_) { // if (mqtt_subfunction.device_type_ == device_type) { // shell.printf(("%s "), mqtt_subfunction.topic_.c_str()); @@ -368,7 +368,7 @@ void Mqtt::on_publish(uint16_t packetId) const { // if the last published failed, don't bother checking it. wait for the next retry if (mqtt_message.packet_id_ == 0) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] ACK for failed message pid 0")); + LOG_DEBUG("[DEBUG] ACK for failed message pid 0"); #endif return; } @@ -450,15 +450,15 @@ void Mqtt::start() { } connecting_ = false; if (reason == AsyncMqttClientDisconnectReason::TCP_DISCONNECTED) { - LOG_WARNING(("MQTT disconnected: TCP")); + LOG_WARNING("MQTT disconnected: TCP"); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_IDENTIFIER_REJECTED) { - LOG_WARNING(("MQTT disconnected: Identifier Rejected")); + LOG_WARNING("MQTT disconnected: Identifier Rejected"); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_SERVER_UNAVAILABLE) { - LOG_WARNING(("MQTT disconnected: Server unavailable")); + LOG_WARNING("MQTT disconnected: Server unavailable"); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_MALFORMED_CREDENTIALS) { - LOG_WARNING(("MQTT disconnected: Malformed credentials")); + LOG_WARNING("MQTT disconnected: Malformed credentials"); } else if (reason == AsyncMqttClientDisconnectReason::MQTT_NOT_AUTHORIZED) { - LOG_WARNING(("MQTT disconnected: Not authorized")); + LOG_WARNING("MQTT disconnected: Not authorized"); } else { LOG_WARNING(("MQTT disconnected: code %d"), reason); } @@ -535,7 +535,7 @@ void Mqtt::on_connect() { return; } - LOG_INFO(("MQTT connected")); + LOG_INFO("MQTT connected"); connecting_ = true; connectcount_++; @@ -686,7 +686,7 @@ std::shared_ptr Mqtt::queue_message(const uint8_t operation, // if the queue is full, make room but removing the last one if (mqtt_messages_.size() >= MAX_MQTT_MESSAGES) { mqtt_messages_.pop_front(); - LOG_WARNING(("Queue overflow, removing one message")); + LOG_WARNING("Queue overflow, removing one message"); mqtt_publish_fails_++; } mqtt_messages_.emplace_back(mqtt_message_id_++, std::move(message)); @@ -815,7 +815,7 @@ void Mqtt::process_queue() { // it will have a real packet ID if (mqtt_message.packet_id_ > 0) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] Waiting for QOS-ACK")); + LOG_DEBUG("[DEBUG] Waiting for QOS-ACK"); #endif // if we don't get the ack within 10 minutes, republish with new packet_id if (uuid::get_uptime_sec() - last_publish_queue_ < 600) { diff --git a/src/shower.cpp b/src/shower.cpp index 56a98a8d3..bf4937649 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -57,7 +57,7 @@ void Shower::loop() { // first check to see if hot water has been on long enough to be recognized as a Shower/Bath if (!shower_state_ && (time_now - timer_start_) > SHOWER_MIN_DURATION) { set_shower_state(true); - LOG_DEBUG(("[Shower] hot water still running, starting shower timer")); + LOG_DEBUG("[Shower] hot water still running, starting shower timer"); } // check if the shower has been on too long else if ((time_now - timer_start_) > shower_alert_trigger_) { @@ -109,7 +109,7 @@ void Shower::loop() { // turn back on the hot water for the shower void Shower::shower_alert_stop() { if (doing_cold_shot_) { - LOG_DEBUG(("Shower Alert stopped")); + LOG_DEBUG("Shower Alert stopped"); (void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "true"); doing_cold_shot_ = false; } @@ -117,7 +117,7 @@ void Shower::shower_alert_stop() { // turn off hot water to send a shot of cold void Shower::shower_alert_start() { if (shower_alert_) { - LOG_DEBUG(("Shower Alert started")); + LOG_DEBUG("Shower Alert started"); (void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "false"); doing_cold_shot_ = true; alert_timer_start_ = uuid::get_uptime(); // timer starts now diff --git a/src/system.cpp b/src/system.cpp index a78044a21..0bad8d687 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -77,7 +77,7 @@ bool System::command_fetch(const char * value, const int8_t id) { std::string value_s; if (Helpers::value2string(value, value_s)) { if (value_s == "all") { - LOG_INFO(("Requesting data from EMS devices")); + LOG_INFO("Requesting data from EMS devices"); EMSESP::fetch_device_values(); return true; } else if (value_s == (F_(boiler))) { @@ -105,7 +105,7 @@ bool System::command_publish(const char * value, const int8_t id) { if (Helpers::value2string(value, value_s)) { if (value_s == "ha") { EMSESP::publish_all(true); // includes HA - LOG_INFO(("Publishing all data to MQTT, including HA configs")); + LOG_INFO("Publishing all data to MQTT, including HA configs"); return true; } else if (value_s == (F_(boiler))) { EMSESP::publish_device_values(EMSdevice::DeviceType::BOILER); @@ -129,7 +129,7 @@ bool System::command_publish(const char * value, const int8_t id) { } EMSESP::publish_all(); - LOG_INFO(("Publishing all data to MQTT")); + LOG_INFO("Publishing all data to MQTT"); return true; } @@ -192,7 +192,7 @@ bool System::command_watch(const char * value, const int8_t id) { // restart EMS-ESP void System::system_restart() { - LOG_INFO(("Restarting EMS-ESP...")); + LOG_INFO("Restarting EMS-ESP..."); Shell::loop_all(); delay(1000); // wait a second #ifndef EMSESP_STANDALONE @@ -202,7 +202,7 @@ void System::system_restart() { // saves all settings void System::wifi_reconnect() { - LOG_INFO(("WiFi reconnecting...")); + LOG_INFO("WiFi reconnecting..."); Shell::loop_all(); EMSESP::console_.loop(); delay(1000); // wait a second @@ -241,7 +241,7 @@ void System::syslog_init() { // start & configure syslog if (!was_enabled) { syslog_.start(); - EMSESP::logger().info(("Starting Syslog")); + EMSESP::logger().info("Starting Syslog"); } syslog_.log_level((uuid::log::Level)syslog_level_); syslog_.mark_interval(syslog_mark_interval_); @@ -255,7 +255,7 @@ void System::syslog_init() { } else if (was_enabled) { // in case service is still running, this flushes the queue // https://github.com/emsesp/EMS-ESP/issues/496 - EMSESP::logger().info(("Stopping Syslog")); + EMSESP::logger().info("Stopping Syslog"); syslog_.log_level((uuid::log::Level)-1); syslog_.mark_interval(0); syslog_.destination(""); @@ -399,7 +399,7 @@ void System::start() { // button single click void System::button_OnClick(PButton & b) { - LOG_DEBUG(("Button pressed - single click")); + LOG_DEBUG("Button pressed - single click"); #ifdef EMSESP_DEBUG #ifndef EMSESP_STANDALONE @@ -410,20 +410,20 @@ void System::button_OnClick(PButton & b) { // button double click void System::button_OnDblClick(PButton & b) { - LOG_DEBUG(("Button pressed - double click - reconnect")); + LOG_DEBUG("Button pressed - double click - reconnect"); EMSESP::system_.wifi_reconnect(); } // button long press void System::button_OnLongPress(PButton & b) { - LOG_DEBUG(("Button pressed - long press")); + LOG_DEBUG("Button pressed - long press"); } // button indefinite press void System::button_OnVLongPress(PButton & b) { - LOG_DEBUG(("Button pressed - very long press")); + LOG_DEBUG("Button pressed - very long press"); #ifndef EMSESP_STANDALONE - LOG_WARNING(("Performing factory reset...")); + LOG_WARNING("Performing factory reset..."); EMSESP::console_.loop(); EMSESP::esp8266React.factoryReset(); #endif @@ -437,12 +437,12 @@ void System::button_init(bool refresh) { if (is_valid_gpio(pbutton_gpio_)) { if (!myPButton_.init(pbutton_gpio_, HIGH)) { - LOG_DEBUG(("Multi-functional button not detected")); + LOG_DEBUG("Multi-functional button not detected"); } else { - LOG_DEBUG(("Multi-functional button enabled")); + LOG_DEBUG("Multi-functional button enabled"); } } else { - LOG_WARNING(("Invalid button GPIO. Check config.")); + LOG_WARNING("Invalid button GPIO. Check config."); } myPButton_.onClick(BUTTON_Debounce, button_OnClick); @@ -772,7 +772,7 @@ int8_t System::wifi_quality(int8_t dBm) { // print users to console void System::show_users(uuid::console::Shell & shell) { - shell.printfln(("Users:")); + shell.printfln("Users:"); #ifndef EMSESP_STANDALONE EMSESP::esp8266React.getSecuritySettingsService()->read([&](SecuritySettings & securitySettings) { @@ -801,19 +801,19 @@ void System::show_system(uuid::console::Shell & shell) { shell.println("Network:"); switch (WiFi.status()) { case WL_IDLE_STATUS: - shell.printfln((" Network: Idle")); + shell.printfln(" Network: Idle"); break; case WL_NO_SSID_AVAIL: - shell.printfln((" Network: Network not found")); + shell.printfln(" Network: Network not found"); break; case WL_SCAN_COMPLETED: - shell.printfln((" Network: Network scan complete")); + shell.printfln(" Network: Network scan complete"); break; case WL_CONNECTED: - shell.printfln((" Network: connected")); + shell.printfln(" Network: connected"); shell.printfln((" SSID: %s"), WiFi.SSID().c_str()); shell.printfln((" BSSID: %s"), WiFi.BSSIDstr().c_str()); shell.printfln((" RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI())); @@ -828,27 +828,27 @@ void System::show_system(uuid::console::Shell & shell) { break; case WL_CONNECT_FAILED: - shell.printfln((" WiFi Network: Connection failed")); + shell.printfln(" WiFi Network: Connection failed"); break; case WL_CONNECTION_LOST: - shell.printfln((" WiFi Network: Connection lost")); + shell.printfln(" WiFi Network: Connection lost"); break; case WL_DISCONNECTED: - shell.printfln((" WiFi Network: Disconnected")); + shell.printfln(" WiFi Network: Disconnected"); break; case WL_NO_SHIELD: default: - shell.printfln((" WiFi Network: Unknown")); + shell.printfln(" WiFi Network: Unknown"); break; } // show Ethernet if connected if (ethernet_connected_) { shell.println(); - shell.printfln((" Ethernet Network: connected")); + shell.printfln(" Ethernet Network: connected"); shell.printfln((" MAC address: %s"), ETH.macAddress().c_str()); shell.printfln((" Hostname: %s"), ETH.getHostname()); shell.printfln((" IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str()); @@ -862,17 +862,17 @@ void System::show_system(uuid::console::Shell & shell) { shell.println("Syslog:"); if (!syslog_enabled_) { - shell.printfln((" Syslog: disabled")); + shell.printfln(" Syslog: disabled"); } else { shell.printfln((" Syslog: %s"), syslog_.started() ? "started" : "stopped"); - shell.print((" ")); + shell.print(" "); shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : (F_(unset))); shell.printfln((" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str()); - shell.print((" ")); + shell.print(" "); shell.printfln(F_(port_fmt), syslog_port_); - shell.print((" ")); + shell.print(" "); shell.printfln(F_(log_level_fmt), uuid::log::format_level_lowercase(static_cast(syslog_level_))); - shell.print((" ")); + shell.print(" "); shell.printfln(F_(mark_interval_fmt), syslog_mark_interval_); shell.printfln((" Queued: %d"), syslog_.queued()); } @@ -908,10 +908,10 @@ bool System::check_upgrade() { // it's a customization file, just replace it and there's no need to reboot saveSettings(EMSESP_CUSTOMIZATION_FILE, "Customizations", input); } else { - LOG_ERROR(("Unrecognized file uploaded")); + LOG_ERROR("Unrecognized file uploaded"); } } else { - LOG_ERROR(("Unrecognized file uploaded, not json")); + LOG_ERROR("Unrecognized file uploaded, not json"); } // close (just in case) and remove the temp file @@ -1111,16 +1111,16 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp node = output.createNestedObject("Bus Status"); switch (EMSESP::bus_status()) { case EMSESP::BUS_STATUS_OFFLINE: - node["bus status"] = (("disconnected")); + node["bus status"] = ("disconnected"); break; case EMSESP::BUS_STATUS_TX_ERRORS: - node["bus status"] = (("connected, tx issues - try a different Tx Mode")); + node["bus status"] = ("connected, tx issues - try a different Tx Mode"); break; case EMSESP::BUS_STATUS_CONNECTED: - node["bus status"] = (("connected")); + node["bus status"] = ("connected"); break; default: - node["bus status"] = (("unknown")); + node["bus status"] = ("unknown"); break; } if (EMSESP::bus_status() != EMSESP::BUS_STATUS_OFFLINE) { diff --git a/src/telegram.cpp b/src/telegram.cpp index eb02f3b6d..c1a57a9a3 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -120,7 +120,7 @@ std::string Telegram::to_string() const { // returns telegram's message body only, in hex std::string Telegram::to_string_message() const { if (this->message_length == 0) { - return (("")); + return (""); } return Helpers::data_to_hex(this->message_data, this->message_length); @@ -381,7 +381,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { uint16_t status = EMSuart::transmit(telegram_raw, length); if (status == EMS_TX_STATUS_ERR) { - LOG_ERROR(("Failed to transmit Tx via UART.")); + LOG_ERROR("Failed to transmit Tx via UART."); if (telegram->operation == Telegram::Operation::TX_READ) { increment_telegram_read_fail_count(); // another Tx fail } else { @@ -412,7 +412,7 @@ void TxService::send_telegram(const uint8_t * data, const uint8_t length) { uint16_t status = EMSuart::transmit(telegram_raw, length); if (status == EMS_TX_STATUS_ERR) { - LOG_ERROR(("Failed to transmit Tx via UART.")); + LOG_ERROR("Failed to transmit Tx via UART."); increment_telegram_fail_count(); // another Tx fail } } diff --git a/src/test/test.cpp b/src/test/test.cpp index 092a12ca0..3476a85b2 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -30,7 +30,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "general") == 0) { - EMSESP::logger().info(("Testing general. Adding a Boiler and Thermostat")); + EMSESP::logger().info("Testing general. Adding a Boiler and Thermostat"); add_device(0x08, 123); // Nefit Trendline add_device(0x18, 157); // Bosch CR100 @@ -54,7 +54,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "2thermostats") == 0) { - EMSESP::logger().info(("Testing with multiple thermostats...")); + EMSESP::logger().info("Testing with multiple thermostats..."); add_device(0x08, 123); // GB072 add_device(0x10, 158); // RC310 @@ -86,7 +86,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "310") == 0) { - EMSESP::logger().info(("Adding a GB072/RC310 combo...")); + EMSESP::logger().info("Adding a GB072/RC310 combo..."); add_device(0x08, 123); // GB072 add_device(0x10, 158); // RC310 @@ -113,7 +113,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "gateway") == 0) { - EMSESP::logger().info(("Adding a Gateway...")); + EMSESP::logger().info("Adding a Gateway..."); // add 0x48 KM200, via a version command rx_telegram({0x48, 0x0B, 0x02, 0x00, 0xBD, 0x04, 0x06, 00, 00, 00, 00, 00, 00, 00}); @@ -133,7 +133,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "mixer") == 0) { - EMSESP::logger().info(("Adding a mixer...")); + EMSESP::logger().info("Adding a mixer..."); // add controller add_device(0x09, 114); @@ -155,7 +155,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "boiler") == 0) { - EMSESP::logger().info(("Adding boiler...")); + EMSESP::logger().info("Adding boiler..."); add_device(0x08, 123); // Nefit Trendline // UBAuptime @@ -172,7 +172,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "thermostat") == 0) { - EMSESP::logger().info(("Adding thermostat...")); + EMSESP::logger().info("Adding thermostat..."); add_device(0x10, 192); // FW120 @@ -185,7 +185,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "solar") == 0) { - EMSESP::logger().info(("Adding solar...")); + EMSESP::logger().info("Adding solar..."); add_device(0x30, 163); // SM100 @@ -204,7 +204,7 @@ bool Test::run_test(const char * command, int8_t id) { } if (strcmp(command, "heatpump") == 0) { - EMSESP::logger().info(("Adding heatpump...")); + EMSESP::logger().info("Adding heatpump..."); add_device(0x38, 200); // Enviline module add_device(0x10, 192); // FW120 thermostat @@ -238,7 +238,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "general") { - shell.printfln(("Testing adding a general boiler & thermostat...")); + shell.printfln("Testing adding a general boiler & thermostat..."); run_test("general"); shell.invoke_command("show devices"); shell.invoke_command("show"); @@ -247,7 +247,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "render") { - shell.printfln(("Testing render...")); + shell.printfln("Testing render..."); // check read_value to make sure it handles all the data type correctly uint8_t message_data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; // message_length is 9 @@ -315,7 +315,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "devices") { - shell.printfln(("Testing devices...")); + shell.printfln("Testing devices..."); // A fake response - UBADevices(0x07) rx_telegram({0x08, 0x00, 0x07, 0x00, 0x0B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); @@ -323,7 +323,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // check for boiler and controller on same product_id if (command == "double") { - shell.printfln(("Testing double...")); + shell.printfln("Testing double..."); add_device(0x08, 206); // Nefit Excellent HR30 add_device(0x09, 206); // Nefit Excellent HR30 Controller @@ -333,7 +333,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "620") { - EMSESP::logger().info(("Testing 620...")); + EMSESP::logger().info("Testing 620..."); // Version Controller uart_telegram({0x09, 0x0B, 0x02, 0x00, 0x5F, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); @@ -344,7 +344,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // unknown device if (command == "unknown") { - shell.printfln(("Testing unknown...")); + shell.printfln("Testing unknown..."); // add boiler add_device(0x08, 84); @@ -361,19 +361,19 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "unknown2") { - shell.printfln(("Testing unknown2...")); + shell.printfln("Testing unknown2..."); // simulate getting version information back from an unknown device rx_telegram({0x09, 0x0B, 0x02, 0x00, 0x5A, 0x01, 0x02}); // productID is 90 which doesn't exist } if (command == "gateway") { - shell.printfln(("Testing Gateway...")); + shell.printfln("Testing Gateway..."); run_test("gateway"); } if (command == "310") { - shell.printfln(("Testing RC310...")); + shell.printfln("Testing RC310..."); run_test("310"); shell.invoke_command("show devices"); shell.invoke_command("show"); @@ -382,14 +382,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "2thermostats") { - shell.printfln(("Testing multiple thermostats...")); + shell.printfln("Testing multiple thermostats..."); run_test("2thermostats"); shell.invoke_command("show"); shell.invoke_command("show devices"); } if (command == "web") { - shell.printfln(("Testing Web...")); + shell.printfln("Testing Web..."); Mqtt::enabled(false); // turn off mqtt Mqtt::ha_enabled(false); // turn off ha @@ -438,7 +438,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "board_profile") { - shell.printfln(("Testing board profile...")); + shell.printfln("Testing board profile..."); shell.invoke_command("system"); shell.invoke_command("set board_profile wemos"); @@ -447,7 +447,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "boiler") { - shell.printfln(("Testing boiler...")); + shell.printfln("Testing boiler..."); // Mqtt::ha_enabled(false); Mqtt::ha_enabled(true); Mqtt::nested_format(1); @@ -475,7 +475,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "shower_alert") { - shell.printfln(("Testing Shower Alert...")); + shell.printfln("Testing Shower Alert..."); run_test("boiler"); @@ -484,7 +484,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "fr120") { - shell.printfln(("Testing adding a thermostat FR120...")); + shell.printfln("Testing adding a thermostat FR120..."); add_device(0x10, 191); // FR120 thermostat @@ -496,7 +496,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "ha") { - shell.printfln(("Testing HA mqtt discovery")); + shell.printfln("Testing HA mqtt discovery"); Mqtt::ha_enabled(true); // Mqtt::ha_enabled(false); @@ -518,7 +518,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "lastcode") { - shell.printfln(("Testing lastcode")); + shell.printfln("Testing lastcode"); Mqtt::ha_enabled(false); Mqtt::nested_format(1); @@ -536,7 +536,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "dv") { - shell.printfln(("Testing device value rendering")); + shell.printfln("Testing device value rendering"); Mqtt::ha_enabled(true); Mqtt::nested_format(1); @@ -550,12 +550,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "dallas") { - shell.printfln(("Testing adding Dallas sensor")); + shell.printfln("Testing adding Dallas sensor"); emsesp::EMSESP::dallassensor_.test(); } if (command == "dallas_full") { - shell.printfln(("Testing adding and changing Dallas sensor")); + shell.printfln("Testing adding and changing Dallas sensor"); Mqtt::ha_enabled(true); Mqtt::nested_format(1); // Mqtt::nested_format(0); @@ -571,7 +571,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "analog") { - shell.printfln(("Testing adding Analog sensor")); + shell.printfln("Testing adding Analog sensor"); Mqtt::ha_enabled(true); // Mqtt::ha_enabled(false); Mqtt::nested_format(1); @@ -602,7 +602,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "masked") { - shell.printfln(("Testing masked entities")); + shell.printfln("Testing masked entities"); Mqtt::ha_enabled(true); Mqtt::send_response(false); @@ -626,7 +626,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "dv2") { - shell.printfln(("Testing device value lost")); + shell.printfln("Testing device value lost"); Mqtt::ha_enabled(true); Mqtt::send_response(false); @@ -647,7 +647,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const if (command == "api_values") { #if defined(EMSESP_STANDALONE) - shell.printfln(("Testing API getting values")); + shell.printfln("Testing API getting values"); Mqtt::ha_enabled(false); Mqtt::nested_format(1); Mqtt::send_response(false); @@ -680,7 +680,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "mqtt_post") { - shell.printfln(("Testing MQTT incoming changes")); + shell.printfln("Testing MQTT incoming changes"); Mqtt::ha_enabled(false); Mqtt::nested_format(1); Mqtt::send_response(false); @@ -696,7 +696,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const #if defined(EMSESP_STANDALONE) // https://github.com/emsesp/EMS-ESP32/issues/541 if (command == "api_wwmode") { - shell.printfln(("Testing API wwmode")); + shell.printfln("Testing API wwmode"); Mqtt::ha_enabled(false); Mqtt::nested_format(1); run_test("310"); @@ -715,7 +715,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const #endif if (command == "api") { - shell.printfln(("Testing API with MQTT and REST, standalone")); + shell.printfln("Testing API with MQTT and REST, standalone"); Mqtt::ha_enabled(true); // Mqtt::ha_enabled(false); @@ -990,7 +990,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "mqtt_nested") { - shell.printfln(("Testing nested MQTT")); + shell.printfln("Testing nested MQTT"); Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter run_test("boiler"); @@ -1010,7 +1010,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "thermostat") { - shell.printfln(("Testing adding a thermostat FW120...")); + shell.printfln("Testing adding a thermostat FW120..."); run_test("thermostat"); shell.invoke_command("show"); @@ -1026,7 +1026,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "tc100") { - shell.printfln(("Testing adding a TC100 thermostat to the EMS bus...")); + shell.printfln("Testing adding a TC100 thermostat to the EMS bus..."); // add a thermostat add_device(0x18, 202); // Bosch TC100 - https://github.com/emsesp/EMS-ESP/issues/474 @@ -1037,7 +1037,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "solar") { - shell.printfln(("Testing Solar")); + shell.printfln("Testing Solar"); run_test("solar"); uart_telegram("30 00 FF 0A 02 6A 04"); // SM100 pump on (1)sh @@ -1050,14 +1050,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "heatpump") { - shell.printfln(("Testing Heat Pump")); + shell.printfln("Testing Heat Pump"); run_test("heatpump"); shell.invoke_command("call"); shell.invoke_command("call heatpump info"); } if (command == "solar200") { - shell.printfln(("Testing Solar SM200")); + shell.printfln("Testing Solar SM200"); add_device(0x30, 164); // SM200 @@ -1082,7 +1082,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "km") { - shell.printfln(("Testing KM200 Gateway")); + shell.printfln("Testing KM200 Gateway"); add_device(0x10, 158); // RC300 add_device(0x48, 189); // KM200 @@ -1140,7 +1140,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "cr100") { - shell.printfln(("Testing CR100")); + shell.printfln("Testing CR100"); add_device(0x18, 157); // Bosch CR100 - https://github.com/emsesp/EMS-ESP/issues/355 @@ -1165,14 +1165,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "rx2") { - shell.printfln(("Testing Rx2...")); + shell.printfln("Testing Rx2..."); for (uint8_t i = 0; i < 30; i++) { uart_telegram({0x08, 0x0B, 0x33, 0x00, 0x08, 0xFF, 0x34, 0xFB, 0x00, 0x28, 0x00, 0x00, 0x46, 0x00, 0xFF, 0xFF, 0x00}); } } if (command == "rx") { - shell.printfln(("Testing Rx...")); + shell.printfln("Testing Rx..."); // fake telegrams. length includes CRC // Boiler -> Me, UBAMonitorFast(0x18), telegram: 08 00 18 00 00 02 5A 73 3D 0A 10 65 40 02 1A 80 00 01 E1 01 76 0E 3D 48 00 C9 44 02 00 (#data=25) @@ -1229,7 +1229,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "tx") { - shell.printfln(("Testing Tx...")); + shell.printfln("Testing Tx..."); // TX queue example - Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4) uint8_t t11[] = {0x44, 0x45, 0x46, 0x47}; @@ -1266,7 +1266,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "poll") { - shell.printfln(("Testing Poll...")); + shell.printfln("Testing Poll..."); // simulate sending a read request // uint8_t t16[] = {0x44, 0x45, 0x46, 0x47}; // Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4) @@ -1291,7 +1291,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "cmd") { - shell.printfln(("Testing Commands...")); + shell.printfln("Testing Commands..."); // add a thermostat with 3 HCs add_device(0x10, 192); // FW120 @@ -1318,13 +1318,13 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "pin") { - shell.printfln(("Testing pin...")); + shell.printfln("Testing pin..."); shell.invoke_command("call system pin"); shell.invoke_command("call system pin 1 true"); } if (command == "mqtt2") { - shell.printfln(("Testing MQTT large payloads...")); + shell.printfln("Testing MQTT large payloads..."); DynamicJsonDocument doc(EMSESP_JSON_SIZE_XXLARGE_DYN); @@ -1347,7 +1347,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "mqtt") { - shell.printfln(("Testing MQTT...")); + shell.printfln("Testing MQTT..."); Mqtt::ha_enabled(false); Mqtt::enabled(true); @@ -1422,7 +1422,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "poll2") { - shell.printfln(("Testing Tx Sending last message on queue...")); + shell.printfln("Testing Tx Sending last message on queue..."); EMSESP::show_ems(shell); @@ -1433,7 +1433,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "rx2") { - shell.printfln(("Testing rx2...")); + shell.printfln("Testing rx2..."); uart_telegram({0x1B, 0x5B, 0xFD, 0x2D, 0x9E, 0x3A, 0xB6, 0xE5, 0x02, 0x20, 0x33, 0x30, 0x32, 0x3A, 0x20, 0x5B, 0x73, 0xFF, 0xFF, 0xCB, 0xDF, 0xB7, 0xA7, 0xB5, 0x67, 0x77, 0x77, 0xE4, 0xFF, 0xFD, 0x77, 0xFF}); @@ -1441,14 +1441,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // https://github.com/emsesp/EMS-ESP/issues/380#issuecomment-633663007 if (command == "rx3") { - shell.printfln(("Testing rx3...")); + shell.printfln("Testing rx3..."); uart_telegram({0x21, 0x0B, 0xFF, 0x00}); } // testing the UART tx command, without a queue if (command == "tx2") { - shell.printfln(("Testing tx2...")); + shell.printfln("Testing tx2..."); uint8_t t[] = {0x0B, 0x88, 0x18, 0x00, 0x20, 0xD4}; // including CRC EMSuart::transmit(t, sizeof(t)); @@ -1456,14 +1456,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // send read request with offset if (command == "offset") { - shell.printfln(("Testing offset...")); + shell.printfln("Testing offset..."); // send_read_request(0x18, 0x08); EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset } if (command == "mixer") { - shell.printfln(("Testing Mixer...")); + shell.printfln("Testing Mixer..."); run_test("mixer"); @@ -1477,7 +1477,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } if (command == "crash") { - shell.printfln(("Forcing a crash...")); + shell.printfln("Forcing a crash..."); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdiv-by-zero" diff --git a/src/version.h b/src/version.h index 69c779d31..393fcb0b5 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.5.0b3" +#define EMSESP_APP_VERSION "3.5.0b3_o" diff --git a/src/web/WebAPIService.cpp b/src/web/WebAPIService.cpp index b0e48b233..e6cdbb2a5 100644 --- a/src/web/WebAPIService.cpp +++ b/src/web/WebAPIService.cpp @@ -117,7 +117,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) { emsesp::EMSESP::logger().err(error); api_fails_++; } else { - // emsesp::EMSESP::logger().debug(("API command called successfully")); + // emsesp::EMSESP::logger().debug("API command called successfully"); // if there was no json output from the call, default to the output message 'OK'. if (!output.size()) { output["message"] = "OK"; diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index 38c1146d7..8eddfbc03 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -238,7 +238,7 @@ void WebDataService::write_value(AsyncWebServerRequest * request, JsonVariant & if (return_code != CommandRet::OK) { EMSESP::logger().err(("Write command failed %s (%s)"), (const char *)output["message"], Command::return_code_string(return_code).c_str()); } else { - EMSESP::logger().debug(("Write command successful")); + EMSESP::logger().debug("Write command successful"); } response->setCode((return_code == CommandRet::OK) ? 200 : 204); diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index 4a1ae6352..21619f490 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -48,7 +48,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { break; case ARDUINO_EVENT_ETH_START: - // EMSESP::logger().info(("Ethernet initialized")); + // EMSESP::logger().info("Ethernet initialized"); ETH.setHostname(EMSESP::system_.hostname().c_str()); // configure for static IP @@ -74,12 +74,12 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { break; case ARDUINO_EVENT_ETH_DISCONNECTED: - EMSESP::logger().warning(("Ethernet disconnected")); + EMSESP::logger().warning("Ethernet disconnected"); EMSESP::system_.ethernet_connected(false); break; case ARDUINO_EVENT_ETH_STOP: - EMSESP::logger().info(("Ethernet stopped")); + EMSESP::logger().info("Ethernet stopped"); EMSESP::system_.ethernet_connected(false); break; @@ -202,7 +202,7 @@ void WebStatusService::mDNS_start() const { EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) { if (networkSettings.enableMDNS) { if (!MDNS.begin(EMSESP::system_.hostname().c_str())) { - EMSESP::logger().warning(("Failed to start mDNS responder service")); + EMSESP::logger().warning("Failed to start mDNS responder service"); return; } @@ -214,13 +214,13 @@ void WebStatusService::mDNS_start() const { MDNS.addServiceTxt("http", "tcp", "version", EMSESP_APP_VERSION); MDNS.addServiceTxt("http", "tcp", "address", address_s.c_str()); - EMSESP::logger().info(("mDNS responder service started")); + EMSESP::logger().info("mDNS responder service started"); } }); #else EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) { if (networkSettings.enableMDNS) { - EMSESP::logger().info(("mDNS responder service started")); + EMSESP::logger().info("mDNS responder service started"); } }); #endif From da6e64e89fc6fe4711e172fbb64dbdb9c4c20d5c Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 28 Sep 2022 21:18:52 +0200 Subject: [PATCH 04/28] optimize toLower() --- src/helpers.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index 80e400207..a52b5fbfb 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -655,21 +655,8 @@ std::string Helpers::toLower(std::string const & s) { return lc; } - -// TODO fix toLower std::string Helpers::toLower(const char * s) { - std::string lc = s; - std::transform(lc.begin(), lc.end(), lc.begin(), [](unsigned char c) { return std::tolower(c); }); - return lc; - - /* - - for (; *s; ++s) { - *p = tolower(*s); - p++; - } - - */ + return toLower(std::string(s)); } std::string Helpers::toUpper(std::string const & s) { From 614a8cb14bf02ccd6b1cb6b62e3d2678d0e9b550 Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 28 Sep 2022 21:19:03 +0200 Subject: [PATCH 05/28] add comment --- src/emsdevice.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 093f18dec..5013cf6df 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -701,7 +701,6 @@ void EMSdevice::publish_value(void * value_p) const { // looks up the UOM for a given key from the device value table // key is the fullname -// TODO really should be using the shortname as the identifier std::string EMSdevice::get_value_uom(const char * key) const { // the key may have a TAG string prefixed at the beginning. If so, remove it char new_key[80]; @@ -711,8 +710,8 @@ std::string EMSdevice::get_value_uom(const char * key) const { for (uint8_t i = 0; i < DeviceValue::tag_count; i++) { auto tag = (DeviceValue::DeviceValueTAG_s[i]); if (tag) { - std::string key2 = key; // copy char to a std::string - auto length = strlen(tag); // TODO check if this still works + std::string key2 = key; // copy string to a std::string so we can use the find function + uint8_t length = strlen(tag); if ((key2.find(tag) != std::string::npos) && (key[length] == ' ')) { key_p += length + 1; // remove the tag break; From 87887494a5c2500f7d2d4712e41beae2771a50c5 Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 28 Sep 2022 21:19:14 +0200 Subject: [PATCH 06/28] fix endless loop! --- src/mqtt.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 83a405129..579b71fca 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -600,7 +600,7 @@ void Mqtt::on_connect() { // re-subscribe to all custom registered MQTT topics resubscribe(); - publish_retain(("status"), "online", true); // say we're alive to the Last Will topic, with retain on + publish_retain("status", "online", true); // say we're alive to the Last Will topic, with retain on mqtt_publish_fails_ = 0; // reset fail count to 0 @@ -631,10 +631,10 @@ void Mqtt::ha_status() { doc["val_tpl"] = "{{value_json['bus_status']}}"; JsonObject dev = doc.createNestedObject("dev"); - dev["name"] = F_(EMSESP); // "EMS-ESP" + dev["name"] = "EMS-ESP"; dev["sw"] = "v" + std::string(EMSESP_APP_VERSION); dev["mf"] = "proddy"; - dev["mdl"] = F_(EMSESP); // "EMS-ESP" + dev["mdl"] = "EMS-ESP"; JsonArray ids = dev.createNestedArray("ids"); ids.add("ems-esp"); @@ -647,6 +647,7 @@ void Mqtt::ha_status() { publish_system_ha_sensor_config(DeviceValueType::INT, ("WiFi RSSI"), ("rssi"), DeviceValueUOM::DBM); publish_system_ha_sensor_config(DeviceValueType::INT, ("WiFi strength"), ("wifistrength"), DeviceValueUOM::PERCENT); } + publish_system_ha_sensor_config(DeviceValueType::INT, ("Uptime"), ("uptime"), DeviceValueUOM::NONE); publish_system_ha_sensor_config(DeviceValueType::INT, ("Uptime (sec)"), ("uptime_sec"), DeviceValueUOM::SECONDS); publish_system_ha_sensor_config(DeviceValueType::BOOL, ("NTP status"), ("ntp_status"), DeviceValueUOM::NONE); @@ -755,7 +756,7 @@ void Mqtt::publish_retain(const char * topic, const JsonObject & payload, bool r } void Mqtt::publish_ha(const char * topic, const JsonObject & payload) { - publish_ha((topic), payload); + publish_ha(std::string(topic), payload); } // publish empty payload to remove the topic @@ -949,9 +950,7 @@ void Mqtt::publish_system_ha_sensor_config(uint8_t type, const char * name, cons JsonArray ids = dev_json.createNestedArray("ids"); ids.add("ems-esp"); - auto fullname = (name); // TODO is this needed? - - publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, fullname, name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, nullptr, 0, 0, 0, dev_json); + publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, std::string(name), name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, nullptr, 0, 0, 0, dev_json); } // MQTT discovery configs From fe0a8556184fce5c3d81eaf6170336abf09b7766 Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 28 Sep 2022 21:41:19 +0200 Subject: [PATCH 07/28] formatting --- lib/ESPAsyncWebServer/ESPAsyncWebServer.h | 2 +- scripts/rename_fw.py | 2 +- src/console.cpp | 2 +- src/emsdevice.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ESPAsyncWebServer/ESPAsyncWebServer.h b/lib/ESPAsyncWebServer/ESPAsyncWebServer.h index 327d177e0..dde77ec4d 100644 --- a/lib/ESPAsyncWebServer/ESPAsyncWebServer.h +++ b/lib/ESPAsyncWebServer/ESPAsyncWebServer.h @@ -41,7 +41,7 @@ #ifdef ASYNCWEBSERVER_REGEX #define ASYNCWEBSERVER_REGEX_ATTRIBUTE #else -#define ASYNCWEBSERVER_REGEX_ATTRIBUTE __attribute__((warning("ASYNCWEBSERVER_REGEX not defined"))) +#define ASYNCWEBSERVER_REGEX_ATTRIBUTE __attribute__(warning("ASYNCWEBSERVER_REGEX not defined")) #endif #define DEBUGF(...) //Serial.printf(__VA_ARGS__) diff --git a/scripts/rename_fw.py b/scripts/rename_fw.py index 8e8ea91be..371aeab45 100644 --- a/scripts/rename_fw.py +++ b/scripts/rename_fw.py @@ -26,7 +26,7 @@ def bin_copy(source, target, env): # my_flags = env.ParseFlags(env['BUILD_FLAGS']) # defines = {k: v for (k, v) in my_flags.get("CPPDEFINES")} # print(my_flags) - # print((my_flags.get("CPPDEFINES")) + # print(my_flags.get("CPPDEFINES") # alternatively take platform from the pio target # platform = str(target[0]).split(os.path.sep)[2] diff --git a/src/console.cpp b/src/console.cpp index f76bfb71e..1b7c824c3 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -737,7 +737,7 @@ EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, bool local) : uuid::console::Shell(commands, ShellContext::MAIN, local ? (CommandFlags::USER | CommandFlags::LOCAL) : CommandFlags::USER) , uuid::console::StreamConsole(stream) , EMSESPShell() - , name_(("Serial")) + , name_("Serial") , pty_(SIZE_MAX) , addr_() , port_(0) { diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index 5013cf6df..e58d93754 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -76,7 +76,7 @@ std::string EMSdevice::brand_to_string() const { case EMSdevice::Brand::IVT: return ("IVT"); default: - return (("")); + return (""); } } From 9b619216cbf9dfa1284e915ef1d03377633d546f Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 28 Sep 2022 21:46:12 +0200 Subject: [PATCH 08/28] formatting brackets --- lib/ESPAsyncWebServer/ESPAsyncWebServer.h | 2 +- src/analogsensor.cpp | 24 ++++---- src/command.cpp | 6 +- src/console.cpp | 20 +++--- src/dallassensor.cpp | 22 +++---- src/devices/boiler.cpp | 18 +++--- src/devices/solar.cpp | 2 +- src/devices/thermostat.cpp | 14 ++--- src/emsdevice.cpp | 18 +++--- src/emsesp.cpp | 50 +++++++-------- src/mqtt.cpp | 44 +++++++------- src/shower.cpp | 6 +- src/system.cpp | 74 +++++++++++------------ src/telegram.cpp | 34 +++++------ src/test/test.cpp | 8 +-- src/web/WebStatusService.cpp | 10 +-- 16 files changed, 176 insertions(+), 176 deletions(-) diff --git a/lib/ESPAsyncWebServer/ESPAsyncWebServer.h b/lib/ESPAsyncWebServer/ESPAsyncWebServer.h index dde77ec4d..327d177e0 100644 --- a/lib/ESPAsyncWebServer/ESPAsyncWebServer.h +++ b/lib/ESPAsyncWebServer/ESPAsyncWebServer.h @@ -41,7 +41,7 @@ #ifdef ASYNCWEBSERVER_REGEX #define ASYNCWEBSERVER_REGEX_ATTRIBUTE #else -#define ASYNCWEBSERVER_REGEX_ATTRIBUTE __attribute__(warning("ASYNCWEBSERVER_REGEX not defined")) +#define ASYNCWEBSERVER_REGEX_ATTRIBUTE __attribute__((warning("ASYNCWEBSERVER_REGEX not defined"))) #endif #define DEBUGF(...) //Serial.printf(__VA_ARGS__) diff --git a/src/analogsensor.cpp b/src/analogsensor.cpp index 2070d8e95..37e5b897d 100644 --- a/src/analogsensor.cpp +++ b/src/analogsensor.cpp @@ -123,12 +123,12 @@ void AnalogSensor::reload() { for (auto & sensor : sensors_) { sensor.ha_registered = false; // force HA configs to be re-created if (sensor.type() == AnalogType::ADC) { - LOG_DEBUG(("Adding analog ADC sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG("Adding analog ADC sensor on GPIO%d", sensor.gpio()); // analogSetPinAttenuation does not work with analogReadMilliVolts sensor.analog_ = 0; // initialize sensor.last_reading_ = 0; } else if (sensor.type() == AnalogType::COUNTER) { - LOG_DEBUG(("Adding analog I/O Counter sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG("Adding analog I/O Counter sensor on GPIO%d", sensor.gpio()); pinMode(sensor.gpio(), INPUT_PULLUP); #ifndef ARDUINO_LOLIN_C3_MINI if (sensor.gpio() == 25 || sensor.gpio() == 26) { @@ -139,7 +139,7 @@ void AnalogSensor::reload() { sensor.poll_ = digitalRead(sensor.gpio()); publish_sensor(sensor); } else if (sensor.type() == AnalogType::TIMER || sensor.type() == AnalogType::RATE) { - LOG_DEBUG(("Adding analog Timer/Rate sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG("Adding analog Timer/Rate sensor on GPIO%d", sensor.gpio()); pinMode(sensor.gpio(), INPUT_PULLUP); sensor.polltime_ = uuid::get_uptime(); sensor.last_polltime_ = uuid::get_uptime(); @@ -148,7 +148,7 @@ void AnalogSensor::reload() { sensor.set_value(0); publish_sensor(sensor); } else if (sensor.type() == AnalogType::DIGITAL_IN) { - LOG_DEBUG(("Adding analog Read sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG("Adding analog Read sensor on GPIO%d", sensor.gpio()); pinMode(sensor.gpio(), INPUT_PULLUP); sensor.set_value(digitalRead(sensor.gpio())); // initial value sensor.set_uom(0); // no uom, just for safe measures @@ -156,7 +156,7 @@ void AnalogSensor::reload() { sensor.poll_ = digitalRead(sensor.gpio()); publish_sensor(sensor); } else if (sensor.type() == AnalogType::DIGITAL_OUT) { - LOG_DEBUG(("Adding analog Write sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG("Adding analog Write sensor on GPIO%d", sensor.gpio()); pinMode(sensor.gpio(), OUTPUT); if (sensor.gpio() == 25 || sensor.gpio() == 26) { if (sensor.offset() > 255) { @@ -175,7 +175,7 @@ void AnalogSensor::reload() { sensor.set_uom(0); // no uom, just for safe measures publish_sensor(sensor); } else if (sensor.type() >= AnalogType::PWM_0) { - LOG_DEBUG(("Adding PWM output sensor on GPIO%d"), sensor.gpio()); + LOG_DEBUG("Adding PWM output sensor on GPIO%d", sensor.gpio()); uint channel = sensor.type() - AnalogType::PWM_0; ledcSetup(channel, sensor.factor(), 13); ledcAttachPin(sensor.gpio(), channel); @@ -277,7 +277,7 @@ bool AnalogSensor::update(uint8_t gpio, const std::string & name, float offset, found_sensor = true; // found the record // see if it's marked for deletion if (type == AnalogType::MARK_DELETED) { - LOG_DEBUG(("Removing analog sensor GPIO %d"), gpio); + LOG_DEBUG("Removing analog sensor GPIO %d", gpio); settings.analogCustomizations.remove(AnalogCustomization); } else { // update existing record @@ -286,7 +286,7 @@ bool AnalogSensor::update(uint8_t gpio, const std::string & name, float offset, AnalogCustomization.factor = factor; AnalogCustomization.uom = uom; AnalogCustomization.type = type; - LOG_DEBUG(("Customizing existing analog GPIO %d"), gpio); + LOG_DEBUG("Customizing existing analog GPIO %d", gpio); } return StateUpdateResult::CHANGED; // persist the change } @@ -312,7 +312,7 @@ bool AnalogSensor::update(uint8_t gpio, const std::string & name, float offset, newSensor.uom = uom; newSensor.type = type; settings.analogCustomizations.push_back(newSensor); - LOG_DEBUG(("Adding new customization for analog sensor GPIO %d"), gpio); + LOG_DEBUG("Adding new customization for analog sensor GPIO %d", gpio); return StateUpdateResult::CHANGED; // persist the change }, "local"); @@ -353,7 +353,7 @@ void AnalogSensor::remove_ha_topic(const uint8_t gpio) const { return; } #ifdef EMSESP_DEBUG - LOG_DEBUG(("Removing HA config for analog sensor GPIO %d"), gpio); + LOG_DEBUG("Removing HA config for analog sensor GPIO %d", gpio); #endif char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; snprintf(topic, sizeof(topic), "sensor/%s/analogsensor_%d/config", Mqtt::basename().c_str(), gpio); @@ -403,7 +403,7 @@ void AnalogSensor::publish_values(const bool force) { // create HA config if (Mqtt::ha_enabled() && (!sensor.ha_registered || force)) { - LOG_DEBUG(("Recreating HA config for analog sensor GPIO %d"), sensor.gpio()); + LOG_DEBUG("Recreating HA config for analog sensor GPIO %d", sensor.gpio()); StaticJsonDocument config; @@ -447,7 +447,7 @@ void AnalogSensor::publish_values(const bool force) { } } - Mqtt::publish(("analogsensor_data"), doc.as()); + Mqtt::publish("analogsensor_data", doc.as()); } // called from emsesp.cpp, similar to the emsdevice->get_value_info diff --git a/src/command.cpp b/src/command.cpp index e7446c215..53488f05e 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -82,7 +82,7 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec // validate the device, make sure it exists uint8_t device_type = EMSdevice::device_name_2_device_type(device_s); if (!device_has_commands(device_type)) { - LOG_DEBUG(("Command failed: unknown device '%s'"), device_s); + LOG_DEBUG("Command failed: unknown device '%s'", device_s); return message(CommandRet::ERROR, "unknown device", output); } @@ -248,7 +248,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * if ((device_type > EMSdevice::DeviceType::SYSTEM) && (!value || !strlen(value))) { if (!cf || !cf->cmdfunction_json_) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] Calling %s command '%s' to retrieve attributes"), dname.c_str(), cmd); + LOG_DEBUG("[DEBUG] Calling %s command '%s' to retrieve attributes", dname.c_str(), cmd); #endif return EMSESP::get_device_value_info(output, cmd, id, device_type) ? CommandRet::OK : CommandRet::ERROR; // entity = cmd } @@ -294,7 +294,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char * } // we didn't find the command and its not an endpoint, report error - LOG_DEBUG(("Command failed: invalid command '%s'"), cmd); + LOG_DEBUG("Command failed: invalid command '%s'", cmd); return message(CommandRet::NOT_FOUND, "invalid command", output); } diff --git a/src/console.cpp b/src/console.cpp index 1b7c824c3..5530f4808 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -60,10 +60,10 @@ void EMSESPShell::stopped() { void EMSESPShell::display_banner() { println(); printfln("┌──────────────────────────────────────┐"); - printfln(("│ %sEMS-ESP version %-10s%s │"), COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF); - printfln(("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │"), COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET); + printfln("│ %sEMS-ESP version %-10s%s │", COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF); + printfln("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │", COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET); printfln("│ │"); - printfln(("│ type %shelp%s to show available commands │"), COLOR_UNDERLINE, COLOR_RESET); + printfln("│ type %shelp%s to show available commands │", COLOR_UNDERLINE, COLOR_RESET); printfln("└──────────────────────────────────────┘"); println(); @@ -102,7 +102,7 @@ void EMSESPShell::add_console_commands() { CommandFlags::USER, string_vector{F_(show)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { - shell.printfln(("%s%sEMS-ESP version %s%s"), COLOR_BRIGHT_GREEN, COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_RESET); + shell.printfln("%s%sEMS-ESP version %s%s", COLOR_BRIGHT_GREEN, COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_RESET); shell.println(); EMSESP::show_device_values(shell); EMSESP::show_sensor_values(shell); @@ -225,7 +225,7 @@ void EMSESPShell::add_console_commands() { string_vector{F_(set)}, [](Shell & shell, const std::vector & arguments __attribute__((unused))) { EMSESP::webSettingsService.read([&](WebSettings & settings) { - shell.printfln(("Language: %s"), settings.locale.c_str()); + shell.printfln("Language: %s", settings.locale.c_str()); shell.printfln(F_(tx_mode_fmt), settings.tx_mode); shell.printfln(F_(bus_id_fmt), settings.ems_bus_id); shell.printfln(F_(board_profile_fmt), settings.board_profile.c_str()); @@ -266,7 +266,7 @@ void EMSESPShell::add_console_commands() { [](Shell & shell, const std::vector & arguments) { uint16_t value = Helpers::atoint(arguments.front().c_str()); telnet_.initial_idle_timeout(value * 60); - shell.printfln(("Telnet timeout set to %d minutes"), value); + shell.printfln("Telnet timeout set to %d minutes", value); }); #endif @@ -331,9 +331,9 @@ void EMSESPShell::add_console_commands() { watch_id = EMSESP::watch_id(); if (watch_id > 0x80) { - shell.printfln(("Filtering only telegrams that match a telegram type of 0x%02X"), watch_id); + shell.printfln("Filtering only telegrams that match a telegram type of 0x%02X", watch_id); } else if (watch_id != WATCH_ID_NONE) { - shell.printfln(("Filtering only telegrams that match a deviceID or telegram type of 0x%02X"), watch_id); + shell.printfln("Filtering only telegrams that match a deviceID or telegram type of 0x%02X", watch_id); } }); @@ -763,14 +763,14 @@ EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, const IPAddress & addr snprintf(text.data(), text.size(), "pty%u", (uint16_t)pty_); name_ = text.data(); #ifndef EMSESP_STANDALONE - logger().info(("Allocated console %s for connection from [%s]:%u"), name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); + logger().info("Allocated console %s for connection from [%s]:%u", name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); #endif } EMSESPStreamConsole::~EMSESPStreamConsole() { if (pty_ != SIZE_MAX) { #ifndef EMSESP_STANDALONE - logger().info(("Shutdown console %s for connection from [%s]:%u"), name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); + logger().info("Shutdown console %s for connection from [%s]:%u", name_.c_str(), uuid::printable_to_string(addr_).c_str(), port_); #endif ptys_[pty_] = false; ptys_.shrink_to_fit(); diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index 1c2d211bb..ce619d9a1 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -181,12 +181,12 @@ void DallasSensor::loop() { default: sensorfails_++; - LOG_ERROR(("Unknown dallas sensor %s"), Sensor(addr).id().c_str()); + LOG_ERROR("Unknown dallas sensor %s", Sensor(addr).id().c_str()); break; } } else { sensorfails_++; - LOG_ERROR(("Invalid dallas sensor %s"), Sensor(addr).id().c_str()); + LOG_ERROR("Invalid dallas sensor %s", Sensor(addr).id().c_str()); } } else { if (!parasite_) { @@ -230,7 +230,7 @@ bool DallasSensor::temperature_convert_complete() { int16_t DallasSensor::get_temperature_c(const uint8_t addr[]) { #ifndef EMSESP_STANDALONE if (!bus_.reset()) { - LOG_ERROR(("Bus reset failed before reading scratchpad from %s"), Sensor(addr).id().c_str()); + LOG_ERROR("Bus reset failed before reading scratchpad from %s", Sensor(addr).id().c_str()); return EMS_VALUE_SHORT_NOTSET; } YIELD; @@ -242,13 +242,13 @@ int16_t DallasSensor::get_temperature_c(const uint8_t addr[]) { YIELD; if (!bus_.reset()) { - LOG_ERROR(("Bus reset failed after reading scratchpad from %s"), Sensor(addr).id().c_str()); + LOG_ERROR("Bus reset failed after reading scratchpad from %s", Sensor(addr).id().c_str()); return EMS_VALUE_SHORT_NOTSET; } YIELD; if (bus_.crc8(scratchpad, SCRATCHPAD_LEN - 1) != scratchpad[SCRATCHPAD_LEN - 1]) { - LOG_WARNING(("Invalid scratchpad CRC: %02X%02X%02X%02X%02X%02X%02X%02X%02X from sensor %s"), + LOG_WARNING("Invalid scratchpad CRC: %02X%02X%02X%02X%02X%02X%02X%02X%02X from sensor %s", scratchpad[0], scratchpad[1], scratchpad[2], @@ -315,7 +315,7 @@ bool DallasSensor::update(const std::string & id, const std::string & name, int1 SensorCustomization.name = name; SensorCustomization.offset = offset; found = true; - LOG_DEBUG(("Customizing existing sensor ID %s"), id.c_str()); + LOG_DEBUG("Customizing existing sensor ID %s", id.c_str()); break; } } @@ -325,7 +325,7 @@ bool DallasSensor::update(const std::string & id, const std::string & name, int1 newSensor.name = name; newSensor.offset = offset; settings.sensorCustomizations.push_back(newSensor); - LOG_DEBUG(("Adding new customization for sensor ID %s"), id.c_str()); + LOG_DEBUG("Adding new customization for sensor ID %s", id.c_str()); } sensor.ha_registered = false; // it's changed so we may need to recreate the HA config return StateUpdateResult::CHANGED; @@ -441,7 +441,7 @@ void DallasSensor::remove_ha_topic(const std::string & id) { return; } #ifdef EMSESP_DEBUG - LOG_DEBUG(("Removing HA config for temperature sensor ID %s"), id.c_str()); + LOG_DEBUG("Removing HA config for temperature sensor ID %s", id.c_str()); #endif // use '_' as HA doesn't like '-' in the topic name std::string sensorid = id; @@ -483,7 +483,7 @@ void DallasSensor::publish_values(const bool force) { // to e.g. homeassistant/sensor/ems-esp/dallassensor_28-233D-9497-0C03/config if (Mqtt::ha_enabled()) { if (!sensor.ha_registered || force) { - LOG_DEBUG(("Recreating HA config for sensor ID %s"), sensor.id().c_str()); + LOG_DEBUG("Recreating HA config for sensor ID %s", sensor.id().c_str()); StaticJsonDocument config; config["dev_cla"] = "temperature"; @@ -530,7 +530,7 @@ void DallasSensor::publish_values(const bool force) { } } - Mqtt::publish(("dallassensor_data"), doc.as()); + Mqtt::publish("dallassensor_data", doc.as()); } @@ -574,7 +574,7 @@ bool DallasSensor::Sensor::apply_customization() { if (!sensors.empty()) { for (const auto & sensor : sensors) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(("Loading customization for dallas sensor %s"), sensor.id.c_str()); + LOG_DEBUG("Loading customization for dallas sensor %s", sensor.id.c_str()); #endif if (id_ == sensor.id) { set_name(sensor.name); diff --git a/src/devices/boiler.cpp b/src/devices/boiler.cpp index 281f3f8dc..13f6c8ed6 100644 --- a/src/devices/boiler.cpp +++ b/src/devices/boiler.cpp @@ -2081,7 +2081,7 @@ bool Boiler::set_ww_circulation_mode(const char * value, const int8_t id) { } if (v < 7) { - // LOG_INFO(("Setting dhw circulation mode %dx3min"), v); + // LOG_INFO("Setting dhw circulation mode %dx3min", v); } else if (v == 7) { // LOG_INFO("Setting dhw circulation mode continuous"); } else { @@ -2142,11 +2142,11 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { uint8_t month = (value[3] - '0') * 10 + (value[4] - '0'); uint8_t year = (uint8_t)(Helpers::atoint(&value[6]) - 2000); if (day > 0 && day < 32 && month > 0 && month < 13) { - LOG_INFO(("Setting maintenance date to %02d.%02d.%04d"), day, month, year + 2000); + LOG_INFO("Setting maintenance date to %02d.%02d.%04d", day, month, year + 2000); uint8_t data[5] = {2, (uint8_t)(maintenanceTime_ / 100), day, month, year}; write_command(0x15, 0, data, 5, 0x15); } else { - LOG_WARNING(("Setting maintenance: wrong format %d.%d.%d"), day, month, year + 2000); + LOG_WARNING("Setting maintenance: wrong format %d.%d.%d", day, month, year + 2000); return false; } return true; @@ -2155,7 +2155,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { int hrs; if (Helpers::value2number(value, hrs)) { if (hrs > 99 && hrs < 25600) { - LOG_INFO(("Setting maintenance time %d hours"), hrs); + LOG_INFO("Setting maintenance time %d hours", hrs); uint8_t data[2] = {1, (uint8_t)(hrs / 100)}; write_command(0x15, 0, data, 2, 0x15); return true; @@ -2164,7 +2164,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) { uint8_t num; if (Helpers::value2enum(value, num, FL_(enum_off_time_date_manual))) { - LOG_INFO(("Setting maintenance type to %s"), value); + LOG_INFO("Setting maintenance type to %s", value); write_command(0x15, 0, num, 0x15); return true; } @@ -2177,7 +2177,7 @@ bool Boiler::set_maintenancetime(const char * value, const int8_t id) { int hrs; if (Helpers::value2number(value, hrs)) { if (hrs > 99 && hrs < 25600) { - LOG_INFO(("Setting maintenance time %d hours"), hrs); + LOG_INFO("Setting maintenance time %d hours", hrs); uint8_t data[2] = {1, (uint8_t)(hrs / 100)}; write_command(0x15, 0, data, 2, 0x15); return true; @@ -2194,11 +2194,11 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) { uint8_t month = (value[3] - '0') * 10 + (value[4] - '0'); uint8_t year = (uint8_t)(Helpers::atoint(&value[6]) - 2000); if (day > 0 && day < 32 && month > 0 && month < 13) { - LOG_INFO(("Setting maintenance date to %02d.%02d.%04d"), day, month, year + 2000); + LOG_INFO("Setting maintenance date to %02d.%02d.%04d", day, month, year + 2000); uint8_t data[5] = {2, (uint8_t)(maintenanceTime_ / 100), day, month, year}; write_command(0x15, 0, data, 5, 0x15); } else { - LOG_WARNING(("Setting maintenance: wrong format %d.%d.%d"), day, month, year + 2000); + LOG_WARNING("Setting maintenance: wrong format %d.%d.%d", day, month, year + 2000); return false; } return true; @@ -2215,7 +2215,7 @@ bool Boiler::set_pool_temp(const char * value, const int8_t id) { return false; } uint8_t v2 = ((v * 2) + 0.5); - // LOG_INFO(("Setting pool temperature to %d.%d C"), v2 >> 1, (v2 & 0x01) * 5); + // LOG_INFO("Setting pool temperature to %d.%d C", v2 >> 1, (v2 & 0x01) * 5); write_command(0x48A, 1, v2, 0x48A); return true; diff --git a/src/devices/solar.cpp b/src/devices/solar.cpp index f4ab5b704..0bdbbf2d5 100644 --- a/src/devices/solar.cpp +++ b/src/devices/solar.cpp @@ -664,7 +664,7 @@ void Solar::process_SM100ParamCfg(std::shared_ptr telegram) { telegram->read_value(max, 13); telegram->read_value(cur, 17); - // LOG_DEBUG(("SM100ParamCfg param=0x%04X, offset=%d, min=%d, default=%d, max=%d, current=%d"), t_id, of, min, def, max, cur)); + // LOG_DEBUG("SM100ParamCfg param=0x%04X, offset=%d, min=%d, default=%d, max=%d, current=%d", t_id, of, min, def, max, cur)); } /* diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 4486e09bb..c0661977d 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -1548,7 +1548,7 @@ bool Thermostat::set_calinttemp(const char * value, const int8_t id) { } auto t = (int8_t)(ct * 10); - LOG_DEBUG(("Calibrating internal temperature to %d.%d C"), t / 10, t < 0 ? -t % 10 : t % 10); + LOG_DEBUG("Calibrating internal temperature to %d.%d C", t / 10, t < 0 ? -t % 10 : t % 10); if (model() == EMS_DEVICE_FLAG_RC10) { write_command(0xB0, 0, t, 0xB0); @@ -2157,11 +2157,11 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { return false; } if (data[1] == 0 || data[1] > 12 || data[2] > 23 || data[3] == 0 || data[3] > 31 || data[4] > 59 || data[5] > 59 || data[6] > 6 || data[7] > 3) { - LOG_WARNING(("Invalid date/time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); + LOG_WARNING("Invalid date/time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d", data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); return false; } - // LOG_INFO(("Setting date and time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d"), data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); + // LOG_INFO("Setting date and time: %02d.%02d.2%03d-%02d:%02d:%02d-%d-%d", data[3], data[1], data[0], data[2], data[4], data[5], data[6], data[7]); write_command(EMS_TYPE_time, 0, data, 8, EMS_TYPE_time); return true; @@ -2634,7 +2634,7 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char day = 7; on = 7; time = 0x90; - // LOG_INFO(("switchtime %02d cleared"), no); + // LOG_INFO("switchtime %02d cleared", no); } } else { if (strlen(value) > 1) { @@ -2675,7 +2675,7 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char day = 7; on = 7; time = 0x90; - // LOG_INFO(("switchtime %02d cleared"), no); + // LOG_INFO("switchtime %02d cleared", no); } } uint8_t data[2] = {0xE7, 0x90}; // unset switchtime @@ -2691,8 +2691,8 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char max_on = 1; } if (no > 41 || time > 0x90 || ((on < min_on || on > max_on) && on != 7)) { - // LOG_WARNING(("Setting switchtime: Invalid data: %s"), value); - // LOG_WARNING(("Setting switchtime: Invalid data: %02d.%1d.0x%02X.%1d"), no, day, time, on); + // LOG_WARNING("Setting switchtime: Invalid data: %s", value); + // LOG_WARNING("Setting switchtime: Invalid data: %02d.%1d.0x%02X.%1d", no, day, time, on); return false; } if (data[0] != 0xE7) { diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index e58d93754..efae2a2c7 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -215,7 +215,7 @@ std::string EMSdevice::to_string_short() const { // for each telegram that has the fetch value set (true) do a read request void EMSdevice::fetch_values() { - EMSESP::logger().debug(("Fetching values for deviceID 0x%02X"), device_id()); + EMSESP::logger().debug("Fetching values for deviceID 0x%02X", device_id()); for (const auto & tf : telegram_functions_) { if (tf.fetch_) { @@ -226,7 +226,7 @@ void EMSdevice::fetch_values() { // toggle on/off automatic fetch for a telegramID void EMSdevice::toggle_fetch(uint16_t telegram_id, bool toggle) { - EMSESP::logger().debug(("Toggling fetch for deviceID 0x%02X, telegramID 0x%02X to %d"), device_id(), telegram_id, toggle); + EMSESP::logger().debug("Toggling fetch for deviceID 0x%02X, telegramID 0x%02X to %d", device_id(), telegram_id, toggle); for (auto & tf : telegram_functions_) { if (tf.telegram_type_id_ == telegram_id) { @@ -289,7 +289,7 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const { } /* // colored list of type-ids - shell.printf((" This %s will listen to telegram type IDs: "), device_type_name().c_str()); + shell.printf(" This %s will listen to telegram type IDs: ", device_type_name().c_str()); for (const auto & tf : telegram_functions_) { if (tf.received_ && !tf.fetch_) { shell.printf(COLOR_BRIGHT_GREEN); @@ -298,34 +298,34 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const { } else { shell.printf(COLOR_BRIGHT_RED); } - shell.printf(("0x%02X "), tf.telegram_type_id_); + shell.printf("0x%02X ", tf.telegram_type_id_); } shell.printf(COLOR_RESET); */ shell.printf(" Received telegram type IDs: "); for (const auto & tf : telegram_functions_) { if (tf.received_ && !tf.fetch_) { - shell.printf(("0x%02X "), tf.telegram_type_id_); + shell.printf("0x%02X ", tf.telegram_type_id_); } } shell.println(); shell.printf(" Fetched telegram type IDs: "); for (const auto & tf : telegram_functions_) { if (tf.fetch_) { - shell.printf(("0x%02X "), tf.telegram_type_id_); + shell.printf("0x%02X ", tf.telegram_type_id_); } } shell.println(); shell.printf(" Pending telegram type IDs: "); for (const auto & tf : telegram_functions_) { if (!tf.received_ && !tf.fetch_) { - shell.printf(("0x%02X "), tf.telegram_type_id_); + shell.printf("0x%02X ", tf.telegram_type_id_); } } shell.println(); shell.printf(" Ignored telegram type IDs: "); for (auto handlers : handlers_ignored_) { - shell.printf(("0x%02X "), handlers); + shell.printf("0x%02X ", handlers); } shell.println(); } @@ -1183,7 +1183,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 // if we're filtering on an attribute, go find it if (attribute_s) { #if defined(EMSESP_DEBUG) - EMSESP::logger().debug(("[DEBUG] Attribute '%s'"), attribute_s); + EMSESP::logger().debug("[DEBUG] Attribute '%s'", attribute_s); #endif if (json.containsKey(attribute_s)) { JsonVariant data = json[attribute_s]; diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 0582a7384..1e44808ab 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -248,17 +248,17 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { if (bus_status() != BUS_STATUS_OFFLINE) { shell.printfln("EMS Bus info:"); - EMSESP::webSettingsService.read([&](WebSettings & settings) { shell.printfln((" Tx mode: %d"), settings.tx_mode); }); - shell.printfln((" Bus protocol: %s"), EMSbus::is_ht3() ? ("HT3") : ("Buderus")); - shell.printfln((" #recognized EMS devices: %d"), EMSESP::emsdevices.size()); - shell.printfln((" #telegrams received: %d"), rxservice_.telegram_count()); - shell.printfln((" #read requests sent: %d"), txservice_.telegram_read_count()); - shell.printfln((" #write requests sent: %d"), txservice_.telegram_write_count()); - shell.printfln((" #incomplete telegrams: %d"), rxservice_.telegram_error_count()); + EMSESP::webSettingsService.read([&](WebSettings & settings) { shell.printfln(" Tx mode: %d", settings.tx_mode); }); + shell.printfln(" Bus protocol: %s", EMSbus::is_ht3() ? ("HT3") : ("Buderus")); + shell.printfln(" #recognized EMS devices: %d", EMSESP::emsdevices.size()); + shell.printfln(" #telegrams received: %d", rxservice_.telegram_count()); + shell.printfln(" #read requests sent: %d", txservice_.telegram_read_count()); + shell.printfln(" #write requests sent: %d", txservice_.telegram_write_count()); + shell.printfln(" #incomplete telegrams: %d", rxservice_.telegram_error_count()); shell.printfln((" #read fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_read_fail_count()); shell.printfln((" #write fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_write_fail_count()); - shell.printfln((" Rx line quality: %d%%"), rxservice_.quality()); - shell.printfln((" Tx line quality: %d%%"), (txservice_.read_quality() + txservice_.read_quality()) / 2); + shell.printfln(" Rx line quality: %d%%", rxservice_.quality()); + shell.printfln(" Tx line quality: %d%%", (txservice_.read_quality() + txservice_.read_quality()) / 2); shell.println(); } @@ -269,7 +269,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { } else { shell.printfln(("Rx Queue (%ld telegram%s):"), rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s"); for (const auto & it : rx_telegrams) { - shell.printfln((" [%02d] %s"), it.id_, pretty_telegram(it.telegram_).c_str()); + shell.printfln(" [%02d] %s", it.id_, pretty_telegram(it.telegram_).c_str()); } } @@ -291,7 +291,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) { } else if ((it.telegram_->operation) == Telegram::Operation::TX_WRITE) { op = "WRITE"; } - shell.printfln((" [%02d%c] %s %s"), it.id_, ((it.retry_) ? '*' : ' '), op.c_str(), pretty_telegram(it.telegram_).c_str()); + shell.printfln(" [%02d%c] %s %s", it.id_, ((it.retry_) ? '*' : ' '), op.c_str(), pretty_telegram(it.telegram_).c_str()); } } @@ -725,7 +725,7 @@ void EMSESP::process_UBADevices(std::shared_ptr telegram) { // if we haven't already detected this device, request it's version details, unless its us (EMS-ESP) // when the version info is received, it will automagically add the device if ((device_id != EMSbus::ems_bus_id()) && !(EMSESP::device_exists(device_id))) { - LOG_DEBUG(("New EMS device detected with ID 0x%02X. Requesting version information."), device_id); + LOG_DEBUG("New EMS device detected with ID 0x%02X. Requesting version information.", device_id); send_read_request(EMSdevice::EMS_TYPE_VERSION, device_id); } } @@ -785,7 +785,7 @@ void EMSESP::process_version(std::shared_ptr telegram) { bool EMSESP::process_telegram(std::shared_ptr telegram) { // if watching or reading... if ((telegram->type_id == read_id_) && (telegram->dest == txservice_.ems_bus_id())) { - LOG_INFO(("%s"), pretty_telegram(telegram).c_str()); + LOG_INFO("%s", pretty_telegram(telegram).c_str()); if (Mqtt::send_response()) { publish_response(telegram); } @@ -797,12 +797,12 @@ bool EMSESP::process_telegram(std::shared_ptr telegram) { } else if (watch() == WATCH_ON) { if ((watch_id_ == WATCH_ID_NONE) || (telegram->type_id == watch_id_) || ((watch_id_ < 0x80) && ((telegram->src == watch_id_) || (telegram->dest == watch_id_)))) { - LOG_NOTICE(("%s"), pretty_telegram(telegram).c_str()); + LOG_NOTICE("%s", pretty_telegram(telegram).c_str()); } else if (!trace_raw_) { - LOG_TRACE(("%s"), pretty_telegram(telegram).c_str()); + LOG_TRACE("%s", pretty_telegram(telegram).c_str()); } } else if (!trace_raw_) { - LOG_TRACE(("%s"), pretty_telegram(telegram).c_str()); + LOG_TRACE("%s", pretty_telegram(telegram).c_str()); } // only process broadcast telegrams or ones sent to us on request @@ -860,7 +860,7 @@ bool EMSESP::process_telegram(std::shared_ptr telegram) { if (!found) { LOG_DEBUG(("No telegram type handler found for ID 0x%02X (src 0x%02X)"), telegram->type_id, telegram->src); if (watch() == WATCH_UNKNOWN) { - LOG_NOTICE(("%s"), pretty_telegram(telegram).c_str()); + LOG_NOTICE("%s", pretty_telegram(telegram).c_str()); } if (!wait_km_ && !knowndevice && (telegram->src != EMSbus::ems_bus_id()) && (telegram->message_length > 0)) { send_read_request(EMSdevice::EMS_TYPE_VERSION, telegram->src); @@ -905,7 +905,7 @@ void EMSESP::show_devices(uuid::console::Shell & shell) { for (const auto & device_class : EMSFactory::device_handlers()) { for (const auto & emsdevice : emsdevices) { if (emsdevice && (emsdevice->device_type() == device_class.first)) { - shell.printf(("%s: %s"), emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str()); + shell.printf("%s: %s", emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str()); shell.println(); emsdevice->show_telegram_handlers(shell); @@ -932,7 +932,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const if (product_id == 0) { // update only with valid product_id return true; } - LOG_DEBUG(("Updating details for already active deviceID 0x%02X"), device_id); + LOG_DEBUG("Updating details for already active deviceID 0x%02X", device_id); emsdevice->product_id(product_id); emsdevice->version(version); // only set brand if it doesn't already exist @@ -1039,7 +1039,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const fetch_device_values(device_id); // go and fetch its data // Print to LOG showing we've added a new device - LOG_INFO(("Recognized new %s with deviceID 0x%02X"), EMSdevice::device_type_2_device_name(device_type).c_str(), device_id); + LOG_INFO("Recognized new %s with deviceID 0x%02X", EMSdevice::device_type_2_device_name(device_type).c_str(), device_id); // add command commands for all devices, except for connect, controller and gateway if ((device_type == DeviceType::CONNECT) || (device_type == DeviceType::CONTROLLER) || (device_type == DeviceType::GATEWAY)) { @@ -1174,7 +1174,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data); #ifdef EMSESP_UART_DEBUG // get_uptime is only updated once per loop, does not give the right time - LOG_TRACE(("[UART_DEBUG] Echo after %d ms: %s"), ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE("[UART_DEBUG] Echo after %d ms: %s", ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); #endif // add to RxQueue for log/watch rxservice_.add(data, length); @@ -1248,11 +1248,11 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { #ifdef EMSESP_UART_DEBUG char s[4]; if (first_value & 0x80) { - LOG_TRACE(("[UART_DEBUG] next Poll %s after %d ms"), Helpers::hextoa(s, first_value), ::millis() - rx_time_); + LOG_TRACE("[UART_DEBUG] next Poll %s after %d ms", Helpers::hextoa(s, first_value), ::millis() - rx_time_); // time measurement starts here, use millis because get_uptime is only updated once per loop rx_time_ = ::millis(); } else { - LOG_TRACE(("[UART_DEBUG] Poll ack %s after %d ms"), Helpers::hextoa(s, first_value), ::millis() - rx_time_); + LOG_TRACE("[UART_DEBUG] Poll ack %s after %d ms", Helpers::hextoa(s, first_value), ::millis() - rx_time_); } #endif // check for poll to us, if so send top message from Tx queue immediately and quit @@ -1264,7 +1264,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) { return; } else { #ifdef EMSESP_UART_DEBUG - LOG_TRACE(("[UART_DEBUG] Reply after %d ms: %s"), ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE("[UART_DEBUG] Reply after %d ms: %s", ::millis() - rx_time_, Helpers::data_to_hex(data, length).c_str()); #endif Roomctrl::check((data[1] ^ 0x80 ^ rxservice_.ems_mask()), data); // check if there is a message for the roomcontroller @@ -1292,7 +1292,7 @@ void EMSESP::start() { LOG_NOTICE("System is running in Debug mode"); #endif - LOG_INFO(("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str()); + LOG_INFO("Last system reset reason Core0: %s, Core1: %s", system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str()); // do any system upgrades if (system_.check_upgrade()) { diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 579b71fca..353cc8cd9 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -186,15 +186,15 @@ void Mqtt::loop() { // print MQTT log and other stuff to console void Mqtt::show_mqtt(uuid::console::Shell & shell) { - shell.printfln(("MQTT is %s"), connected() ? F_(connected) : F_(disconnected)); + shell.printfln("MQTT is %s", connected() ? F_(connected) : F_(disconnected)); - shell.printfln(("MQTT publish errors: %lu"), mqtt_publish_fails_); + shell.printfln("MQTT publish errors: %lu", mqtt_publish_fails_); shell.println(); // show subscriptions shell.printfln("MQTT topic subscriptions:"); for (const auto & mqtt_subfunction : mqtt_subfunctions_) { - shell.printfln((" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str()); + shell.printfln(" %s/%s", mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str()); } shell.println(); @@ -266,14 +266,14 @@ void Mqtt::on_message(const char * topic, const char * payload, size_t len) cons if (len) { LOG_DEBUG(("Received topic `%s` => payload `%s` (length %d)"), topic, message, len); } else { - LOG_DEBUG(("Received topic `%s`"), topic); + LOG_DEBUG("Received topic `%s`", topic); } #endif // remove HA topics if we don't use discovery if (strncmp(topic, discovery_prefix().c_str(), discovery_prefix().size()) == 0) { if (!ha_enabled_ && len) { // don't ping pong the empty message queue_publish_message(topic, "", true); - LOG_DEBUG(("Remove topic %s"), topic); + LOG_DEBUG("Remove topic %s", topic); } return; } @@ -285,7 +285,7 @@ void Mqtt::on_message(const char * topic, const char * payload, size_t len) cons snprintf(full_topic, sizeof(full_topic), "%s/%s", mqtt_base_.c_str(), mf.topic_.c_str()); if ((!strcmp(topic, full_topic)) && (mf.mqtt_subfunction_)) { if (!(mf.mqtt_subfunction_)(message)) { - LOG_ERROR(("error: invalid payload %s for this topic %s"), message, topic); + LOG_ERROR("error: invalid payload %s for this topic %s", message, topic); if (send_response_) { Mqtt::publish(F_(response), "error: invalid data"); } @@ -344,7 +344,7 @@ void Mqtt::show_topic_handlers(uuid::console::Shell & shell, const uint8_t devic // shell.print(" Subscribed MQTT topics: "); // for (const auto & mqtt_subfunction : mqtt_subfunctions_) { // if (mqtt_subfunction.device_type_ == device_type) { - // shell.printf(("%s "), mqtt_subfunction.topic_.c_str()); + // shell.printf("%s ", mqtt_subfunction.topic_.c_str()); // } // } shell.println(); @@ -358,7 +358,7 @@ void Mqtt::on_publish(uint16_t packetId) const { // find the MQTT message in the queue and remove it if (mqtt_messages_.empty()) { #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] No message stored for ACK pid %d"), packetId); + LOG_DEBUG("[DEBUG] No message stored for ACK pid %d", packetId); #endif return; } @@ -374,12 +374,12 @@ void Mqtt::on_publish(uint16_t packetId) const { } if (mqtt_message.packet_id_ != packetId) { - LOG_ERROR(("Mismatch, expecting PID %d, got %d"), mqtt_message.packet_id_, packetId); + LOG_ERROR("Mismatch, expecting PID %d, got %d", mqtt_message.packet_id_, packetId); mqtt_publish_fails_++; // increment error count } #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] ACK pid %d"), packetId); + LOG_DEBUG("[DEBUG] ACK pid %d", packetId); #endif mqtt_messages_.pop_front(); // always remove from queue, regardless if there was a successful ACK @@ -460,7 +460,7 @@ void Mqtt::start() { } else if (reason == AsyncMqttClientDisconnectReason::MQTT_NOT_AUTHORIZED) { LOG_WARNING("MQTT disconnected: Not authorized"); } else { - LOG_WARNING(("MQTT disconnected: code %d"), reason); + LOG_WARNING("MQTT disconnected: code %d", reason); } }); @@ -767,7 +767,7 @@ void Mqtt::publish_ha(const std::string & topic) { std::string fulltopic = Mqtt::discovery_prefix() + topic; #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] Publishing empty HA topic=%s"), fulltopic.c_str()); + LOG_DEBUG("[DEBUG] Publishing empty HA topic=%s", fulltopic.c_str()); #endif queue_publish_message(fulltopic, "", true); // publish with retain to remove from broker @@ -785,9 +785,9 @@ void Mqtt::publish_ha(const std::string & topic, const JsonObject & payload) { std::string fulltopic = Mqtt::discovery_prefix() + topic; #if defined(EMSESP_STANDALONE) - LOG_DEBUG(("Publishing HA topic=%s, payload=%s"), fulltopic.c_str(), payload_text.c_str()); + LOG_DEBUG("Publishing HA topic=%s, payload=%s", fulltopic.c_str(), payload_text.c_str()); #elif defined(EMSESP_DEBUG) - LOG_DEBUG(("[debug] Publishing HA topic=%s, payload=%s"), fulltopic.c_str(), payload_text.c_str()); + LOG_DEBUG("[debug] Publishing HA topic=%s, payload=%s", fulltopic.c_str(), payload_text.c_str()); #endif // queue messages if the MQTT connection is not yet established. to ensure we don't miss messages @@ -827,13 +827,13 @@ void Mqtt::process_queue() { // if we're subscribing... if (message->operation == Operation::SUBSCRIBE) { - LOG_DEBUG(("Subscribing to topic '%s'"), topic); + LOG_DEBUG("Subscribing to topic '%s'", topic); uint16_t packet_id = mqttClient_->subscribe(topic, mqtt_qos_); if (!packet_id) { if (++mqtt_messages_.front().retry_count_ < MQTT_PUBLISH_MAX_RETRY) { return; } - LOG_ERROR(("Error subscribing to topic '%s'"), topic); + LOG_ERROR("Error subscribing to topic '%s'", topic); mqtt_publish_fails_++; // increment failure counter } @@ -844,13 +844,13 @@ void Mqtt::process_queue() { // if we're unsubscribing... if (message->operation == Operation::UNSUBSCRIBE) { - LOG_DEBUG(("Subscribing to topic '%s'"), topic); + LOG_DEBUG("Subscribing to topic '%s'", topic); uint16_t packet_id = mqttClient_->unsubscribe(topic); if (!packet_id) { if (++mqtt_messages_.front().retry_count_ < MQTT_PUBLISH_MAX_RETRY) { return; } - LOG_ERROR(("Error unsubscribing to topic '%s'"), topic); + LOG_ERROR("Error unsubscribing to topic '%s'", topic); mqtt_publish_fails_++; // increment failure counter } @@ -872,14 +872,14 @@ void Mqtt::process_queue() { if (packet_id == 0) { // it failed. if we retried n times, give up. remove from queue if (mqtt_message.retry_count_ == (MQTT_PUBLISH_MAX_RETRY - 1)) { - LOG_ERROR(("Failed to publish to %s after %d attempts"), topic, mqtt_message.retry_count_ + 1); + LOG_ERROR("Failed to publish to %s after %d attempts", topic, mqtt_message.retry_count_ + 1); mqtt_publish_fails_++; // increment failure counter mqtt_messages_.pop_front(); // delete return; } else { // update the record mqtt_messages_.front().retry_count_++; - LOG_DEBUG(("Failed to publish to %s. Trying again, #%d"), topic, mqtt_message.retry_count_ + 1); + LOG_DEBUG("Failed to publish to %s. Trying again, #%d", topic, mqtt_message.retry_count_ + 1); return; // leave on queue for next time so it gets republished } } @@ -889,7 +889,7 @@ void Mqtt::process_queue() { if (mqtt_qos_ != 0) { mqtt_messages_.front().packet_id_ = packet_id; #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] Setting packetID for ACK to %d"), packet_id); + LOG_DEBUG("[DEBUG] Setting packetID for ACK to %d", packet_id); #endif return; } @@ -1036,7 +1036,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice // if we're asking to remove this topic, send an empty payload and exit // https://github.com/emsesp/EMS-ESP32/issues/196 if (remove) { - LOG_DEBUG(("Removing HA config for %s"), uniq); + LOG_DEBUG("Removing HA config for %s", uniq); publish_ha(topic); return; } diff --git a/src/shower.cpp b/src/shower.cpp index bf4937649..28978a412 100644 --- a/src/shower.cpp +++ b/src/shower.cpp @@ -82,8 +82,8 @@ void Shower::loop() { char s[50]; snprintf(s, 50, "%d minutes and %d seconds", (uint8_t)(duration_ / 60000), (uint8_t)((duration_ / 1000) % 60)); doc["duration"] = s; - Mqtt::publish(("shower_data"), doc.as()); - LOG_DEBUG(("[Shower] finished with duration %d"), duration_); + Mqtt::publish("shower_data", doc.as()); + LOG_DEBUG("[Shower] finished with duration %d", duration_); } } @@ -144,7 +144,7 @@ void Shower::set_shower_state(bool state, bool force) { // always publish as a string char s[7]; - Mqtt::publish(("shower_active"), Helpers::render_boolean(s, shower_state_)); // https://github.com/emsesp/EMS-ESP/issues/369 + Mqtt::publish("shower_active", Helpers::render_boolean(s, shower_state_)); // https://github.com/emsesp/EMS-ESP/issues/369 // send out HA MQTT Discovery config topic if ((Mqtt::ha_enabled()) && (!ha_configdone_ || force)) { diff --git a/src/system.cpp b/src/system.cpp index 0bad8d687..7ddf9fe2d 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -166,9 +166,9 @@ bool System::command_watch(const char * value, const int8_t id) { } if (Mqtt::publish_single() && w != EMSESP::watch()) { if (Mqtt::publish_single2cmd()) { - Mqtt::publish(("system/watch"), EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : (FL_(list_watch)[w])); + Mqtt::publish("system/watch", EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : (FL_(list_watch)[w])); } else { - Mqtt::publish(("system_data/watch"), EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : (FL_(list_watch)[w])); + Mqtt::publish("system_data/watch", EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(w) : (FL_(list_watch)[w])); } } EMSESP::watch(w); @@ -176,9 +176,9 @@ bool System::command_watch(const char * value, const int8_t id) { } else if (i) { if (Mqtt::publish_single() && i != EMSESP::watch_id()) { if (Mqtt::publish_single2cmd()) { - Mqtt::publish(("system/watch"), Helpers::hextoa(i)); + Mqtt::publish("system/watch", Helpers::hextoa(i)); } else { - Mqtt::publish(("system_data/watch"), Helpers::hextoa(i)); + Mqtt::publish("system_data/watch", Helpers::hextoa(i)); } } EMSESP::watch_id(i); @@ -263,21 +263,21 @@ void System::syslog_init() { if (Mqtt::publish_single()) { if (Mqtt::publish_single2cmd()) { - Mqtt::publish(("system/syslog"), syslog_enabled_ ? (FL_(list_syslog_level)[syslog_level_ + 1]) : "off"); + Mqtt::publish("system/syslog", syslog_enabled_ ? (FL_(list_syslog_level)[syslog_level_ + 1]) : "off"); if (EMSESP::watch_id() == 0 || EMSESP::watch() == 0) { - Mqtt::publish(("system/watch"), + Mqtt::publish("system/watch", EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(EMSESP::watch()) : (FL_(list_watch)[EMSESP::watch()])); } else { - Mqtt::publish(("system/watch"), Helpers::hextoa(EMSESP::watch_id())); + Mqtt::publish("system/watch", Helpers::hextoa(EMSESP::watch_id())); } } else { - Mqtt::publish(("system_data/syslog"), syslog_enabled_ ? (FL_(list_syslog_level)[syslog_level_ + 1]) : "off"); + Mqtt::publish("system_data/syslog", syslog_enabled_ ? (FL_(list_syslog_level)[syslog_level_ + 1]) : "off"); if (EMSESP::watch_id() == 0 || EMSESP::watch() == 0) { - Mqtt::publish(("system_data/watch"), + Mqtt::publish("system_data/watch", EMSESP::system_.enum_format() == ENUM_FORMAT_INDEX ? Helpers::itoa(EMSESP::watch()) : (FL_(list_watch)[EMSESP::watch()])); } else { - Mqtt::publish(("system_data/watch"), Helpers::hextoa(EMSESP::watch_id())); + Mqtt::publish("system_data/watch", Helpers::hextoa(EMSESP::watch_id())); } } } @@ -344,7 +344,7 @@ void System::wifi_tweak() { WiFi.setSleep(false); // turn off sleep - WIFI_PS_NONE bool s2 = WiFi.getSleep(); #if defined(EMSESP_DEBUG) - LOG_DEBUG(("[DEBUG] Adjusting WiFi - Tx power %d->%d, Sleep %d->%d"), p1, p2, s1, s2); + LOG_DEBUG("[DEBUG] Adjusting WiFi - Tx power %d->%d, Sleep %d->%d", p1, p2, s1, s2); #endif #endif } @@ -777,7 +777,7 @@ void System::show_users(uuid::console::Shell & shell) { #ifndef EMSESP_STANDALONE EMSESP::esp8266React.getSecuritySettingsService()->read([&](SecuritySettings & securitySettings) { for (const User & user : securitySettings.users) { - shell.printfln((" username: %s, password: %s, is_admin: %s"), user.username.c_str(), user.password.c_str(), user.admin ? ("yes") : ("no")); + shell.printfln(" username: %s, password: %s, is_admin: %s", user.username.c_str(), user.password.c_str(), user.admin ? ("yes") : ("no")); } }); #endif @@ -787,15 +787,15 @@ void System::show_users(uuid::console::Shell & shell) { void System::show_system(uuid::console::Shell & shell) { shell.println("System:"); - shell.printfln((" Board profile: %s"), board_profile().c_str()); - shell.printfln((" Uptime: %s"), uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str()); + shell.printfln(" Board profile: %s", board_profile().c_str()); + shell.printfln(" Uptime: %s", uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str()); #ifndef EMSESP_STANDALONE - shell.printfln((" SDK version: %s"), ESP.getSdkVersion()); - shell.printfln((" CPU frequency: %lu MHz"), ESP.getCpuFreqMHz()); - shell.printfln((" Free heap: %lu KB"), (uint32_t)ESP.getFreeHeap() / 1024); - shell.printfln((" App used/free: %lu KB / %lu KB"), appUsed(), appFree()); + shell.printfln(" SDK version: %s", ESP.getSdkVersion()); + shell.printfln(" CPU frequency: %lu MHz", ESP.getCpuFreqMHz()); + shell.printfln(" Free heap: %lu KB", (uint32_t)ESP.getFreeHeap() / 1024); + shell.printfln(" App used/free: %lu KB / %lu KB", appUsed(), appFree()); uint32_t FSused = LittleFS.usedBytes() / 1024; - shell.printfln((" FS used/free: %lu KB / %lu KB"), FSused, FStotal() - FSused); + shell.printfln(" FS used/free: %lu KB / %lu KB", FSused, FStotal() - FSused); shell.println(); shell.println("Network:"); @@ -814,16 +814,16 @@ void System::show_system(uuid::console::Shell & shell) { case WL_CONNECTED: shell.printfln(" Network: connected"); - shell.printfln((" SSID: %s"), WiFi.SSID().c_str()); - shell.printfln((" BSSID: %s"), WiFi.BSSIDstr().c_str()); + shell.printfln(" SSID: %s", WiFi.SSID().c_str()); + shell.printfln(" BSSID: %s", WiFi.BSSIDstr().c_str()); shell.printfln((" RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI())); - shell.printfln((" MAC address: %s"), WiFi.macAddress().c_str()); - shell.printfln((" Hostname: %s"), WiFi.getHostname()); - shell.printfln((" IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str()); - shell.printfln((" IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str()); - shell.printfln((" IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str()); + shell.printfln(" MAC address: %s", WiFi.macAddress().c_str()); + shell.printfln(" Hostname: %s", WiFi.getHostname()); + shell.printfln(" IPv4 address: %s/%s", uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str()); + shell.printfln(" IPv4 gateway: %s", uuid::printable_to_string(WiFi.gatewayIP()).c_str()); + shell.printfln(" IPv4 nameserver: %s", uuid::printable_to_string(WiFi.dnsIP()).c_str()); if (WiFi.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { - shell.printfln((" IPv6 address: %s"), uuid::printable_to_string(WiFi.localIPv6()).c_str()); + shell.printfln(" IPv6 address: %s", uuid::printable_to_string(WiFi.localIPv6()).c_str()); } break; @@ -849,13 +849,13 @@ void System::show_system(uuid::console::Shell & shell) { if (ethernet_connected_) { shell.println(); shell.printfln(" Ethernet Network: connected"); - shell.printfln((" MAC address: %s"), ETH.macAddress().c_str()); - shell.printfln((" Hostname: %s"), ETH.getHostname()); - shell.printfln((" IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str()); - shell.printfln((" IPv4 gateway: %s"), uuid::printable_to_string(ETH.gatewayIP()).c_str()); - shell.printfln((" IPv4 nameserver: %s"), uuid::printable_to_string(ETH.dnsIP()).c_str()); + shell.printfln(" MAC address: %s", ETH.macAddress().c_str()); + shell.printfln(" Hostname: %s", ETH.getHostname()); + shell.printfln(" IPv4 address: %s/%s", uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str()); + shell.printfln(" IPv4 gateway: %s", uuid::printable_to_string(ETH.gatewayIP()).c_str()); + shell.printfln(" IPv4 nameserver: %s", uuid::printable_to_string(ETH.dnsIP()).c_str()); if (ETH.localIPv6().toString() != "0000:0000:0000:0000:0000:0000:0000:0000") { - shell.printfln((" IPv6 address: %s"), uuid::printable_to_string(ETH.localIPv6()).c_str()); + shell.printfln(" IPv6 address: %s", uuid::printable_to_string(ETH.localIPv6()).c_str()); } } shell.println(); @@ -864,17 +864,17 @@ void System::show_system(uuid::console::Shell & shell) { if (!syslog_enabled_) { shell.printfln(" Syslog: disabled"); } else { - shell.printfln((" Syslog: %s"), syslog_.started() ? "started" : "stopped"); + shell.printfln(" Syslog: %s", syslog_.started() ? "started" : "stopped"); shell.print(" "); shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : (F_(unset))); - shell.printfln((" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str()); + shell.printfln(" IP: %s", uuid::printable_to_string(syslog_.ip()).c_str()); shell.print(" "); shell.printfln(F_(port_fmt), syslog_port_); shell.print(" "); shell.printfln(F_(log_level_fmt), uuid::log::format_level_lowercase(static_cast(syslog_level_))); shell.print(" "); shell.printfln(F_(mark_interval_fmt), syslog_mark_interval_); - shell.printfln((" Queued: %d"), syslog_.queued()); + shell.printfln(" Queued: %d", syslog_.queued()); } #endif @@ -954,7 +954,7 @@ bool System::saveSettings(const char * filename, const char * section, JsonObjec if (section_json) { File section_file = LittleFS.open(filename, "w"); if (section_file) { - LOG_INFO(("Applying new %s settings"), section); + LOG_INFO("Applying new %s settings", section); serializeJson(section_json, section_file); section_file.close(); return true; // reboot required diff --git a/src/telegram.cpp b/src/telegram.cpp index c1a57a9a3..c23baf6bf 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -150,9 +150,9 @@ void RxService::add(uint8_t * data, uint8_t length) { if (data[length - 1] != crc) { if ((data[0] & 0x7F) != ems_bus_id()) { // do not count echos as errors telegram_error_count_++; - LOG_WARNING(("Incomplete Rx: %s"), Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC + LOG_WARNING("Incomplete Rx: %s", Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC } else { - LOG_TRACE(("Incomplete Rx: %s"), Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC + LOG_TRACE("Incomplete Rx: %s", Helpers::data_to_hex(data, length - 1).c_str()); // exclude CRC } return; } @@ -203,16 +203,16 @@ void RxService::add(uint8_t * data, uint8_t length) { uint16_t trace_watch_id = EMSESP::watch_id(); if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id) || ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) { - LOG_NOTICE(("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); + LOG_NOTICE("Rx: %s", Helpers::data_to_hex(data, length).c_str()); } else if (EMSESP::trace_raw()) { - LOG_TRACE(("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE("Rx: %s", Helpers::data_to_hex(data, length).c_str()); } } else if (EMSESP::trace_raw()) { - LOG_TRACE(("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); + LOG_TRACE("Rx: %s", Helpers::data_to_hex(data, length).c_str()); } #ifdef EMSESP_DEBUG - LOG_DEBUG(("[DEBUG] New Rx telegram, message length %d"), message_length); + LOG_DEBUG("[DEBUG] New Rx telegram, message length %d", message_length); #endif // if we don't have a type_id exit, @@ -262,7 +262,7 @@ void TxService::start() { // sends a 1 byte poll which is our own deviceID void TxService::send_poll() const { - //LOG_DEBUG(("Ack %02X"),ems_bus_id() ^ ems_mask()); + //LOG_DEBUG("Ack %02X",ems_bus_id() ^ ems_mask()); if (tx_mode()) { EMSuart::send_poll(ems_bus_id() ^ ems_mask()); } @@ -363,12 +363,12 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) { // if we're in simulation mode, don't send anything, just quit if (EMSESP::system_.readonly_mode() && (telegram->operation == Telegram::Operation::TX_WRITE)) { - LOG_INFO(("[readonly] Sending write Tx telegram: %s"), Helpers::data_to_hex(telegram_raw, length - 1).c_str()); + LOG_INFO("[readonly] Sending write Tx telegram: %s", Helpers::data_to_hex(telegram_raw, length - 1).c_str()); tx_state(Telegram::Operation::NONE); return; } - LOG_DEBUG(("Sending %s Tx [#%d], telegram: %s"), + LOG_DEBUG("Sending %s Tx [#%d], telegram: %s", (telegram->operation == Telegram::Operation::TX_WRITE) ? ("write") : ("read"), tx_telegram.id_, Helpers::data_to_hex(telegram_raw, length - 1).c_str()); // exclude the last CRC byte @@ -429,7 +429,7 @@ void TxService::add(const uint8_t operation, auto telegram = std::make_shared(operation, ems_bus_id(), dest, type_id, offset, message_data, message_length); #ifdef EMSESP_DEBUG - LOG_DEBUG(("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length); + LOG_DEBUG("[DEBUG] New Tx [#%d] telegram, length %d", tx_telegram_id_, message_length); #endif // if the queue is full, make room but removing the last one @@ -488,7 +488,7 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt // if we don't have a type_id or empty data block, exit if ((type_id == 0) || (message_length == 0)) { #ifdef EMSESP_DEBUG - LOG_DEBUG(("[DEBUG] Tx telegram type %d failed, length %d"), type_id, message_length); + LOG_DEBUG("[DEBUG] Tx telegram type %d failed, length %d", type_id, message_length); #endif return; } @@ -511,7 +511,7 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt } #ifdef EMSESP_DEBUG - LOG_DEBUG(("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length); + LOG_DEBUG("[DEBUG] New Tx [#%d] telegram, length %d", tx_telegram_id_, message_length); #endif if (front) { @@ -528,7 +528,7 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt // send a Tx telegram to request data from an EMS device void TxService::read_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset, const uint8_t length) { - LOG_DEBUG(("Tx read request to device 0x%02X for type ID 0x%02X"), dest, type_id); + LOG_DEBUG("Tx read request to device 0x%02X for type ID 0x%02X", dest, type_id); uint8_t message_data = (type_id > 0xFF) ? (EMS_MAX_TELEGRAM_MESSAGE_LENGTH - 2) : EMS_MAX_TELEGRAM_MESSAGE_LENGTH; // if length set, publish result and set telegram to front @@ -593,7 +593,7 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui EMSESP::wait_validate(0); // do not wait for validation if (operation == Telegram::Operation::TX_READ) { if (telegram_last_->offset > 0) { // ignore errors for higher offsets - LOG_DEBUG(("Last Tx Read operation failed after %d retries. Ignoring request: %s"), MAXIMUM_TX_RETRIES, telegram_last_->to_string().c_str()); + LOG_DEBUG("Last Tx Read operation failed after %d retries. Ignoring request: %s", MAXIMUM_TX_RETRIES, telegram_last_->to_string().c_str()); return; } increment_telegram_read_fail_count(); // another Tx fail @@ -601,7 +601,7 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui increment_telegram_write_fail_count(); // another Tx fail } - LOG_ERROR(("Last Tx %s operation failed after %d retries. Ignoring request: %s"), + LOG_ERROR("Last Tx %s operation failed after %d retries. Ignoring request: %s", (operation == Telegram::Operation::TX_WRITE) ? ("Write") : ("Read"), MAXIMUM_TX_RETRIES, telegram_last_->to_string().c_str()); @@ -613,7 +613,7 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui } #ifdef EMSESP_DEBUG - LOG_DEBUG(("[DEBUG] Last Tx %s operation failed. Retry #%d. sent message: %s, received: %s"), + LOG_DEBUG("[DEBUG] Last Tx %s operation failed. Retry #%d. sent message: %s, received: %s", (operation == Telegram::Operation::TX_WRITE) ? ("Write") : ("Read"), retry_count_, telegram_last_->to_string().c_str(), @@ -665,7 +665,7 @@ uint16_t TxService::post_send_query() { (this->telegram_last_->type_id > 0xFF) ? (EMS_MAX_TELEGRAM_MESSAGE_LENGTH - 2) : EMS_MAX_TELEGRAM_MESSAGE_LENGTH; // request all data, 32 bytes this->add(Telegram::Operation::TX_READ, dest, post_typeid, offset, &message_data, 1, 0, true); // add to top/front of queue // read_request(telegram_last_post_send_query_, dest, 0); // no offset - LOG_DEBUG(("Sending post validate read, type ID 0x%02X to dest 0x%02X"), post_typeid, dest); + LOG_DEBUG("Sending post validate read, type ID 0x%02X to dest 0x%02X", post_typeid, dest); set_post_send_query(0); // reset // delay the request if we have a different type_id for post_send_query delayed_send_ = (this->telegram_last_->type_id == post_typeid) ? 0 : (uuid::get_uptime() + POST_SEND_DELAY); diff --git a/src/test/test.cpp b/src/test/test.cpp index 3476a85b2..21a41496f 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -597,7 +597,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const // n=1 = EMSESP::system_.HEALTHCHECK_NO_BUS // n=2 = EMSESP::system_.HEALTHCHECK_NO_NETWORK - shell.printfln(("Testing healthcheck with %d"), n); + shell.printfln("Testing healthcheck with %d", n); EMSESP::system_.healthcheck(n); } @@ -1339,8 +1339,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const } doc.shrinkToFit(); JsonObject jo = doc.as(); - shell.printfln(("Size of JSON payload = %d"), jo.memoryUsage()); - shell.printfln(("Length of JSON payload = %d"), measureJson(jo)); + shell.printfln("Size of JSON payload = %d", jo.memoryUsage()); + shell.printfln("Length of JSON payload = %d", measureJson(jo)); Mqtt::publish("test", jo); Mqtt::show_mqtt(shell); // show queue @@ -1483,7 +1483,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const #pragma GCC diagnostic ignored "-Wdiv-by-zero" #pragma GCC diagnostic ignored "-Wunused-variable" uint8_t a = 2 / 0; - shell.printfln(("Testing %s"), a); + shell.printfln("Testing %s", a); #pragma GCC diagnostic pop } diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index 21619f490..ce9fd1ab5 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -34,13 +34,13 @@ WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * se void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { switch (event) { case ARDUINO_EVENT_WIFI_STA_DISCONNECTED: - EMSESP::logger().warning(("WiFi disconnected. Reason code=%d"), info.wifi_sta_disconnected.reason); // IDF 4.0 + EMSESP::logger().warning("WiFi disconnected. Reason code=%d", info.wifi_sta_disconnected.reason); // IDF 4.0 WiFi.disconnect(true); break; case ARDUINO_EVENT_WIFI_STA_GOT_IP: #ifndef EMSESP_STANDALONE - EMSESP::logger().info(("WiFi connected with IP=%s, hostname=%s"), WiFi.localIP().toString().c_str(), WiFi.getHostname()); + EMSESP::logger().info("WiFi connected with IP=%s, hostname=%s", WiFi.localIP().toString().c_str(), WiFi.getHostname()); #endif // EMSESP::system_.send_heartbeat(); // send from mqtt start EMSESP::system_.syslog_init(); @@ -64,7 +64,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { // prevent double calls if (!EMSESP::system_.ethernet_connected()) { #ifndef EMSESP_STANDALONE - EMSESP::logger().info(("Ethernet connected with IP=%s, speed %d Mbps"), ETH.localIP().toString().c_str(), ETH.linkSpeed()); + EMSESP::logger().info("Ethernet connected with IP=%s, speed %d Mbps", ETH.localIP().toString().c_str(), ETH.linkSpeed()); #endif // EMSESP::system_.send_heartbeat(); EMSESP::system_.syslog_init(); @@ -103,9 +103,9 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { case ARDUINO_EVENT_WIFI_STA_GOT_IP6: case ARDUINO_EVENT_ETH_GOT_IP6: if (EMSESP::system_.ethernet_connected()) { - EMSESP::logger().info(("Ethernet connected with IPv6=%s, speed %d Mbps"), ETH.localIPv6().toString().c_str(), ETH.linkSpeed()); + EMSESP::logger().info("Ethernet connected with IPv6=%s, speed %d Mbps", ETH.localIPv6().toString().c_str(), ETH.linkSpeed()); } else { - EMSESP::logger().info(("WiFi connected with IPv6=%s, hostname=%s"), WiFi.localIPv6().toString().c_str(), WiFi.getHostname()); + EMSESP::logger().info("WiFi connected with IPv6=%s, hostname=%s", WiFi.localIPv6().toString().c_str(), WiFi.getHostname()); } // EMSESP::system_.send_heartbeat(); EMSESP::system_.syslog_init(); From 22322a55ed650c91f6487f9a89147d5555c148b7 Mon Sep 17 00:00:00 2001 From: proddy Date: Fri, 30 Sep 2022 20:47:47 +0200 Subject: [PATCH 09/28] update --- interface/package-lock.json | 28 ++++++++++++++-------------- interface/package.json | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/interface/package-lock.json b/interface/package-lock.json index 96f64bf37..330de6a46 100644 --- a/interface/package-lock.json +++ b/interface/package-lock.json @@ -14,7 +14,7 @@ "@mui/icons-material": "^5.10.6", "@mui/material": "^5.10.7", "@table-library/react-table-library": "4.0.18", - "@types/lodash": "^4.14.185", + "@types/lodash": "^4.14.186", "@types/node": "^18.7.23", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", @@ -34,7 +34,7 @@ "react-router-dom": "^6.4.1", "react-scripts": "5.0.1", "sockette": "^2.0.6", - "typesafe-i18n": "^5.13.1", + "typesafe-i18n": "^5.14.0", "typescript": "^4.8.4" }, "devDependencies": { @@ -4019,9 +4019,9 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==" }, "node_modules/@types/lodash": { - "version": "4.14.185", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.185.tgz", - "integrity": "sha512-evMDG1bC4rgQg4ku9tKpuMh5iBNEwNa3tf9zRHdP1qlv+1WUg44xat4IxCE14gIpZRGUUWAx2VhItCZc25NfMA==" + "version": "4.14.186", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.186.tgz", + "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==" }, "node_modules/@types/mime": { "version": "3.0.1", @@ -16420,9 +16420,9 @@ } }, "node_modules/typesafe-i18n": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.1.tgz", - "integrity": "sha512-9Cgikxcj+2LAWQGZ8pOQAf14P+aOOcOel/G1kSAXAObA4Htj8R+qgCx9DqUnxjRfugWzM/19ZqGss7dl8Dw7Gg==", + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.14.0.tgz", + "integrity": "sha512-ZNHysUvZZhmUuMjBvDGtUI8vT3g//4ay5fFOk2sJCsjx4ztippW1Hrhrq59nJ9mV/Q0u4OX80Gyorq8L3rwNLw==", "bin": { "typesafe-i18n": "cli/typesafe-i18n.mjs" }, @@ -20223,9 +20223,9 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==" }, "@types/lodash": { - "version": "4.14.185", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.185.tgz", - "integrity": "sha512-evMDG1bC4rgQg4ku9tKpuMh5iBNEwNa3tf9zRHdP1qlv+1WUg44xat4IxCE14gIpZRGUUWAx2VhItCZc25NfMA==" + "version": "4.14.186", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.186.tgz", + "integrity": "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==" }, "@types/mime": { "version": "3.0.1", @@ -29096,9 +29096,9 @@ } }, "typesafe-i18n": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.13.1.tgz", - "integrity": "sha512-9Cgikxcj+2LAWQGZ8pOQAf14P+aOOcOel/G1kSAXAObA4Htj8R+qgCx9DqUnxjRfugWzM/19ZqGss7dl8Dw7Gg==", + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/typesafe-i18n/-/typesafe-i18n-5.14.0.tgz", + "integrity": "sha512-ZNHysUvZZhmUuMjBvDGtUI8vT3g//4ay5fFOk2sJCsjx4ztippW1Hrhrq59nJ9mV/Q0u4OX80Gyorq8L3rwNLw==", "requires": {} }, "typescript": { diff --git a/interface/package.json b/interface/package.json index ee3976892..075122eca 100644 --- a/interface/package.json +++ b/interface/package.json @@ -10,7 +10,7 @@ "@mui/icons-material": "^5.10.6", "@mui/material": "^5.10.7", "@table-library/react-table-library": "4.0.18", - "@types/lodash": "^4.14.185", + "@types/lodash": "^4.14.186", "@types/node": "^18.7.23", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", @@ -30,7 +30,7 @@ "react-router-dom": "^6.4.1", "react-scripts": "5.0.1", "sockette": "^2.0.6", - "typesafe-i18n": "^5.13.1", + "typesafe-i18n": "^5.14.0", "typescript": "^4.8.4" }, "scripts": { From 4302d314cf0b775b9a1ea73146f6087788782779 Mon Sep 17 00:00:00 2001 From: proddy Date: Fri, 30 Sep 2022 20:47:55 +0200 Subject: [PATCH 10/28] generic test --- src/test/test.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/test.h b/src/test/test.h index 21c2e0918..29c4556a2 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -31,8 +31,8 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "mixer" // #define EMSESP_DEBUG_DEFAULT "web" // #define EMSESP_DEBUG_DEFAULT "mqtt" -// #define EMSESP_DEBUG_DEFAULT "general" -#define EMSESP_DEBUG_DEFAULT "boiler" +#define EMSESP_DEBUG_DEFAULT "general" +// #define EMSESP_DEBUG_DEFAULT "boiler" // #define EMSESP_DEBUG_DEFAULT "mqtt2" // #define EMSESP_DEBUG_DEFAULT "mqtt_nested" // #define EMSESP_DEBUG_DEFAULT "ha" From 90d21445884f1c8c576deb6dcaa70f5a0f898dde Mon Sep 17 00:00:00 2001 From: proddy Date: Fri, 30 Sep 2022 20:48:21 +0200 Subject: [PATCH 11/28] fix for lists that don't have translations, like climate --- src/emsdevice.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index efae2a2c7..b61feedec 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -411,7 +411,13 @@ void EMSdevice::add_device_value(uint8_t tag, bool has_cmd = (f != nullptr); auto short_name = name[0]; - auto fullname = &name[1]; // translations start at index 1 + + const char * const * fullname; + if (Helpers::count_items(name) == 1) { + fullname = &name[0]; // no translations available + } else { + fullname = &name[1]; // translations start at index 1 + } // initialize the device value depending on it's type if (type == DeviceValueType::STRING) { @@ -1401,7 +1407,7 @@ void EMSdevice::mqtt_ha_entity_config_remove() { if (dv.has_state(DeviceValueState::DV_HA_CONFIG_CREATED) && ((dv.has_state(DeviceValueState::DV_API_MQTT_EXCLUDE)) || (!dv.has_state(DeviceValueState::DV_ACTIVE)))) { dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED); - if (strcmp(dv.short_name, FL_(climate)[0])) { + if (dv.short_name == FL_(climate)[0]) { Mqtt::publish_ha_climate_config(dv.tag, false, true); // delete topic (remove = true) } else { Mqtt::publish_ha_sensor_config(dv, "", "", true); // delete topic (remove = true) From 4c70da28e6760e90d436a7e2b913a8eac93fd942 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sat, 1 Oct 2022 16:03:04 +0200 Subject: [PATCH 12/28] better fix for ha climate Optimize flash with ESP32 #646 --- src/emsdevice.cpp | 2 +- src/locale_common.h | 2 +- src/mqtt.cpp | 18 +++++++----------- src/mqtt.h | 5 ++--- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index b61feedec..30699a031 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -390,7 +390,7 @@ void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const ch // type: one of DeviceValueType // options: options for enum, which are translated as a list of lists // options_single: list of names -// numeric_operatpr: to divide or multiply, see DeviceValueNumOps:: +// numeric_operator: to divide or multiply, see DeviceValueNumOps:: // short_name: used in Mqtt as keys // fullname: used in Web and Console unless empty (nullptr) - can be translated // uom: unit of measure from DeviceValueUOM diff --git a/src/locale_common.h b/src/locale_common.h index 35ea7eaca..471fd097e 100644 --- a/src/locale_common.h +++ b/src/locale_common.h @@ -264,7 +264,7 @@ MAKE_PSTR(response, "response") MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww") MAKE_PSTR(tag_device_data_ww_mqtt, "") -MAKE_PSTR_LIST(climate, "HA climate config creation") +MAKE_PSTR_LIST(climate, "HA climate config creation", "") // syslog MAKE_PSTR_LIST(list_syslog_level, "off", "emerg", "alert", "crit", "error", "warn", "notice", "info", "debug", "trace", "all") diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 353cc8cd9..40953a030 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -755,12 +755,8 @@ void Mqtt::publish_retain(const char * topic, const JsonObject & payload, bool r } } -void Mqtt::publish_ha(const char * topic, const JsonObject & payload) { - publish_ha(std::string(topic), payload); -} - // publish empty payload to remove the topic -void Mqtt::publish_ha(const std::string & topic) { +void Mqtt::publish_ha(const char * topic) { if (!enabled()) { return; } @@ -774,7 +770,7 @@ void Mqtt::publish_ha(const std::string & topic) { } // publish a Home Assistant config topic and payload, with retain flag off. -void Mqtt::publish_ha(const std::string & topic, const JsonObject & payload) { +void Mqtt::publish_ha(const char * topic, const JsonObject & payload) { if (!enabled()) { return; } @@ -928,7 +924,7 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model, publish_ha_sensor_config(dv.type, dv.tag, - dv.get_fullname(), + dv.get_fullname().c_str(), dv.fullname[0], dv.device_type, dv.short_name, @@ -950,7 +946,7 @@ void Mqtt::publish_system_ha_sensor_config(uint8_t type, const char * name, cons JsonArray ids = dev_json.createNestedArray("ids"); ids.add("ems-esp"); - publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, std::string(name), name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, nullptr, 0, 0, 0, dev_json); + publish_ha_sensor_config(type, DeviceValueTAG::TAG_HEARTBEAT, name, name, EMSdevice::DeviceType::SYSTEM, entity, uom, false, false, nullptr, 0, 0, 0, dev_json); } // MQTT discovery configs @@ -958,7 +954,7 @@ void Mqtt::publish_system_ha_sensor_config(uint8_t type, const char * name, cons // note: some extra string copying done here, it looks messy but does help with heap fragmentation issues void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice::DeviceValueType uint8_t tag, // EMSdevice::DeviceValueTAG - const std::string & fullname, // fullname, already translated + const char * const fullname, // fullname, already translated const char * const en_name, const uint8_t device_type, // EMSdevice::DeviceType const char * const entity, // same as shortname @@ -971,7 +967,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice const int16_t dv_set_max, const JsonObject & dev_json) { // ignore if name (fullname) is empty - if (fullname.empty() || en_name == nullptr) { + if (fullname == nullptr || en_name == nullptr) { return; } @@ -1106,7 +1102,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice // friendly name = char ha_name[70]; - char * F_name = strdup(fullname.c_str()); + char * F_name = strdup(fullname); F_name[0] = toupper(F_name[0]); // capitalize first letter if (have_tag) { snprintf(ha_name, sizeof(ha_name), "%s %s", EMSdevice::tag_to_string(tag).c_str(), F_name); diff --git a/src/mqtt.h b/src/mqtt.h index 94584369e..1fef21aef 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -86,15 +86,14 @@ class Mqtt { static void publish_retain(const std::string & topic, const JsonObject & payload, bool retain); static void publish_retain(const char * topic, const std::string & payload, bool retain); static void publish_retain(const char * topic, const JsonObject & payload, bool retain); - static void publish_ha(const std::string & topic, const JsonObject & payload); static void publish_ha(const char * topic, const JsonObject & payload); - static void publish_ha(const std::string & topic); + static void publish_ha(const char * topic); static void publish_ha_sensor_config(DeviceValue & dv, const std::string & model, const std::string & brand, const bool remove, const bool create_device_config = false); static void publish_ha_sensor_config(uint8_t type, uint8_t tag, - const std::string & fullname, + const char * const fullname, const char * const en_name, const uint8_t device_type, const char * const entity, From ddacd2d9d7a14aaa359096d20fa646be650cbacb Mon Sep 17 00:00:00 2001 From: Proddy Date: Sat, 1 Oct 2022 16:49:01 +0200 Subject: [PATCH 13/28] min/max example --- mock-api/server.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/mock-api/server.js b/mock-api/server.js index 420bbf4d7..95775c1f1 100644 --- a/mock-api/server.js +++ b/mock-api/server.js @@ -592,20 +592,13 @@ const emsesp_deviceentities_1 = [ m: 0, w: false, }, - // { - // v: 'test data', - // n: 'test', - // id: 'test', - // m: 0, - // w: false, - // }, - // { - // v: 18.2, - // n: 'hc1 selected room temperature', - // id: 'hc1/seltemp', - // m: 0, - // w: true, - // }, + { + v: 18.2, + n: 'hc1 selected room temperature', + id: 'hc1/seltemp', + m: 0, + w: true, + }, { v: 22.6, n: 'hc1 current room temperature', From 9c205a07c53db2a2af123ddfbfc7ec0798d952b5 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:51:43 +0200 Subject: [PATCH 14/28] add test data for min/max --- mock-api/server.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mock-api/server.js b/mock-api/server.js index 95775c1f1..75d799ea0 100644 --- a/mock-api/server.js +++ b/mock-api/server.js @@ -597,6 +597,8 @@ const emsesp_deviceentities_1 = [ n: 'hc1 selected room temperature', id: 'hc1/seltemp', m: 0, + mi: 5, + ma: 52, w: true, }, { From ecc045b2a81b7434316666a509ee992935e25567 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:51:54 +0200 Subject: [PATCH 15/28] add test for min/max --- src/test/test.cpp | 30 ++++++++++++++++++++++++++++++ src/test/test.h | 1 + 2 files changed, 31 insertions(+) diff --git a/src/test/test.cpp b/src/test/test.cpp index 21a41496f..be722d6df 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -601,6 +601,36 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const EMSESP::system_.healthcheck(n); } + if (command == "custom") { + shell.printfln(F("Testing custom entities")); + + Mqtt::ha_enabled(true); + Mqtt::send_response(false); + + run_test("thermostat"); + + // shell.invoke_command("call thermostat seltemp"); + // shell.invoke_command("call system publish"); + + // toggle mode + for (const auto & emsdevice : EMSESP::emsdevices) { + Serial.print("Custom: "); + Serial.print(emsdevice->device_type_name().c_str()); + Serial.print(" uniqueid="); + Serial.println(emsdevice->unique_id()); + + if (emsdevice->unique_id() == 1) { // thermostat + std::string a = "00hc1/seltemp|new name>5<52"; + emsdevice->setCustomEntity(a); + break; + } + } + + shell.invoke_command("call thermostat seltemp"); + shell.invoke_command("call system publish"); + } + + if (command == "masked") { shell.printfln("Testing masked entities"); diff --git a/src/test/test.h b/src/test/test.h index 29c4556a2..af16002f3 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -51,6 +51,7 @@ namespace emsesp { // #define EMSESP_DEBUG_DEFAULT "api_values" // #define EMSESP_DEBUG_DEFAULT "mqtt_post" // #define EMSESP_DEBUG_DEFAULT "api_wwmode" +// #define EMSESP_DEBUG_DEFAULT "custom" class Test { public: From ca95e44a8140a77e6f07dd2f934c5706191083f5 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:52:17 +0200 Subject: [PATCH 16/28] climate doesn't need a translation --- src/locale_common.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/locale_common.h b/src/locale_common.h index 6c3966490..543938b14 100644 --- a/src/locale_common.h +++ b/src/locale_common.h @@ -20,6 +20,8 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-variable" +// clang-format off + /* * THIS FILE CONTAINS STANDARD STRING LITERALS THAT DON'T NEED LANGUAGE TRANSLATIONS */ @@ -273,7 +275,8 @@ MAKE_PSTR(response, "response") MAKE_PSTR(tag_boiler_data_ww_mqtt, "ww") MAKE_PSTR(tag_device_data_ww_mqtt, "") -MAKE_PSTR_LIST(climate, "HA climate config creation", "") +// Home Assistant - this is special and has no translations +MAKE_PSTR_LIST(climate, "HA climate config creation") // syslog MAKE_PSTR_LIST(list_syslog_level, "off", "emerg", "alert", "crit", "error", "warn", "notice", "info", "debug", "trace", "all") @@ -302,16 +305,7 @@ MAKE_PSTR_ENUM(enum_reset, FL_(dash), FL_(maintenance), FL_(error)) MAKE_PSTR_ENUM(enum_maxHeat, FL_(0kW), FL_(2kW), FL_(3kW), FL_(4kW), FL_(6kW), FL_(9kW)) // thermostat lists -MAKE_PSTR_ENUM(enum_ibaMainDisplay, - FL_(internal_temperature), - FL_(internal_setpoint), - FL_(external_temperature), - FL_(burner_temperature), - FL_(ww_temperature), - FL_(functioning_mode), - FL_(time), - FL_(date), - FL_(smoke_temperature)) +MAKE_PSTR_ENUM(enum_ibaMainDisplay, FL_(internal_temperature), FL_(internal_setpoint), FL_(external_temperature), FL_(burner_temperature), FL_(ww_temperature), FL_(functioning_mode), FL_(time), FL_(date), FL_(smoke_temperature)) MAKE_PSTR_ENUM(enum_ibaLanguage, FL_(german), FL_(dutch), FL_(french), FL_(italian)) MAKE_PSTR_ENUM(enum_ibaLanguage_RC30, FL_(german), FL_(dutch)) MAKE_PSTR_ENUM(enum_floordrystatus, FL_(off), FL_(start), FL_(heat), FL_(hold), FL_(cool), FL_(end)) @@ -379,3 +373,5 @@ MAKE_PSTR_ENUM(enum_bufConfig, FL_(monovalent), FL_(bivalent)) MAKE_PSTR_ENUM(enum_blockTerm, FL_(n_o), FL_(n_c)) #pragma GCC diagnostic pop + +// clang-format on From 94f134f3fe341a8a0a53f6fa637d33f2a0a68656 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:52:34 +0200 Subject: [PATCH 17/28] formatting to fit on one line --- src/locale_translations.h | 368 ++++++-------------------------------- 1 file changed, 56 insertions(+), 312 deletions(-) diff --git a/src/locale_translations.h b/src/locale_translations.h index 10d661500..40066f5cb 100644 --- a/src/locale_translations.h +++ b/src/locale_translations.h @@ -17,6 +17,8 @@ */ #pragma once +// clang-format off + // Define languages here // Makes sure they are also added in same order to languages[] in system.cpp #define EMSESP_LOCALE_EN "en" @@ -210,12 +212,7 @@ MAKE_PSTR_LIST(setBurnPow, "setburnpow", "burner set power", "Sollwert Brennerle MAKE_PSTR_LIST(curBurnPow, "curburnpow", "burner current power", "Brennerleistung", "Brandervermogen", "Värmepanna aktuell effekt") MAKE_PSTR_LIST(burnStarts, "burnstarts", "burner starts", "Brenner Starts", "Aantal brander starts", "Värmepanna antal starter") MAKE_PSTR_LIST(burnWorkMin, "burnworkmin", "total burner operating time", "Brenner Laufzeit", "Totale branderlooptijd", "Värmepanna aktiva timmar") -MAKE_PSTR_LIST(burn2WorkMin, - "burn2workmin", - "burner stage 2 operating time", - "Brenner Stufe 2 Laufzeit", - "Totale looptijd brander fase 2", - "Värmepanna steg 2 aktiva timmar") +MAKE_PSTR_LIST(burn2WorkMin, "burn2workmin", "burner stage 2 operating time", "Brenner Stufe 2 Laufzeit", "Totale looptijd brander fase 2", "Värmepanna steg 2 aktiva timmar") MAKE_PSTR_LIST(heatWorkMin, "heatworkmin", "total heat operating time", "Heizung Laufzeit", "Totale looptijd verwarming", "Uppvärmning aktiva timmar") MAKE_PSTR_LIST(UBAuptime, "ubauptime", "total UBA operating time", "Anlagen-Gesamtlaufzeit", "totale looptijd branderautomaat (UBA)", "Total Tid") MAKE_PSTR_LIST(lastCode, "lastcode", "last error code", "Fehlerspeicher", "Laatste foutcode", "Senaste Felkod") @@ -230,99 +227,29 @@ MAKE_PSTR_LIST(emergencyTemp, "emergencytemp", "emergency temperature", "Nottemp // heatpump/compress specific MAKE_PSTR_LIST(upTimeControl, "uptimecontrol", "total operating time heat", "Betriebszeit Heizen gesamt", "Totale bedrijfstijd", "Total tid uppvärmning") -MAKE_PSTR_LIST(upTimeCompHeating, - "uptimecompheating", - "operating time compressor heating", - "Betriebszeit Kompressor heizen", - "Bedrijfstijd compressor verwarmingsbedrijf", - "Total tid kompressor uppvärmning") -MAKE_PSTR_LIST(upTimeCompCooling, - "uptimecompcooling", - "operating time compressor cooling", - "Betriebszeit Kompressor kühlen", - "Bedrijfstijd compressor koelbedrijf", - "Total tid kompressor kyla") -MAKE_PSTR_LIST(upTimeCompWw, - "uptimecompww", - "operating time compressor dhw", - "Betriebszeit Kompressor", - "Bedrijfstijd compressor warmwaterbedrijf", - "Total tid kompressor varmvatten") -MAKE_PSTR_LIST(upTimeCompPool, - "uptimecomppool", - "operating time compressor pool", - "Betriebszeit Kompressor Pool", - "Bedrijfstijd compressor voor zwembadbedrijf", - "Total tid kompressor pool") +MAKE_PSTR_LIST(upTimeCompHeating, "uptimecompheating", "operating time compressor heating", "Betriebszeit Kompressor heizen", "Bedrijfstijd compressor verwarmingsbedrijf", "Total tid kompressor uppvärmning") +MAKE_PSTR_LIST(upTimeCompCooling, "uptimecompcooling", "operating time compressor cooling", "Betriebszeit Kompressor kühlen", "Bedrijfstijd compressor koelbedrijf", "Total tid kompressor kyla") +MAKE_PSTR_LIST(upTimeCompWw, "uptimecompww", "operating time compressor dhw", "Betriebszeit Kompressor", "Bedrijfstijd compressor warmwaterbedrijf", "Total tid kompressor varmvatten") +MAKE_PSTR_LIST(upTimeCompPool, "uptimecomppool", "operating time compressor pool", "Betriebszeit Kompressor Pool", "Bedrijfstijd compressor voor zwembadbedrijf", "Total tid kompressor pool") MAKE_PSTR_LIST(totalCompStarts, "totalcompstarts", "total compressor control starts", "Kompressor Starts gesamt", "Totaal compressorstarts", "Kompressorstarter Totalt") MAKE_PSTR_LIST(heatingStarts, "heatingstarts", "heating control starts", "Heizen Starts", "Starts verwarmingsbedrijf", "Kompressorstarter Uppvärmning") MAKE_PSTR_LIST(coolingStarts, "coolingstarts", "cooling control starts", "Kühlen Starts", "Starts koelbedrijf", "Kompressorstarter Kyla") MAKE_PSTR_LIST(poolStarts, "poolstarts", "pool control starts", "Pool Starts", "Starts zwembadbedrijf", "Kompressorstarter Pool") MAKE_PSTR_LIST(nrgConsTotal, "nrgconstotal", "total energy consumption", "totaler Energieverbrauch", "Energieverbrauch gesamt", "Energieverbruik totaal") -MAKE_PSTR_LIST(nrgConsCompTotal, - "nrgconscomptotal", - "total energy consumption compressor", - "Energieverbrauch Kompressor gesamt", - "Energieverbruik compressor totaal", - "Energiförbrukning kompressor") -MAKE_PSTR_LIST(nrgConsCompHeating, - "nrgconscompheating", - "energy consumption compressor heating", - "Energieverbrauch Kompressor heizen", - "Energieverbruik compressor verwarmingsbedrijf", - "Energiförbrukning uppvärmning") -MAKE_PSTR_LIST(nrgConsCompWw, - "nrgconscompww", - "energy consumption compressor dhw", - "Energieverbrauch Kompressor", - "Energieverbruik compressor warmwaterbedrijf", - "Energiförbrukning varmvatten") -MAKE_PSTR_LIST(nrgConsCompCooling, - "nrgconscompcooling", - "energy consumption compressor cooling", - "Energieverbrauch Kompressor kühlen", - "Energieverbruik compressor koelbedrijf", - "Energiförbrukning kyla") -MAKE_PSTR_LIST(nrgConsCompPool, - "nrgconscomppool", - "energy consumption compressor pool", - "Energieverbrauch Kompressor Pool", - "Energiebedrijf compressor zwembadbedrijf", - "Energiförbrukning pool") +MAKE_PSTR_LIST(nrgConsCompTotal, "nrgconscomptotal", "total energy consumption compressor", "Energieverbrauch Kompressor gesamt", "Energieverbruik compressor totaal", "Energiförbrukning kompressor") +MAKE_PSTR_LIST(nrgConsCompHeating, "nrgconscompheating", "energy consumption compressor heating", "Energieverbrauch Kompressor heizen", "Energieverbruik compressor verwarmingsbedrijf", "Energiförbrukning uppvärmning") +MAKE_PSTR_LIST(nrgConsCompWw, "nrgconscompww", "energy consumption compressor dhw", "Energieverbrauch Kompressor", "Energieverbruik compressor warmwaterbedrijf", "Energiförbrukning varmvatten") +MAKE_PSTR_LIST(nrgConsCompCooling, "nrgconscompcooling", "energy consumption compressor cooling", "Energieverbrauch Kompressor kühlen", "Energieverbruik compressor koelbedrijf", "Energiförbrukning kyla") +MAKE_PSTR_LIST(nrgConsCompPool, "nrgconscomppool", "energy consumption compressor pool", "Energieverbrauch Kompressor Pool", "Energiebedrijf compressor zwembadbedrijf", "Energiförbrukning pool") MAKE_PSTR_LIST(nrgSuppTotal, "nrgsupptotal", "total energy supplied", "gesamte Energieabgabe", "Totaal opgewekte energie", "Tillförd energi") -MAKE_PSTR_LIST(nrgSuppHeating, - "nrgsuppheating", - "total energy supplied heating", - "gesamte Energieabgabe heizen", - "Opgewekte energie verwarmingsbedrijf", - "Tillförd energi Uppvärmning") +MAKE_PSTR_LIST(nrgSuppHeating, "nrgsuppheating", "total energy supplied heating", "gesamte Energieabgabe heizen", "Opgewekte energie verwarmingsbedrijf", "Tillförd energi Uppvärmning") MAKE_PSTR_LIST(nrgSuppWw, "nrgsuppww", "total energy warm supplied dhw", "gesamte Energieabgabe", "Opgewekte energie warmwaterbedrijf", "Tillförd energi Varmvatten") MAKE_PSTR_LIST(nrgSuppCooling, "nrgsuppcooling", "total energy supplied cooling", "gesamte Energieabgabe kühlen", "Opgewekte energie koelbedrijf", "Tillförd energi Kyla") MAKE_PSTR_LIST(nrgSuppPool, "nrgsupppool", "total energy supplied pool", "gesamte Energieabgabe Pool", "Opgewekte energie zwembadbedrijf", "TIllförd energi Pool") -MAKE_PSTR_LIST(auxElecHeatNrgConsTotal, - "auxelecheatnrgconstotal", - "total auxiliary electrical heater energy consumption", - "Energieverbrauch el. Zusatzheizung", - "Totaal energieverbruik electrisch verwarmingselement", - "Energiförbrukning Elpatron") -MAKE_PSTR_LIST(auxElecHeatNrgConsHeating, - "auxelecheatnrgconsheating", - "auxiliary electrical heater energy consumption heating", - "Energieverbrauch el. Zusatzheizung Heizen", - "Energieverbruik electrisch verwarmingselement voor verwarmingsbedrijf", - "Energiförbrukning Elpatron Uppvärmning") -MAKE_PSTR_LIST(auxElecHeatNrgConsWW, - "auxelecheatnrgconsww", - "auxiliary electrical heater energy consumption dhw", - "Energieverbrauch el. Zusatzheizung", - "Energieverbruik electrisch verwarmingselement voor warmwaterbedrijf", - "Energiförbrukning Elpatron Varmvatten") -MAKE_PSTR_LIST(auxElecHeatNrgConsPool, - "auxelecheatnrgconspool", - "auxiliary electrical heater energy consumption pool", - "Energieverbrauch el. Zusatzheizung Pool", - "Energieverbruik electrisch verwarmingselement voor zwembadbedrijf", - "Energiförbrukning Elpatron Pool") +MAKE_PSTR_LIST(auxElecHeatNrgConsTotal, "auxelecheatnrgconstotal", "total auxiliary electrical heater energy consumption", "Energieverbrauch el. Zusatzheizung", "Totaal energieverbruik electrisch verwarmingselement", "Energiförbrukning Elpatron") +MAKE_PSTR_LIST(auxElecHeatNrgConsHeating, "auxelecheatnrgconsheating", "auxiliary electrical heater energy consumption heating", "Energieverbrauch el. Zusatzheizung Heizen", "Energieverbruik electrisch verwarmingselement voor verwarmingsbedrijf", "Energiförbrukning Elpatron Uppvärmning") +MAKE_PSTR_LIST(auxElecHeatNrgConsWW, "auxelecheatnrgconsww", "auxiliary electrical heater energy consumption dhw", "Energieverbrauch el. Zusatzheizung", "Energieverbruik electrisch verwarmingselement voor warmwaterbedrijf", "Energiförbrukning Elpatron Varmvatten") +MAKE_PSTR_LIST(auxElecHeatNrgConsPool, "auxelecheatnrgconspool", "auxiliary electrical heater energy consumption pool", "Energieverbrauch el. Zusatzheizung Pool", "Energieverbruik electrisch verwarmingselement voor zwembadbedrijf", "Energiförbrukning Elpatron Pool") MAKE_PSTR_LIST(hpCompOn, "hpcompon", "hp compressor", "WP Kompressor", "WP compressor", "VP Kompressor") MAKE_PSTR_LIST(hpHeatingOn, "hpheatingon", "hp heating", "WP Heizen", "WP verwarmingsbedrijf", "VP Uppvärmning") @@ -343,21 +270,11 @@ MAKE_PSTR_LIST(hpPower, "hppower", "compressor power output", "Kompressorleistun MAKE_PSTR_LIST(hpTc0, "hptc0", "heat carrier return (TC0)", "Kältemittel Rücklauf (TC0)", "Koudemiddel retour (TC0O", "Värmebärare Retur (TC0)") MAKE_PSTR_LIST(hpTc1, "hptc1", "heat carrier forward (TC1)", "Kältemittel Vorlauf (TC1)", "Koudemiddel aanvoer (TC1)", "Värmebärare Framledning (TC1)") MAKE_PSTR_LIST(hpTc3, "hptc3", "condenser temperature (TC3)", "Verflüssigertemperatur (TC3)", "Condensortemperatuur (TC3)", "Kondensortemperatur (TC3)") -MAKE_PSTR_LIST(hpTr3, - "hptr3", - "refrigerant temperature liquid side (condenser output) (TR3)", - "Kältemittel (flüssig) (TR3)", - "Temperatuur koudemiddel vloeibare zijde (TR3)", - "Köldmedium temperatur (kondensorutlopp) (TR3)") +MAKE_PSTR_LIST(hpTr3, "hptr3", "refrigerant temperature liquid side (condenser output) (TR3)", "Kältemittel (flüssig) (TR3)", "Temperatuur koudemiddel vloeibare zijde (TR3)", "Köldmedium temperatur (kondensorutlopp) (TR3)") MAKE_PSTR_LIST(hpTr4, "hptr4", "evaporator inlet temperature (TR4)", "Verdampfer Eingang (TR4)", "Verdamper ingangstemperatuur (TR4)", "Förångare inloppstemp (TR4)") MAKE_PSTR_LIST(hpTr5, "hptr5", "compressor inlet temperature (TR5)", "Kompessoreingang (TR5)", "Compressor ingangstemperatuur (TR5)", "Kompressor inloppstemp (TR5)") MAKE_PSTR_LIST(hpTr6, "hptr6", "compressor outlet temperature (TR6)", "Kompressorausgang (TR6)", "Compressor uitgangstemperatuur (TR6)", "Kompressor utloppstemp (TR6)") -MAKE_PSTR_LIST(hpTr7, - "hptr7", - "refrigerant temperature gas side (condenser input) (TR7)", - "Kältemittel (gasförmig) (TR7)", - "Temperatuur koudemiddel gasvormig (TR7)", - "Köldmedium temperatur gassida (kondensorinlopp) (TR7)") +MAKE_PSTR_LIST(hpTr7, "hptr7", "refrigerant temperature gas side (condenser input) (TR7)", "Kältemittel (gasförmig) (TR7)", "Temperatuur koudemiddel gasvormig (TR7)", "Köldmedium temperatur gassida (kondensorinlopp) (TR7)") MAKE_PSTR_LIST(hpTl2, "hptl2", "air inlet temperature (TL2)", "Außenluft-Einlasstemperatur (TL2)", "Temperatuur luchtinlaat (TL2)", "Luftintagstemperatur (TL2)") MAKE_PSTR_LIST(hpPl1, "hppl1", "low pressure side temperature (PL1)", "Niederdruckfühler (PL1)", "Temperatuur lage drukzijde (PL1)", "Temperatur Lågtryckssidan (PL1)") MAKE_PSTR_LIST(hpPh1, "hpph1", "high pressure side temperature (PH1)", "Hochdruckfühler (PH1)", "Temperatuur hoge drukzijde (PH1)", "Temperatur Högtryckssidan (PH1)") @@ -376,12 +293,7 @@ MAKE_PSTR_LIST(maxHeatDhw, "maxheatdhw", "heat limit dhw", "Heizgrenze Warmwasse // hybrid heatpump MAKE_PSTR_LIST(hybridStrategy, "hybridstrategy", "hybrid control strategy", "Hybrid Strategie", "Hybride strategie", "Hybrid kontrollstrategi") -MAKE_PSTR_LIST(switchOverTemp, - "switchovertemp", - "outside switchover temperature", - "Außentemperatur für Umschaltung", - "Schakeltemperatuur buitentemperatuur", - "Utomhus Omställningstemperatur") +MAKE_PSTR_LIST(switchOverTemp, "switchovertemp", "outside switchover temperature", "Außentemperatur für Umschaltung", "Schakeltemperatuur buitentemperatuur", "Utomhus Omställningstemperatur") MAKE_PSTR_LIST(energyCostRatio, "energycostratio", "energy cost ratio", "Energie/Kosten-Verhältnis", "Energiekostenratio", "Energi/Kostnads-förhållande") MAKE_PSTR_LIST(fossileFactor, "fossilefactor", "fossile energy factor", "Energiefaktor Fossil", "Energiefactor fossiele brandstof", "Energifaktor fossilenergi") MAKE_PSTR_LIST(electricFactor, "electricfactor", "electric energy factor", "Energiefaktor elektrisch", "Energiefactor electrisch", "Elektrisk energifaktor") @@ -392,38 +304,18 @@ MAKE_PSTR_LIST(tempDiffBoiler, "tempdiffboiler", "temp diff boiler support", "Te MAKE_PSTR_LIST(aCylTopTemp, "cyltoptemp", "cylinder top temperature", "Speichertemperatur Oben", "Buffer temperatuur boven", "Cylindertemperatur Toppen") MAKE_PSTR_LIST(aCylCenterTemp, "cylcentertemp", "cylinder center temperature", "Speichertemperatur Mitte", "Buffer temperatuur midden", "Cylindertemperatur Mitten") MAKE_PSTR_LIST(aCylBottomTemp, "cylbottomtemp", "cylinder bottom temperature", "Speichertemperatur Unten", "Buffer temperatuur onder", "Cylindertemperatur Botten") -MAKE_PSTR_LIST(aFlowTemp, - "altflowtemp", - "alternative hs flow temperature", - "Alternativer WE Vorlauftemperatur", - "Alternatieve warmtebron aanvoertemperatuur", - "Alternativ flödestemp värmekälla") -MAKE_PSTR_LIST(aRetTemp, - "altrettemp", - "alternative hs return temperature", - "Alternativer WE Rücklauftemperatur", - "Alternatieve warmtebron retourtemperatuur", - "Alternativ returtemp värmekälla") +MAKE_PSTR_LIST(aFlowTemp, "altflowtemp", "alternative hs flow temperature", "Alternativer WE Vorlauftemperatur", "Alternatieve warmtebron aanvoertemperatuur", "Alternativ flödestemp värmekälla") +MAKE_PSTR_LIST(aRetTemp, "altrettemp", "alternative hs return temperature", "Alternativer WE Rücklauftemperatur", "Alternatieve warmtebron retourtemperatuur", "Alternativ returtemp värmekälla") MAKE_PSTR_LIST(sysFlowTemp, "sysflowtemp", "system flow temperature", "System Vorlauftemperatur", "Systeem aanvoertemperatuur", "Systemflödestemperatur") MAKE_PSTR_LIST(sysRetTemp, "sysrettemp", "system return temperature", "System Rücklauftemperatur", "Systeem retourtemperatuur", "Systemreturtemperatur") MAKE_PSTR_LIST(valveByPass, "valvebypass", "bypass valve", "Bypass-Ventil", "Bypass klep", "Bypassventil") MAKE_PSTR_LIST(valveBuffer, "valvebuffer", "buffer valve", "Puffer-Ventil", "Bufferklep", "Buffertventil") MAKE_PSTR_LIST(valveReturn, "valvereturn", "return valve", "Rückfluss-Ventil", "Retourklep", "Returventil") -MAKE_PSTR_LIST(aPumpMod, - "altpumpmod", - "alternative hs pump modulation", - "Alternativer WE Pumpenmodulation", - "Alternatieve warmtebron pomp modulatie", - "Alternativ Pumpmodulering Värmekälla") +MAKE_PSTR_LIST(aPumpMod, "altpumpmod", "alternative hs pump modulation", "Alternativer WE Pumpenmodulation", "Alternatieve warmtebron pomp modulatie", "Alternativ Pumpmodulering Värmekälla") MAKE_PSTR_LIST(heatSource, "heatsource", "alternative heating active", "Alternativer Wärmeerzeuger aktiv", "Alternatieve warmtebron aktief", "Alternativ Värmekälla aktiv") MAKE_PSTR_LIST(vr2Config, "vr2config", "vr2 configuration", "VR2 Konfiguration", "VR2 configuratie", "VR2 Konfiguration") -MAKE_PSTR_LIST(ahsActivated, - "ahsactivated", - "alternate heat source activation", - "Alt. Wärmeerzeuger aktiviert", - "Altenatieve warmtebron geactiveerd", - "Alternativ värmekälla aktivering") +MAKE_PSTR_LIST(ahsActivated, "ahsactivated", "alternate heat source activation", "Alt. Wärmeerzeuger aktiviert", "Altenatieve warmtebron geactiveerd", "Alternativ värmekälla aktivering") MAKE_PSTR_LIST(aPumpConfig, "apumpconfig", "primary pump config", "Konfig. Hauptpumpe", "Primaire pomp configuratie", "Konfiguration Primärpump") MAKE_PSTR_LIST(aPumpSignal, "apumpsignal", "output for pr1 pump", "Ausgang Pumpe PR1", "Output voor pomp PR1", "Utgång från pump PR1") MAKE_PSTR_LIST(aPumpMin, "apumpmin", "min output pump pr1", "Minimale Pumpenansteuerung", "Minimale output pomp PR1", "Min Output Pump PR1") @@ -441,18 +333,8 @@ MAKE_PSTR_LIST(releaseWait, "releasewait", "boiler release wait time", "Wartezei // the following are dhw for the boiler and automatically tagged with 'dhw' MAKE_PSTR_LIST(wwSelTempLow, "wwseltemplow", "selected lower temperature", "untere Solltemperatur", "Onderste streeftemperatuur", "Vald lägstatemperatur") MAKE_PSTR_LIST(wwSelTempOff, "wwseltempoff", "selected temperature for off", "Solltemperatur bei AUS", "Streeftemperatuur bij UIT", "Vald tempereatur för AV") -MAKE_PSTR_LIST(wwSelTempSingle, - "wwseltempsingle", - "single charge temperature", - "Solltemperatur Einmalladung", - "Streeftemperatuur enkele lading", - "Temperatur Engångsladdning") -MAKE_PSTR_LIST(wwCylMiddleTemp, - "wwcylmiddletemp", - "cylinder middle temperature (TS3)", - "Speichertemperatur Mitte", - "Buffer temperatuur midden", - "Cylinder Temperatur Mitten (TS3)") +MAKE_PSTR_LIST(wwSelTempSingle, "wwseltempsingle", "single charge temperature", "Solltemperatur Einmalladung", "Streeftemperatuur enkele lading", "Temperatur Engångsladdning") +MAKE_PSTR_LIST(wwCylMiddleTemp, "wwcylmiddletemp", "cylinder middle temperature (TS3)", "Speichertemperatur Mitte", "Buffer temperatuur midden", "Cylinder Temperatur Mitten (TS3)") MAKE_PSTR_LIST(wwSelTemp, "wwseltemp", "selected temperature", "gewählte Temperatur", "Geselecteerd temperatuur", "Vald Temperatur") MAKE_PSTR_LIST(wwSetTemp, "wwsettemp", "set temperature", "Solltemperatur", "Streeftemperatuut", "Börtempertur") @@ -497,12 +379,7 @@ MAKE_PSTR_LIST(switchtime, "switchtime", "program switchtime", "Programm Schaltz MAKE_PSTR_LIST(switchtime1, "switchtime1", "own1 program switchtime", "Programm 1 Schaltzeit", "Schakeltijd programma 1", "Program 1 Bytestid") MAKE_PSTR_LIST(switchtime2, "switchtime2", "own2 program switchtime", "Programm 2 Schaltzeit", "Schakeltijd programma 2", "Program 2 Bytestid") MAKE_PSTR_LIST(wwswitchtime, "wwswitchtime", "program switchtime", "Programm Schaltzeit", "Warm water programma schakeltijd", "Varmvattenprogram Bytestid") -MAKE_PSTR_LIST(wwcircswitchtime, - "wwcircswitchtime", - "circulation program switchtime", - "Zirculationsprogramm Schaltzeit", - "Schakeltijd circulatieprogramma", - "Cirkulationsprogram Bytestid") +MAKE_PSTR_LIST(wwcircswitchtime, "wwcircswitchtime", "circulation program switchtime", "Zirculationsprogramm Schaltzeit", "Schakeltijd circulatieprogramma", "Cirkulationsprogram Bytestid") MAKE_PSTR_LIST(dateTime, "datetime", "date/time", "Datum/Zeit", "Datum/Tijd", "Datum/Tid") MAKE_PSTR_LIST(errorCode, "errorcode", "error code", "Fehlermeldung", "Foutmeldingscode", "Felkod") MAKE_PSTR_LIST(ibaMainDisplay, "display", "display", "Anzeige", "Display", "Display") @@ -520,18 +397,8 @@ MAKE_PSTR_LIST(dampedoutdoortemp, "dampedoutdoortemp", "damped outdoor temperatu MAKE_PSTR_LIST(floordrystatus, "floordry", "floor drying", "Estrichtrocknung", "Vloerdroogprogramma", "Golvtorkning") MAKE_PSTR_LIST(floordrytemp, "floordrytemp", "floor drying temperature", "Estrichtrocknungs Temperatur", "Temperatuur vloerdroogprogramma", "Golvtorkning Temperatur") MAKE_PSTR_LIST(brightness, "brightness", "screen brightness", "Bildschirmhelligkeit", "Schermhelderheid", "Ljusstyrka") -MAKE_PSTR_LIST(autodst, - "autodst", - "automatic change daylight saving time", - "automatische Sommerzeit Umstellung", - "Automatische omschakeling zomer-wintertijd", - "Automatisk växling sommar/vinter-tid") -MAKE_PSTR_LIST(preheating, - "preheating", - "preheating in the clock program", - "Vorheizen im Zeitprogramm", - "Voorverwarming in het klokprogramma", - "Förvärmning i tidsprogram") +MAKE_PSTR_LIST(autodst, "autodst", "automatic change daylight saving time", "automatische Sommerzeit Umstellung", "Automatische omschakeling zomer-wintertijd", "Automatisk växling sommar/vinter-tid") +MAKE_PSTR_LIST(preheating, "preheating", "preheating in the clock program", "Vorheizen im Zeitprogramm", "Voorverwarming in het klokprogramma", "Förvärmning i tidsprogram") MAKE_PSTR_LIST(offtemp, "offtemp", "temperature when mode is off", "Temperatur bei AUS", "Temperatuur bij UIT", "Temperatur Avslagen") MAKE_PSTR_LIST(mixingvalves, "mixingvalves", "mixing valves", "Mischventile", "Mengkleppen", "Blandningsventiler") @@ -566,18 +433,8 @@ MAKE_PSTR_LIST(nighttemp, "nighttemp", "night temperature", "Nachttemperatur", " MAKE_PSTR_LIST(nighttemp2, "nighttemp", "night temperature T1", "Nachttemperatur T1", "Nachttemperatuur T1", "Nattemperatur T1") MAKE_PSTR_LIST(ecotemp, "ecotemp", "eco temperature", "eco Temperatur", "Temperatuur eco", "Eko-temperatur") MAKE_PSTR_LIST(manualtemp, "manualtemp", "manual temperature", "manuelle Temperatur", "temperatuur handmatig", "Temperatur Manuell") -MAKE_PSTR_LIST(tempautotemp, - "tempautotemp", - "temporary set temperature automode", - "temporäre Solltemperatur", - "Streeftemperatuur automodus tijdelijk", - "Temporär Aktivering av Auto-läge") -MAKE_PSTR_LIST(remoteseltemp, - "remoteseltemp", - "temporary set temperature from remote", - "temporäre Solltemperatur Remote", - "Temperatuur van afstandsbedieding", - "Temperatur från fjärruppkoppling") +MAKE_PSTR_LIST(tempautotemp, "tempautotemp", "temporary set temperature automode", "temporäre Solltemperatur", "Streeftemperatuur automodus tijdelijk", "Temporär Aktivering av Auto-läge") +MAKE_PSTR_LIST(remoteseltemp, "remoteseltemp", "temporary set temperature from remote", "temporäre Solltemperatur Remote", "Temperatuur van afstandsbedieding", "Temperatur från fjärruppkoppling") MAKE_PSTR_LIST(comforttemp, "comforttemp", "comfort temperature", "Komforttemperatur", "Comforttemperatuur", "Komforttemperatur") MAKE_PSTR_LIST(summertemp, "summertemp", "summer temperature", "Sommertemperatur", "Zomertemperatuur", "Sommartemperatur") MAKE_PSTR_LIST(designtemp, "designtemp", "design temperature", "Auslegungstemperatur", "Ontwerptemperatuur", "Design-temperatur") @@ -602,21 +459,11 @@ MAKE_PSTR_LIST(party, "party", "party time", "Partyzeit", "Partytijd", "Partytid MAKE_PSTR_LIST(holidaytemp, "holidaytemp", "holiday temperature", "Urlaubstemperatur", "Vakantietemperatuur", "Helgtemperatur") MAKE_PSTR_LIST(summermode, "summermode", "summer mode", "Sommerbetrieb", "Zomerbedrijf", "Sommarläge") MAKE_PSTR_LIST(holidaymode, "holidaymode", "holiday mode", "Urlaubsbetrieb", "Vakantiebedrijf", "Helgläge") -MAKE_PSTR_LIST(flowtempoffset, - "flowtempoffset", - "flow temperature offset for mixer", - "Vorlauftemperaturanhebung", - "Mixer aanvoertemperatuur offset", - "Temperaturkorrigering Flödestemp. Blandningsventil") +MAKE_PSTR_LIST(flowtempoffset, "flowtempoffset", "flow temperature offset for mixer", "Vorlauftemperaturanhebung", "Mixer aanvoertemperatuur offset", "Temperaturkorrigering Flödestemp. Blandningsventil") MAKE_PSTR_LIST(reducemode, "reducemode", "reduce mode", "Absenkmodus", "Gereduceerde modus", "Reducerat Läge") MAKE_PSTR_LIST(noreducetemp, "noreducetemp", "no reduce below temperature", "Durchheizen unter", "Reduceermodus onderbreken onder", "Inaktivera reducering under") MAKE_PSTR_LIST(reducetemp, "reducetemp", "off/reduce switch temperature", "Absenkmodus unter", "Onderste afschakeltemperatuur", "Avslag/Reducera under") -MAKE_PSTR_LIST(vacreducetemp, - "vacreducetemp", - "vacations off/reduce switch temperature", - "Urlaub Absenkmodus unter", - "Vakantiemodus onderste afschakeltemperatuur", - "Helg Avslag/Reducering under") +MAKE_PSTR_LIST(vacreducetemp, "vacreducetemp", "vacations off/reduce switch temperature", "Urlaub Absenkmodus unter", "Vakantiemodus onderste afschakeltemperatuur", "Helg Avslag/Reducering under") MAKE_PSTR_LIST(vacreducemode, "vacreducemode", "vacations reduce mode", "Urlaub Absenkmodus", "Vakantie afschakelmodus", "Helg reduceringsläge") MAKE_PSTR_LIST(nofrostmode, "nofrostmode", "nofrost mode", "Frostschutz Modus", "Vorstbeveiligingsmodus", "Frostskyddsläge") MAKE_PSTR_LIST(remotetemp, "remotetemp", "room temperature from remote", "Raumtemperatur Remote", "Ruimtetemperatuur van afstandsbediening", "Rumstemperatur från fjärr") @@ -640,64 +487,24 @@ MAKE_PSTR_LIST(flowSetTemp, "flowsettemp", "setpoint flow temperature", "Sollwer MAKE_PSTR_LIST(flowTempHc, "flowtemphc", "flow temperature (TC1)", "Vorlauftemperatur HK (TC1)", "Aanvoertemperatuut circuit (TC1)", "Flödestemperatur (TC1)") MAKE_PSTR_LIST(pumpStatus, "pumpstatus", "pump status (PC1)", "Pumpenstatus HK (PC1)", "pompstatus circuit (PC1)", "Pumpstatus (PC1)") MAKE_PSTR_LIST(mixerStatus, "valvestatus", "mixing valve actuator (VC1)", "Mischerventil Position (VC1)", "positie mixerklep (VC1)", "Shuntventil Status (VC1)") -MAKE_PSTR_LIST(flowTempVf, - "flowtempvf", - "flow temperature in header (T0/Vf)", - "Vorlauftemperatur am Verteiler (T0/Vf)", - "aanvoertemperatuur verdeler (T0/Vf)", - "Flödestemperatur Fördelare (T0/Vf)") +MAKE_PSTR_LIST(flowTempVf, "flowtempvf", "flow temperature in header (T0/Vf)", "Vorlauftemperatur am Verteiler (T0/Vf)", "aanvoertemperatuur verdeler (T0/Vf)", "Flödestemperatur Fördelare (T0/Vf)") MAKE_PSTR_LIST(mixerSetTime, "valvesettime", "time to set valve", "Zeit zum Einstellen des Ventils", "Inschakeltijd mengklep", "Inställningstid Ventil") // mixer prefixed with wwc -MAKE_PSTR_LIST(wwPumpStatus, - "pumpstatus", - "pump status in assigned wwc (PC1)", - "Pumpenstatus des wwk (PC1)", - "Pompstatus in WW circuit (PC1)", - "Pumpstatus i VV-krets (PC1)") -MAKE_PSTR_LIST(wwTempStatus, - "wwtempstatus", - "temperature switch in assigned wwc (MC1)", - "Temperaturschalter des wwk (MC1)", - "Temperatuurschakeling in WW circuit (MC1)", - "Temperaturventil i VV-krets (MC1)") +MAKE_PSTR_LIST(wwPumpStatus, "pumpstatus", "pump status in assigned wwc (PC1)", "Pumpenstatus des wwk (PC1)", "Pompstatus in WW circuit (PC1)", "Pumpstatus i VV-krets (PC1)") +MAKE_PSTR_LIST(wwTempStatus, "wwtempstatus", "temperature switch in assigned wwc (MC1)", "Temperaturschalter des wwk (MC1)", "Temperatuurschakeling in WW circuit (MC1)", "Temperaturventil i VV-krets (MC1)") MAKE_PSTR_LIST(wwTemp, "wwtemp", "current temperature", "aktuelle Temperatur", "huidige temperatuur", "Aktuell Temperatur") // mixer pool MAKE_PSTR_LIST(poolSetTemp, "poolsettemp", "pool set temperature", "Pool Solltemperatur", "Streeftemperatuur zwembad", "Pool Temperatur Börvärde") MAKE_PSTR_LIST(poolTemp, "pooltemp", "pool temperature", "Pool Temperatur", "Zwembadtemperatuur", "Pooltemperatur") -MAKE_PSTR_LIST(poolShuntStatus, - "poolshuntstatus", - "pool shunt status opening/closing", - "Pool Ventil öffnen/schließen", - "Zwembadklep status openen/sluiten", - "Pool Shunt-status öppnen/stängd") +MAKE_PSTR_LIST(poolShuntStatus, "poolshuntstatus", "pool shunt status opening/closing", "Pool Ventil öffnen/schließen", "Zwembadklep status openen/sluiten", "Pool Shunt-status öppnen/stängd") MAKE_PSTR_LIST(poolShunt, "poolshunt", "pool shunt open/close (0% = pool / 100% = heat)", "Pool Ventil Öffnung", "Mengklep zwembad stand", "Pool Shunt Öppen/Stängd") MAKE_PSTR_LIST(hydrTemp, "hydrTemp", "hydraulic header temperature", "Verteilertemperatur", "Temperatuur open verdeler", "Fördelartemperatur") // solar -MAKE_PSTR_LIST(cylMiddleTemp, - "cylmiddletemp", - "cylinder middle temperature (TS3)", - "Speichertemperatur Mitte (TS3)", - "Zonneboilertemperatuur midden (TS3)", - "Cylindertemperatur Mitten (TS3)") -MAKE_PSTR_LIST(retHeatAssist, - "retheatassist", - "return temperature heat assistance (TS4)", - "Rücklaufanhebungs-Temp. (TS4)", - "Retourtemperatuur verwarmingsassistentie (TS4)", - "Returtemperatur värmestöd (TS4)") -MAKE_PSTR_LIST(m1Valve, - "heatassistvalve", - "heat assistance valve (M1)", - "Ventil Heizungsunterstützung (M1)", - "Klep verwarmingsassistentie (M1)", - "Uppvärmningsstöd Ventil (M1)") -MAKE_PSTR_LIST(m1Power, - "heatassistpower", - "heat assistance valve power (M1)", - "Ventilleistung Heizungsunterstützung (M1)", - "Vermogen klep verwarmingsassistentie (M1)", - "Uppvärmningsstöd Ventil Effekt (M1)") +MAKE_PSTR_LIST(cylMiddleTemp, "cylmiddletemp", "cylinder middle temperature (TS3)", "Speichertemperatur Mitte (TS3)", "Zonneboilertemperatuur midden (TS3)", "Cylindertemperatur Mitten (TS3)") +MAKE_PSTR_LIST(retHeatAssist, "retheatassist", "return temperature heat assistance (TS4)", "Rücklaufanhebungs-Temp. (TS4)", "Retourtemperatuur verwarmingsassistentie (TS4)", "Returtemperatur värmestöd (TS4)") +MAKE_PSTR_LIST(m1Valve, "heatassistvalve", "heat assistance valve (M1)", "Ventil Heizungsunterstützung (M1)", "Klep verwarmingsassistentie (M1)", "Uppvärmningsstöd Ventil (M1)") +MAKE_PSTR_LIST(m1Power, "heatassistpower", "heat assistance valve power (M1)", "Ventilleistung Heizungsunterstützung (M1)", "Vermogen klep verwarmingsassistentie (M1)", "Uppvärmningsstöd Ventil Effekt (M1)") MAKE_PSTR_LIST(pumpMinMod, "pumpminmod", "minimum pump modulation", "minimale Pumpenmodulation", "Minimale pompmodulatie", "Min Pumpmodulering") MAKE_PSTR_LIST(maxFlow, "maxflow", "maximum solar flow", "maximaler Durchfluss", "Maximale doorstroom solar", "Max Flöde Solpanel") MAKE_PSTR_LIST(solarPower, "solarpower", "actual solar power", "aktuelle Solarleistung", "Huidig solar vermogen", "Aktuellt Sol-effekt") @@ -708,50 +515,15 @@ MAKE_PSTR_LIST(solarPump2TurnonDiff, "turnondiff2", "pump 2 turn on difference", MAKE_PSTR_LIST(solarPump2TurnoffDiff, "turnoffdiff2", "pump 2 turn off difference", "Ausschalthysterese Pumpe 2", "Uitschakelhysterese pomp 2", "Avslagshysteres Pump 2") MAKE_PSTR_LIST(collectorTemp, "collectortemp", "collector temperature (TS1)", "Kollektortemperatur (TS1)", "Collectortemperatuur (TS1)", "Kollektor Temperatur (TS1)") -MAKE_PSTR_LIST(collector2Temp, - "collector2temp", - "collector 2 temperature (TS7)", - "Kollector 2 Temperatur (TS7)", - "Collector 2 temperatuur (TS7)", - "Kollektor 2 Temperatur (TS7)") -MAKE_PSTR_LIST(cylBottomTemp, - "cylbottomtemp", - "cylinder bottom temperature (TS2)", - "Speicher Bodentemperatur (TS2)", - "Bodemtemperatuur zonneboiler (TS2)", - "Cylindertemperatur Botten (TS2)") -MAKE_PSTR_LIST(cyl2BottomTemp, - "cyl2bottomtemp", - "second cylinder bottom temperature (TS5)", - "2. Speicher Bodentemperatur (TS5)", - "Bodemtemperatuur 2e boiler", - "Sekundär Cylindertemperatur Botten (TS5)") -MAKE_PSTR_LIST(heatExchangerTemp, - "heatexchangertemp", - "heat exchanger temperature (TS6)", - "wärmetauscher Temperatur (TS6)", - "Temperatuur warmtewisselaar (TS6)", - "Värmeväxlare Temperatur (TS6)") -MAKE_PSTR_LIST(collectorMaxTemp, - "collectormaxtemp", - "maximum collector temperature", - "maximale Kollektortemperatur", - "Maximale collectortemperatuur", - "Max Kollektortemperatur") -MAKE_PSTR_LIST(collectorMinTemp, - "collectormintemp", - "minimum collector temperature", - "minimale Kollektortemperatur", - "Minimale collectortemperatuur", - "Min Kollektortemperatur") +MAKE_PSTR_LIST(collector2Temp, "collector2temp", "collector 2 temperature (TS7)", "Kollector 2 Temperatur (TS7)", "Collector 2 temperatuur (TS7)", "Kollektor 2 Temperatur (TS7)") +MAKE_PSTR_LIST(cylBottomTemp, "cylbottomtemp", "cylinder bottom temperature (TS2)", "Speicher Bodentemperatur (TS2)", "Bodemtemperatuur zonneboiler (TS2)", "Cylindertemperatur Botten (TS2)") +MAKE_PSTR_LIST(cyl2BottomTemp, "cyl2bottomtemp", "second cylinder bottom temperature (TS5)", "2. Speicher Bodentemperatur (TS5)", "Bodemtemperatuur 2e boiler", "Sekundär Cylindertemperatur Botten (TS5)") +MAKE_PSTR_LIST(heatExchangerTemp, "heatexchangertemp", "heat exchanger temperature (TS6)", "wärmetauscher Temperatur (TS6)", "Temperatuur warmtewisselaar (TS6)", "Värmeväxlare Temperatur (TS6)") +MAKE_PSTR_LIST(collectorMaxTemp, "collectormaxtemp", "maximum collector temperature", "maximale Kollektortemperatur", "Maximale collectortemperatuur", "Max Kollektortemperatur") +MAKE_PSTR_LIST(collectorMinTemp, "collectormintemp", "minimum collector temperature", "minimale Kollektortemperatur", "Minimale collectortemperatuur", "Min Kollektortemperatur") MAKE_PSTR_LIST(cylMaxTemp, "cylmaxtemp", "maximum cylinder temperature", "maximale Speichertemperatur", "maximale temperatuur zonneboiler", "Max Cylindertemperatur") MAKE_PSTR_LIST(solarPumpMod, "solarpumpmod", "pump modulation (PS1)", "Pumpenmodulation (PS1)", "Pompmodulatie (PS1)", "Pumpmodulering (PS1)") -MAKE_PSTR_LIST(cylPumpMod, - "cylpumpmod", - "cylinder pump modulation (PS5)", - "Speicherpumpenmodulation (PS5)", - "Modulatie zonneboilerpomp (PS5)", - "Cylinderpumpmodulering (PS5)") +MAKE_PSTR_LIST(cylPumpMod, "cylpumpmod", "cylinder pump modulation (PS5)", "Speicherpumpenmodulation (PS5)", "Modulatie zonneboilerpomp (PS5)", "Cylinderpumpmodulering (PS5)") MAKE_PSTR_LIST(solarPump, "solarpump", "pump (PS1)", "Pumpe (PS1)", "Pomp (PS1)", "Pump (PS1)") MAKE_PSTR_LIST(solarPump2, "solarpump2", "pump 2 (PS4)", "Pumpe 2 (PS4)", "Pomp 2 (PS4)", "Pump 2 (PS4)") MAKE_PSTR_LIST(solarPump2Mod, "solarpump2mod", "pump 2 modulation (PS4)", "Pumpe 2 Modulation (PS4)", "Modulatie pomp 2 (PS4)", "Pump 2 Modulering (PS4)") @@ -760,12 +532,7 @@ MAKE_PSTR_LIST(cylHeated, "cylheated", "cyl heated", "Speichertemperatur erreich MAKE_PSTR_LIST(collectorShutdown, "collectorshutdown", "collector shutdown", "Kollektorabschaltung", "Collector afschakeling", "Kollektor Avstängning") MAKE_PSTR_LIST(pumpWorkTime, "pumpworktime", "pump working time", "Pumpenlaufzeit", "Pomplooptijd", "Pump Drifttid") MAKE_PSTR_LIST(pump2WorkTime, "pump2worktime", "pump 2 working time", "Pumpe 2 Laufzeit", "Looptijd pomp 2", "Pump 2 Drifttid") -MAKE_PSTR_LIST(m1WorkTime, - "m1worktime", - "differential control working time", - "Differenzregelung Arbeitszeit", - "Verschilregeling arbeidstijd", - "Differentialreglering Drifttid") +MAKE_PSTR_LIST(m1WorkTime, "m1worktime", "differential control working time", "Differenzregelung Arbeitszeit", "Verschilregeling arbeidstijd", "Differentialreglering Drifttid") MAKE_PSTR_LIST(energyLastHour, "energylasthour", "energy last hour", "Energie letzte Std", "Energie laatste uur", "Energi Senaste Timmen") MAKE_PSTR_LIST(energyTotal, "energytotal", "total energy", "Gesamtenergie", "Totale energie", "Total Energi") MAKE_PSTR_LIST(energyToday, "energytoday", "total energy today", "Energie heute", "Energie vandaag", "Total Energi Idag") @@ -787,12 +554,7 @@ MAKE_PSTR_LIST(wwPumpMod, "wwpumpmod", "pump modulation", "Pumpen Modulation", " MAKE_PSTR_LIST(wwFlow, "wwflow", "flow rate", "Volumenstrom", "Doorstroomsnelheid", "Flöde") // extra mixer ww MAKE_PSTR_LIST(wwRequiredTemp, "wwrequiredtemp", "required temperature", "benötigte Temperatur", "Benodigde temperatuur", "Nödvändig Temperatur") -MAKE_PSTR_LIST(wwDiffTemp, - "wwdifftemp", - "start differential temperature", - "Start Differential Temperatur", - "Start differentiele temperatuur", - "Start Differentialtemperatur") +MAKE_PSTR_LIST(wwDiffTemp, "wwdifftemp", "start differential temperature", "Start Differential Temperatur", "Start differentiele temperatuur", "Start Differentialtemperatur") // SM100 MAKE_PSTR_LIST(heatTransferSystem, "heattransfersystem", "heattransfer system", "Wärmeübertragungs-System", "Warmteoverdrachtssysteem", "Värmeöverföringssystem") @@ -820,31 +582,11 @@ MAKE_PSTR_LIST(collector2Area, "collector2area", "collector 2 area", "Kollektor MAKE_PSTR_LIST(collector2Type, "collector2type", "collector 2 type", "Kollektor 2 Typ", "Type collector 2", "Kollektor 2 Typ") // telegram 0x0363 heatCounter -MAKE_PSTR_LIST(heatCntFlowTemp, - "heatcntflowtemp", - "heat counter flow temperature", - "Wärmezähler Vorlauf-Temperatur", - "Aanvoertemperatuur warmteenergiemeter", - "Värmeräknare Flödestemperatur") -MAKE_PSTR_LIST(heatCntRetTemp, - "heatcntrettemp", - "heat counter return temperature", - "Wärmezähler Rücklauf-Temperatur", - "Retourtemperatuur warmteenergiemeter", - "Värmeräknare Returtemperatur") +MAKE_PSTR_LIST(heatCntFlowTemp, "heatcntflowtemp", "heat counter flow temperature", "Wärmezähler Vorlauf-Temperatur", "Aanvoertemperatuur warmteenergiemeter", "Värmeräknare Flödestemperatur") +MAKE_PSTR_LIST(heatCntRetTemp, "heatcntrettemp", "heat counter return temperature", "Wärmezähler Rücklauf-Temperatur", "Retourtemperatuur warmteenergiemeter", "Värmeräknare Returtemperatur") MAKE_PSTR_LIST(heatCnt, "heatcnt", "heat counter impulses", "Wärmezähler Impulse", "Warmteenergiemeter pulsen", "Värmeräknare Impuls") -MAKE_PSTR_LIST(swapFlowTemp, - "swapflowtemp", - "swap flow temperature (TS14)", - "Austausch Vorlauf-Temperatur (TS14)", - "Aanvoertemperatuur verwisselaar (TS14)", - "Växlingstemperatur Flöde (TS14)") -MAKE_PSTR_LIST(swapRetTemp, - "swaprettemp", - "swap return temperature (TS15)", - "Austausch Rücklauf-Temperatur (TS15)", - "Retourtemperatuur verwisselaar (TS15)", - "Växlingstemperatur Returflöde (TS15)") +MAKE_PSTR_LIST(swapFlowTemp, "swapflowtemp", "swap flow temperature (TS14)", "Austausch Vorlauf-Temperatur (TS14)", "Aanvoertemperatuur verwisselaar (TS14)", "Växlingstemperatur Flöde (TS14)") +MAKE_PSTR_LIST(swapRetTemp, "swaprettemp", "swap return temperature (TS15)", "Austausch Rücklauf-Temperatur (TS15)", "Retourtemperatuur verwisselaar (TS15)", "Växlingstemperatur Returflöde (TS15)") // switch MAKE_PSTR_LIST(activated, "activated", "activated", "Aktiviert", "Geactiveerd", "Aktiverad") @@ -864,3 +606,5 @@ MAKE_PSTR_LIST(data1, "data1", "unknown datafield 1") MAKE_PSTR_LIST(setting3, "setting3", "unknown setting 3") MAKE_PSTR_LIST(setting4, "setting4", "unknown setting 4") */ + +// clang-format on From cd67ab03ffc11fbb911f79ad71d5b9f91a11b7a9 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:52:54 +0200 Subject: [PATCH 18/28] fullname array is allowed to be null --- src/mqtt.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 40953a030..885961db8 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -925,7 +925,7 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model, publish_ha_sensor_config(dv.type, dv.tag, dv.get_fullname().c_str(), - dv.fullname[0], + (dv.fullname ? dv.fullname[0] : nullptr), // EN name dv.device_type, dv.short_name, dv.uom, @@ -1115,12 +1115,12 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice // entity id is generated from the name, see https://www.home-assistant.io/docs/mqtt/discovery/#use-object_id-to-influence-the-entity-id // so we override it to make it unique using entity_id // See https://github.com/emsesp/EMS-ESP32/issues/596 - // keep it compatible to v3.4, use english fullname, no prefix (basename prefix commmented out) + // keep it compatible to v3.4, use english fullname, no prefix (basename prefix commented out) char object_id[130]; if (have_tag) { - snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), (en_name)); + snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag).c_str(), en_name); } else { - snprintf(object_id, sizeof(object_id), "%s_%s", device_name, (en_name)); + snprintf(object_id, sizeof(object_id), "%s_%s", device_name, en_name); } doc["object_id"] = object_id; @@ -1130,7 +1130,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice if (is_nested()) { snprintf(val_tpl, sizeof(val_tpl), "{{value_json.%s}}", new_entity); } else { - snprintf(val_tpl, sizeof(val_tpl), "{{value_json.%s}}", (entity)); + snprintf(val_tpl, sizeof(val_tpl), "{{value_json.%s}}", entity); } doc["val_tpl"] = val_tpl; @@ -1162,11 +1162,11 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice case DeviceValueUOM::DEGREES: case DeviceValueUOM::DEGREES_R: doc[sc_ha] = F_(measurement); - doc[dc_ha] = ("temperature"); // no icon needed + doc[dc_ha] = "temperature"; // no icon needed break; case DeviceValueUOM::PERCENT: doc[sc_ha] = F_(measurement); - doc[dc_ha] = ("power_factor"); // no icon needed + doc[dc_ha] = "power_factor"; // no icon needed break; case DeviceValueUOM::SECONDS: case DeviceValueUOM::MINUTES: @@ -1191,11 +1191,11 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice } else { doc[sc_ha] = F_(measurement); } - doc[dc_ha] = ("energy"); // no icon needed + doc[dc_ha] = "energy"; // no icon needed break; case DeviceValueUOM::KWH: doc[sc_ha] = F_(total_increasing); - doc[dc_ha] = ("energy"); // no icon needed + doc[dc_ha] = "energy"; // no icon needed break; case DeviceValueUOM::UA: doc[ic_ha] = F_(iconua); @@ -1203,16 +1203,16 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice break; case DeviceValueUOM::BAR: doc[sc_ha] = F_(measurement); - doc[dc_ha] = ("pressure"); + doc[dc_ha] = "pressure"; break; case DeviceValueUOM::W: case DeviceValueUOM::KW: doc[sc_ha] = F_(measurement); - doc[dc_ha] = ("power"); + doc[dc_ha] = "power"; break; case DeviceValueUOM::DBM: doc[sc_ha] = F_(measurement); - doc[dc_ha] = ("signal_strength"); + doc[dc_ha] = "signal_strength"; break; case DeviceValueUOM::NONE: // for device entities which have numerical values, with no UOM From ae5fb26387aa4fc2efb2fd333ba6b8a9deccbe59 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:53:26 +0200 Subject: [PATCH 19/28] add check fto translated_word for empty arrays, to be crash safe --- src/helpers.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/helpers.cpp b/src/helpers.cpp index a52b5fbfb..7e0ab3843 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -707,6 +707,11 @@ std::string Helpers::translated_word(const char * const * strings, bool to_lower uint8_t language_index = EMSESP::system_.language_index(); uint8_t index = 0; + // check for empty + if (!strings) { + return ""; // it's a nullptr with no translations, return empty to prevent unwanted crash + } + // see how many translations we have for this entity. if there is no translation for this, revert to EN if (Helpers::count_items(strings) >= language_index + 1 && strlen(strings[language_index])) { index = language_index; From fe385de34240e20f4d13a24b47307ac7b9f15a34 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:53:50 +0200 Subject: [PATCH 20/28] no fullname translation is allowed --- src/emsdevice.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index f6845b22a..ce475d3e2 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -391,7 +391,7 @@ void EMSdevice::register_telegram_type(const uint16_t telegram_type_id, const ch // options: options for enum, which are translated as a list of lists // options_single: list of names // numeric_operator: to divide or multiply, see DeviceValueNumOps:: -// short_name: used in Mqtt as keys +// short_name: used in MQTT as keys // fullname: used in Web and Console unless empty (nullptr) - can be translated // uom: unit of measure from DeviceValueUOM // has_cmd: true if this is an associated command @@ -414,7 +414,7 @@ void EMSdevice::add_device_value(uint8_t tag, const char * const * fullname; if (Helpers::count_items(name) == 1) { - fullname = &name[0]; // no translations available + fullname = nullptr; // no translations available, use empty to prevent crash } else { fullname = &name[1]; // translations start at index 1 } @@ -478,7 +478,6 @@ void EMSdevice::add_device_value(uint8_t tag, // add the device entity devicevalues_.emplace_back( device_type_, tag, value_p, type, options, options_single, numeric_operator, short_name, fullname, custom_fullname, uom, has_cmd, min, max, state); - devicevalues_.back().set_custom_minmax(); // add a new command if it has a function attached if (!has_cmd) { @@ -1018,7 +1017,10 @@ void EMSdevice::setCustomEntity(const std::string & entity_id) { } else { dv.custom_fullname = ""; } + + // set the min / max dv.set_custom_minmax(); + return; } } From 58a0ec9ccaefe5373044220507ce093096cde71b Mon Sep 17 00:00:00 2001 From: Proddy Date: Sun, 2 Oct 2022 15:54:12 +0200 Subject: [PATCH 21/28] move the set_custom_minmax into the class initiator --- src/emsdevicevalue.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emsdevicevalue.cpp b/src/emsdevicevalue.cpp index 95e72c99f..97b7f6b7a 100644 --- a/src/emsdevicevalue.cpp +++ b/src/emsdevicevalue.cpp @@ -60,9 +60,13 @@ DeviceValue::DeviceValue(uint8_t device_type, options_size = Helpers::count_items(options); } + // set the min/max + set_custom_minmax(); + #ifdef EMSESP_STANDALONE // only added for debugging - Serial.print("registering entity: "); + Serial.print(COLOR_BRIGHT_RED_BACKGROUND); + Serial.print(" registering entity: "); Serial.print((short_name)); Serial.print("/"); if (!custom_fullname.empty()) { @@ -92,7 +96,7 @@ DeviceValue::DeviceValue(uint8_t device_type, Serial.print((options_single[0])); Serial.print("!"); } - Serial.println(""); + Serial.println(COLOR_RESET); #endif } From e37bbe420ca7993add5c1b0a3a7bc47f35e01a76 Mon Sep 17 00:00:00 2001 From: Proddy Date: Tue, 4 Oct 2022 21:01:23 +0200 Subject: [PATCH 22/28] manual merge of PR 660 - https://github.com/emsesp/EMS-ESP32/pull/660/ --- interface/.typesafe-i18n.json | 8 +- interface/package-lock.json | 92 +++++++++---------- interface/package.json | 4 +- .../src/framework/mqtt/MqttStatusForm.tsx | 69 ++++++++------ interface/src/project/DashboardData.tsx | 2 +- .../src/project/SettingsCustomization.tsx | 20 ++-- interface/src/types/mqtt.ts | 2 + lib/framework/MqttStatus.cpp | 4 +- mock-api/server.js | 2 + scripts/rename_fw.py | 12 +-- src/devices/thermostat.cpp | 53 +++++++---- src/emsdevice.cpp | 43 +++++++-- src/emsdevice.h | 1 + src/emsdevicevalue.cpp | 2 +- src/emsdevicevalue.h | 2 +- src/emsesp.cpp | 1 + src/mqtt.cpp | 10 +- src/mqtt.h | 14 ++- src/telegram.cpp | 14 ++- 19 files changed, 221 insertions(+), 134 deletions(-) diff --git a/interface/.typesafe-i18n.json b/interface/.typesafe-i18n.json index d3f04322e..50a90e48b 100644 --- a/interface/.typesafe-i18n.json +++ b/interface/.typesafe-i18n.json @@ -1,5 +1,5 @@ { - "adapter": "react", - "baseLocale": "en", - "$schema": "https://unpkg.com/typesafe-i18n@5.14.0/schema/typesafe-i18n.json" -} \ No newline at end of file + "adapter": "react", + "baseLocale": "en", + "$schema": "https://unpkg.com/typesafe-i18n@5.14.0/schema/typesafe-i18n.json" +} diff --git a/interface/package-lock.json b/interface/package-lock.json index 2dad40071..6e6893306 100644 --- a/interface/package-lock.json +++ b/interface/package-lock.json @@ -12,10 +12,10 @@ "@emotion/styled": "^11.10.4", "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.10.6", - "@mui/material": "^5.10.7", + "@mui/material": "^5.10.8", "@table-library/react-table-library": "4.0.18", "@types/lodash": "^4.14.186", - "@types/node": "^18.7.23", + "@types/node": "^18.8.2", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", "@types/react-router-dom": "^5.3.3", @@ -3103,9 +3103,9 @@ } }, "node_modules/@mui/base": { - "version": "5.0.0-alpha.99", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.99.tgz", - "integrity": "sha512-D04H6O1c0Jv561yI0SVbpa8MpqpW3G43CwJxV2o6ALfI0DMJ45w07dGafmDchb6aCWTRTdggd3rjgmuzyNwPiQ==", + "version": "5.0.0-alpha.100", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.100.tgz", + "integrity": "sha512-bSoJEKCENtmJrJDECHUe9PiqztIUACuSskyqw9ypqE7Dz3WxL3e8puFsWBkUsz+WOCjXh4B4Xljn88Ucxxv5HA==", "dependencies": { "@babel/runtime": "^7.19.0", "@emotion/is-prop-valid": "^1.2.0", @@ -3135,9 +3135,9 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.7.tgz", - "integrity": "sha512-3N0UYVy3MbrHzM3j6f7fIUCZ+bQ1/sSZq143tLxwSssW3Z4AqE83brpr5flEY1Lx+Aowv/cPyQMmZxzRlFCGqw==", + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.8.tgz", + "integrity": "sha512-V5D7OInO4P9PdT/JACg7fwjbOORm3GklaMVgdGomjyxiyetgRND5CC9r35e1LK/DqHdoyDuhbFzdfrqWtpmEIw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui" @@ -3169,14 +3169,14 @@ } }, "node_modules/@mui/material": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.7.tgz", - "integrity": "sha512-o1jcQGii+q7ORrXhBiMmGzFDaboc1qTgOOC3zDW+NR9ryVzWzL7qEeqoORbgDB5zk9OBsXCjB91fUH/ls5xMwg==", + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.8.tgz", + "integrity": "sha512-sF/Ka0IJjGXV52zoT4xAWEqXVRjNYbIjATo9L4Q5oQC5iJpGrKJFY16uNtWWB0+vp/nayAuPGZHrxtV+t3ecdQ==", "dependencies": { "@babel/runtime": "^7.19.0", - "@mui/base": "5.0.0-alpha.99", - "@mui/core-downloads-tracker": "^5.10.7", - "@mui/system": "^5.10.7", + "@mui/base": "5.0.0-alpha.100", + "@mui/core-downloads-tracker": "^5.10.8", + "@mui/system": "^5.10.8", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "@types/react-transition-group": "^4.4.5", @@ -3239,9 +3239,9 @@ } }, "node_modules/@mui/styled-engine": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.7.tgz", - "integrity": "sha512-CCrtW+vvCKEm6pOE/QcutQ+ORC/iE6D1ghscN4l7LE2JXPvTXO/z0yu8Wxug1JEDlWm4r1Qa0PzJe1P9bjKzNA==", + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.8.tgz", + "integrity": "sha512-w+y8WI18EJV6zM/q41ug19cE70JTeO6sWFsQ7tgePQFpy6ToCVPh0YLrtqxUZXSoMStW5FMw0t9fHTFAqPbngw==", "dependencies": { "@babel/runtime": "^7.19.0", "@emotion/cache": "^11.10.3", @@ -3270,13 +3270,13 @@ } }, "node_modules/@mui/system": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.7.tgz", - "integrity": "sha512-kwyhjjKGsgtBRFl6vSqidDZcNKU5S1juTgm4Xi2fyWxaEbIQb9Sh9y0iVP2bNCJzgDr0alLaENOZOEaDWHISAQ==", + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.8.tgz", + "integrity": "sha512-hRQ354zcrYP/KHqK8FheICSvE9raQaUgQaV+A3oD4JETaFUCVI9Ytt+RcQYgTqx02xlCXIjl8LK1rPjTneySqw==", "dependencies": { "@babel/runtime": "^7.19.0", "@mui/private-theming": "^5.10.6", - "@mui/styled-engine": "^5.10.7", + "@mui/styled-engine": "^5.10.8", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "clsx": "^1.2.1", @@ -4029,9 +4029,9 @@ "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" }, "node_modules/@types/node": { - "version": "18.7.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", - "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==" + "version": "18.8.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.2.tgz", + "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==" }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -19643,9 +19643,9 @@ "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==" }, "@mui/base": { - "version": "5.0.0-alpha.99", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.99.tgz", - "integrity": "sha512-D04H6O1c0Jv561yI0SVbpa8MpqpW3G43CwJxV2o6ALfI0DMJ45w07dGafmDchb6aCWTRTdggd3rjgmuzyNwPiQ==", + "version": "5.0.0-alpha.100", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.100.tgz", + "integrity": "sha512-bSoJEKCENtmJrJDECHUe9PiqztIUACuSskyqw9ypqE7Dz3WxL3e8puFsWBkUsz+WOCjXh4B4Xljn88Ucxxv5HA==", "requires": { "@babel/runtime": "^7.19.0", "@emotion/is-prop-valid": "^1.2.0", @@ -19658,9 +19658,9 @@ } }, "@mui/core-downloads-tracker": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.7.tgz", - "integrity": "sha512-3N0UYVy3MbrHzM3j6f7fIUCZ+bQ1/sSZq143tLxwSssW3Z4AqE83brpr5flEY1Lx+Aowv/cPyQMmZxzRlFCGqw==" + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.10.8.tgz", + "integrity": "sha512-V5D7OInO4P9PdT/JACg7fwjbOORm3GklaMVgdGomjyxiyetgRND5CC9r35e1LK/DqHdoyDuhbFzdfrqWtpmEIw==" }, "@mui/icons-material": { "version": "5.10.6", @@ -19671,14 +19671,14 @@ } }, "@mui/material": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.7.tgz", - "integrity": "sha512-o1jcQGii+q7ORrXhBiMmGzFDaboc1qTgOOC3zDW+NR9ryVzWzL7qEeqoORbgDB5zk9OBsXCjB91fUH/ls5xMwg==", + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.10.8.tgz", + "integrity": "sha512-sF/Ka0IJjGXV52zoT4xAWEqXVRjNYbIjATo9L4Q5oQC5iJpGrKJFY16uNtWWB0+vp/nayAuPGZHrxtV+t3ecdQ==", "requires": { "@babel/runtime": "^7.19.0", - "@mui/base": "5.0.0-alpha.99", - "@mui/core-downloads-tracker": "^5.10.7", - "@mui/system": "^5.10.7", + "@mui/base": "5.0.0-alpha.100", + "@mui/core-downloads-tracker": "^5.10.8", + "@mui/system": "^5.10.8", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "@types/react-transition-group": "^4.4.5", @@ -19700,9 +19700,9 @@ } }, "@mui/styled-engine": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.7.tgz", - "integrity": "sha512-CCrtW+vvCKEm6pOE/QcutQ+ORC/iE6D1ghscN4l7LE2JXPvTXO/z0yu8Wxug1JEDlWm4r1Qa0PzJe1P9bjKzNA==", + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.10.8.tgz", + "integrity": "sha512-w+y8WI18EJV6zM/q41ug19cE70JTeO6sWFsQ7tgePQFpy6ToCVPh0YLrtqxUZXSoMStW5FMw0t9fHTFAqPbngw==", "requires": { "@babel/runtime": "^7.19.0", "@emotion/cache": "^11.10.3", @@ -19711,13 +19711,13 @@ } }, "@mui/system": { - "version": "5.10.7", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.7.tgz", - "integrity": "sha512-kwyhjjKGsgtBRFl6vSqidDZcNKU5S1juTgm4Xi2fyWxaEbIQb9Sh9y0iVP2bNCJzgDr0alLaENOZOEaDWHISAQ==", + "version": "5.10.8", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.10.8.tgz", + "integrity": "sha512-hRQ354zcrYP/KHqK8FheICSvE9raQaUgQaV+A3oD4JETaFUCVI9Ytt+RcQYgTqx02xlCXIjl8LK1rPjTneySqw==", "requires": { "@babel/runtime": "^7.19.0", "@mui/private-theming": "^5.10.6", - "@mui/styled-engine": "^5.10.7", + "@mui/styled-engine": "^5.10.8", "@mui/types": "^7.2.0", "@mui/utils": "^5.10.6", "clsx": "^1.2.1", @@ -20233,9 +20233,9 @@ "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" }, "@types/node": { - "version": "18.7.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", - "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==" + "version": "18.8.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.2.tgz", + "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==" }, "@types/parse-json": { "version": "4.0.0", diff --git a/interface/package.json b/interface/package.json index 075122eca..1b97bef90 100644 --- a/interface/package.json +++ b/interface/package.json @@ -8,10 +8,10 @@ "@emotion/styled": "^11.10.4", "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.10.6", - "@mui/material": "^5.10.7", + "@mui/material": "^5.10.8", "@table-library/react-table-library": "4.0.18", "@types/lodash": "^4.14.186", - "@types/node": "^18.7.23", + "@types/node": "^18.8.2", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", "@types/react-router-dom": "^5.3.3", diff --git a/interface/src/framework/mqtt/MqttStatusForm.tsx b/interface/src/framework/mqtt/MqttStatusForm.tsx index a889ec0fa..825f76731 100644 --- a/interface/src/framework/mqtt/MqttStatusForm.tsx +++ b/interface/src/framework/mqtt/MqttStatusForm.tsx @@ -5,6 +5,7 @@ import DeviceHubIcon from '@mui/icons-material/DeviceHub'; import RefreshIcon from '@mui/icons-material/Refresh'; import ReportIcon from '@mui/icons-material/Report'; import SpeakerNotesOffIcon from '@mui/icons-material/SpeakerNotesOff'; +import AutoAwesomeMotionIcon from '@mui/icons-material/AutoAwesomeMotion'; import { ButtonRow, FormLoader, SectionContent } from '../../components'; import { MqttStatus, MqttDisconnectReason } from '../../types'; @@ -31,6 +32,12 @@ export const mqttPublishHighlight = ({ mqtt_fails }: MqttStatus, theme: Theme) = return theme.palette.error.main; }; +export const mqttQueueHighlight = ({ mqtt_queued }: MqttStatus, theme: Theme) => { + if (mqtt_queued <= 1) return theme.palette.success.main; + + return theme.palette.warning.main; +}; + const MqttStatusForm: FC = () => { const { loadData, data, errorMessage } = useRest({ read: MqttApi.readMqttStatus }); @@ -38,14 +45,14 @@ const MqttStatusForm: FC = () => { const theme = useTheme(); - const mqttStatus = ({ enabled, connected }: MqttStatus) => { + const mqttStatus = ({ enabled, connected, connect_count }: MqttStatus) => { if (!enabled) { return LL.NOT_ENABLED(); } if (connected) { - return LL.CONNECTED(); + return LL.CONNECTED() + (connect_count > 1 ? ' (' + connect_count + ')' : ''); } - return LL.DISCONNECTED(); + return LL.DISCONNECTED() + (connect_count > 1 ? ' (' + connect_count + ')' : ''); }; const disconnectReason = ({ disconnect_reason }: MqttStatus) => { @@ -77,36 +84,44 @@ const MqttStatusForm: FC = () => { } const renderConnectionStatus = () => { - if (data.connected) { - return ( - <> - - - # - - - - - - - - - - - - - - ); - } return ( <> + {!data.connected && ( + <> + + + + + + + + + + + )} - - + # + + + + + + + + - + + + + + + + + + + diff --git a/interface/src/project/DashboardData.tsx b/interface/src/project/DashboardData.tsx index c60c4eed9..6bfe28887 100644 --- a/interface/src/project/DashboardData.tsx +++ b/interface/src/project/DashboardData.tsx @@ -508,7 +508,7 @@ const DashboardData: FC = () => { { } function formatName(de: DeviceEntity) { - if (de.n === undefined || de.n === de.id) { - return de.id; - } - - if (de.n[0] === '!') { - return LL.COMMAND() + ': ' + de.n.slice(1); + if (de.n === undefined) { + return ( + <> + ( + + {de.id} + + ) + + ); } return ( <> - {de.cn !== undefined && de.cn !== '' ? de.cn : de.n} + {de.n[0] === '!' ? LL.COMMAND() + ': ' + de.n.slice(1) : de.cn !== undefined && de.cn !== '' ? de.cn : de.n}  ( {de.id} @@ -324,7 +328,7 @@ const SettingsCustomization: FC = () => { }; const editEntity = (de: DeviceEntity) => { - if (de.n && de.n[0] === '!') { + if (de.n === undefined || (de.n && de.n[0] === '!')) { return; } diff --git a/interface/src/types/mqtt.ts b/interface/src/types/mqtt.ts index 1e2b50a00..0e8a10eec 100644 --- a/interface/src/types/mqtt.ts +++ b/interface/src/types/mqtt.ts @@ -15,6 +15,8 @@ export interface MqttStatus { client_id: string; disconnect_reason: MqttDisconnectReason; mqtt_fails: number; + mqtt_queued: number; + connect_count: number; } export interface MqttSettings { diff --git a/lib/framework/MqttStatus.cpp b/lib/framework/MqttStatus.cpp index dc75cc9fc..c5ff2a05c 100644 --- a/lib/framework/MqttStatus.cpp +++ b/lib/framework/MqttStatus.cpp @@ -20,7 +20,9 @@ void MqttStatus::mqttStatus(AsyncWebServerRequest * request) { root["client_id"] = _mqttSettingsService->getClientId(); root["disconnect_reason"] = (uint8_t)_mqttSettingsService->getDisconnectReason(); - root["mqtt_fails"] = emsesp::Mqtt::publish_fails(); // proddy added + root["mqtt_queued"] = emsesp::Mqtt::publish_queued(); // mdvp added + root["mqtt_fails"] = emsesp::Mqtt::publish_fails(); // proddy added + root["connect_count"] = emsesp::Mqtt::connect_count(); // mdvp added response->setLength(); request->send(response); diff --git a/mock-api/server.js b/mock-api/server.js index 75d799ea0..33d218ec9 100644 --- a/mock-api/server.js +++ b/mock-api/server.js @@ -240,6 +240,8 @@ const mqtt_status = { client_id: 'ems-esp', disconnect_reason: 0, mqtt_fails: 0, + mqtt_queued: 1, + connect_count: 2, } // SYSTEM diff --git a/scripts/rename_fw.py b/scripts/rename_fw.py index 371aeab45..07a944567 100644 --- a/scripts/rename_fw.py +++ b/scripts/rename_fw.py @@ -19,7 +19,9 @@ def bin_copy(source, target, env): app_version = bag.get('app_version') platform = "ESP32" + chip_target = env.get('PIOENV').upper() + # this breaks the CI so removed # flash_size = env["PIOENV"].split('_')[1] # print(env.Dump()) @@ -31,14 +33,12 @@ def bin_copy(source, target, env): # alternatively take platform from the pio target # platform = str(target[0]).split(os.path.sep)[2] - print("app version: "+app_version) - print("platform: "+platform) - # print("flash size: "+flash_size) + print("app version: " + app_version) + print("platform: " + platform) + print("chip_target: " + chip_target) # convert . to _ so Windows doesn't complain - variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + platform - - # variant = "EMS-ESP-" + app_version.replace(".", "_") + "-" + platform + "_" + flash_size + variant = "EMS-ESP-" + chip_target + "-" + app_version.replace(".", "_") # check if output directories exist and create if necessary if not os.path.isdir(OUTPUT_DIR): diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 2d6708042..091df787e 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -522,7 +522,7 @@ void Thermostat::process_RC10Set(std::shared_ptr telegram) { if (hc == nullptr) { return; } - has_update(telegram, ibaClockOffset_, 0); + has_update(telegram, ibaCalIntTemperature_, 0); has_update(telegram, backlight_, 1); has_update(telegram, wwMode_, 2); has_update(telegram, hc->nighttemp, 3); @@ -1102,6 +1102,7 @@ void Thermostat::process_RC300OutdoorTemp(std::shared_ptr telegr // 0x240 RC300 parameter void Thermostat::process_RC300Settings(std::shared_ptr telegram) { + has_update(telegram, ibaCalIntTemperature_, 7); has_update(telegram, ibaDamping_, 8); has_enumupdate(telegram, ibaBuildingType_, 9, 1); // 1=light, 2=medium, 3=heavy has_update(telegram, ibaMinExtTemperature_, 10); @@ -1557,6 +1558,8 @@ bool Thermostat::set_calinttemp(const char * value, const int8_t id) { write_command(EMS_TYPE_RC30Settings, 1, t, EMS_TYPE_RC30Settings); } else if (model() == EMS_DEVICE_FLAG_RC100H) { write_command(0x273, 0, t, 0x273); + } else if (model() == EMS_DEVICE_FLAG_RC100 || model() == EMS_DEVICE_FLAG_RC300) { + write_command(0x240, 7, t, 0x240); } else { write_command(EMS_TYPE_IBASettings, 2, t, EMS_TYPE_IBASettings); } @@ -1564,10 +1567,10 @@ bool Thermostat::set_calinttemp(const char * value, const int8_t id) { return true; } -// 0xA5 - Set the display settings +// 0xA5 - Set the display settings, RC30_N bool Thermostat::set_display(const char * value, const int8_t id) { - int ds = 0; - if (!Helpers::value2number(value, ds)) { + uint8_t ds; + if (!Helpers::value2enum(value, ds, FL_(enum_ibaMainDisplay))) { return false; } @@ -3382,6 +3385,13 @@ void Thermostat::register_device_values() { FL_(dateTime), DeviceValueUOM::NONE, MAKE_CF_CB(set_datetime)); + register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, + &ibaCalIntTemperature_, + DeviceValueType::INT, + DeviceValueNumOp::DV_NUMOP_DIV10, + FL_(ibaCalIntTemperature), + DeviceValueUOM::DEGREES_R, + MAKE_CF_CB(set_calinttemp)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &floordrystatus_, DeviceValueType::ENUM, @@ -3506,12 +3516,6 @@ void Thermostat::register_device_values() { FL_(ibaLanguage), DeviceValueUOM::NONE, MAKE_CF_CB(set_language)); - register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, - &ibaMainDisplay_, - DeviceValueType::ENUM, - FL_(enum_ibaMainDisplay), - FL_(ibaMainDisplay), - DeviceValueUOM::NONE); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &backlight_, DeviceValueType::BOOL, FL_(backlight), DeviceValueUOM::NONE, MAKE_CF_CB(set_backlight)); register_device_value( DeviceValueTAG::TAG_DEVICE_DATA, &brightness_, DeviceValueType::INT, FL_(brightness), DeviceValueUOM::NONE, MAKE_CF_CB(set_brightness), -15, 15); @@ -3599,13 +3603,15 @@ void Thermostat::register_device_values() { DeviceValueType::ENUM, FL_(enum_ibaMainDisplay), FL_(ibaMainDisplay), - DeviceValueUOM::NONE); + DeviceValueUOM::NONE, + MAKE_CF_CB(set_display)); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaLanguage_, DeviceValueType::ENUM, FL_(enum_ibaLanguage), FL_(ibaLanguage), DeviceValueUOM::NONE); register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaClockOffset_, DeviceValueType::INT, FL_(ibaClockOffset), - DeviceValueUOM::SECONDS); // offset (in sec) to clock, 0xff=-1s, 0x02=2s + DeviceValueUOM::SECONDS, + MAKE_CF_CB(set_clockoffset)); // offset (in sec) to clock, 0xff=-1s, 0x02=2s register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &ibaCalIntTemperature_, DeviceValueType::INT, @@ -3950,7 +3956,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrselTemp, DeviceValueType::SHORT, seltemp_divider, FL_(selRoomTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_temp), 0, 30); } register_device_value(tag, &hc->roomTemp, DeviceValueType::SHORT, roomtemp_divider, FL_(roomTemp), DeviceValueUOM::DEGREES); - register_device_value(tag, &hc->climate, DeviceValueType::ENUM, FL_(enum_climate), FL_(climate), DeviceValueUOM::NONE); + register_device_value(tag, &hc->climate, DeviceValueType::ENUM, FL_(enum_climate), FL_(climate), DeviceValueUOM::NONE); // min, max set in ha function switch (model) { case EMS_DEVICE_FLAG_RC10: @@ -4135,9 +4141,16 @@ void Thermostat::register_device_values_hc(std::shared_ptrmode, DeviceValueType::ENUM, FL_(enum_mode3), FL_(mode), DeviceValueUOM::NONE, MAKE_CF_CB(set_mode)); register_device_value(tag, &hc->modetype, DeviceValueType::ENUM, FL_(enum_modetype3), FL_(modetype), DeviceValueUOM::NONE); register_device_value( - tag, &hc->daytemp, DeviceValueType::UINT, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daytemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp)); - register_device_value( - tag, &hc->nighttemp, DeviceValueType::UINT, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(nighttemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_nighttemp)); + tag, &hc->daytemp, DeviceValueType::UINT, DeviceValueNumOp::DV_NUMOP_DIV2, FL_(daytemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_daytemp), 5, 30); + register_device_value(tag, + &hc->nighttemp, + DeviceValueType::UINT, + DeviceValueNumOp::DV_NUMOP_DIV2, + FL_(nighttemp), + DeviceValueUOM::DEGREES, + MAKE_CF_CB(set_nighttemp), + 5, + 30); register_device_value(tag, &hc->designtemp, DeviceValueType::UINT, FL_(designtemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_designtemp), 30, 90); register_device_value(tag, &hc->offsettemp, @@ -4154,7 +4167,9 @@ void Thermostat::register_device_values_hc(std::shared_ptrtargetflowtemp, DeviceValueType::UINT, FL_(targetflowtemp), DeviceValueUOM::DEGREES); register_device_value(tag, &hc->summertemp, DeviceValueType::UINT, FL_(summertemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_summertemp), 9, 25); register_device_value(tag, &hc->summermode, DeviceValueType::ENUM, FL_(enum_summer), FL_(summermode), DeviceValueUOM::NONE); @@ -4183,7 +4198,9 @@ void Thermostat::register_device_values_hc(std::shared_ptrnoreducetemp, DeviceValueType::INT, FL_(noreducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_noreducetemp), -30, 10); register_device_value(tag, &hc->reducetemp, DeviceValueType::INT, FL_(reducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_reducetemp), -20, 10); register_device_value(tag, &hc->vacreducetemp, DeviceValueType::INT, FL_(vacreducetemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_vacreducetemp), -20, 10); diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index ce475d3e2..fdf302c56 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -850,7 +850,8 @@ void EMSdevice::generate_values_web(JsonObject & output) { obj["s"] = Helpers::render_value(s, (float)(-1) * dv.numeric_operator, 0); } - int16_t dv_set_min, dv_set_max; + int16_t dv_set_min; + uint16_t dv_set_max; if (dv.get_min_max(dv_set_min, dv_set_max)) { obj["m"] = Helpers::render_value(s, dv_set_min, 0); obj["x"] = Helpers::render_value(s, dv_set_max, 0); @@ -980,6 +981,20 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) { } } +void EMSdevice::set_climate_minmax(uint8_t tag, int16_t min, uint16_t max) { + for (auto & dv : devicevalues_) { + if (dv.tag == tag && dv.short_name == FL_(climate[0])) { + if (dv.min != min || dv.max != max) { + dv.min = min; + dv.max = max; + dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED); + Mqtt::publish_ha_climate_config(dv.tag, false, true); // delete topic (remove = true) + } + return; + } + } +} + // set mask per device entity based on the id which is prefixed with the 2 char hex mask value // returns true if the entity has a mask set (not 0 the default) void EMSdevice::setCustomEntity(const std::string & entity_id) { @@ -1002,7 +1017,7 @@ void EMSdevice::setCustomEntity(const std::string & entity_id) { uint8_t new_mask = Helpers::hextoint(entity_id.substr(0, 2).c_str()); // first character contains mask flags // if it's a new mask, reconfigure HA - if (Mqtt::ha_enabled() && ((current_mask ^ new_mask) & (DeviceValueState::DV_READONLY >> 4))) { + if (Mqtt::ha_enabled() && (has_custom_name || ((current_mask ^ new_mask) & (DeviceValueState::DV_READONLY >> 4)))) { // remove ha config on change of dv_readonly flag dv.remove_state(DeviceValueState::DV_HA_CONFIG_CREATED); Mqtt::publish_ha_sensor_config(dv, "", "", true); // delete topic (remove = true) @@ -1018,9 +1033,16 @@ void EMSdevice::setCustomEntity(const std::string & entity_id) { dv.custom_fullname = ""; } + auto min = dv.min; + auto max = dv.max; + // set the min / max dv.set_custom_minmax(); + if (Mqtt::ha_enabled() && dv.short_name == FL_(seltemp)[0] && (min != dv.min || max != dv.max)) { + set_climate_minmax(dv.tag, dv.min, dv.max); + } + return; } } @@ -1187,11 +1209,14 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 break; } - // set the min and max - int16_t dv_set_min, dv_set_max; - if (dv.get_min_max(dv_set_min, dv_set_max)) { - json["min"] = dv_set_min; - json["max"] = dv_set_max; + // set the min and max only for commands + if (dv.has_cmd) { + int16_t dv_set_min; + uint16_t dv_set_max; + if (dv.get_min_max(dv_set_min, dv_set_max)) { + json["min"] = dv_set_min; + json["max"] = dv_set_max; + } } // add uom if it's not a " " (single space) @@ -1469,12 +1494,12 @@ void EMSdevice::mqtt_ha_entity_config_create() { if (*(int8_t *)(dv.value_p) == 1 && (!dv.has_state(DeviceValueState::DV_HA_CONFIG_CREATED) || dv.has_state(DeviceValueState::DV_HA_CLIMATE_NO_RT))) { dv.remove_state(DeviceValueState::DV_HA_CLIMATE_NO_RT); dv.add_state(DeviceValueState::DV_HA_CONFIG_CREATED); - Mqtt::publish_ha_climate_config(dv.tag, true); + Mqtt::publish_ha_climate_config(dv.tag, true, false, dv.min, dv.max); } else if (*(int8_t *)(dv.value_p) == 0 && (!dv.has_state(DeviceValueState::DV_HA_CONFIG_CREATED) || !dv.has_state(DeviceValueState::DV_HA_CLIMATE_NO_RT))) { dv.add_state(DeviceValueState::DV_HA_CLIMATE_NO_RT); dv.add_state(DeviceValueState::DV_HA_CONFIG_CREATED); - Mqtt::publish_ha_climate_config(dv.tag, false); + Mqtt::publish_ha_climate_config(dv.tag, false, false, dv.min, dv.max); } } if (!dv.has_state(DeviceValueState::DV_HA_CONFIG_CREATED) && (dv.type != DeviceValueType::CMD) && dv.has_state(DeviceValueState::DV_ACTIVE) diff --git a/src/emsdevice.h b/src/emsdevice.h index 8a841e14a..d4ea9ad0d 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -187,6 +187,7 @@ class EMSdevice { void list_device_entries(JsonObject & output) const; void add_handlers_ignored(const uint16_t handler); + void set_climate_minmax(uint8_t tag, int16_t min, uint16_t max); void setCustomEntity(const std::string & entity_id); void getCustomEntities(std::vector & entity_ids); diff --git a/src/emsdevicevalue.cpp b/src/emsdevicevalue.cpp index 97b7f6b7a..87452232c 100644 --- a/src/emsdevicevalue.cpp +++ b/src/emsdevicevalue.cpp @@ -270,7 +270,7 @@ bool DeviceValue::hasValue() const { // converts to signed int, which means rounding to an whole integer // returns false if there is no min/max needed // Types BOOL, ENUM, STRING and CMD are not used -bool DeviceValue::get_min_max(int16_t & dv_set_min, int16_t & dv_set_max) { +bool DeviceValue::get_min_max(int16_t & dv_set_min, uint16_t & dv_set_max) { uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (uom == DeviceValueUOM::DEGREES) ? 2 : (uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; // if we have individual limits set already, just do the conversion diff --git a/src/emsdevicevalue.h b/src/emsdevicevalue.h index a36795e46..bdb003450 100644 --- a/src/emsdevicevalue.h +++ b/src/emsdevicevalue.h @@ -176,7 +176,7 @@ class DeviceValue { uint8_t state); bool hasValue() const; - bool get_min_max(int16_t & dv_set_min, int16_t & dv_set_max); + bool get_min_max(int16_t & dv_set_min, uint16_t & dv_set_max); void set_custom_minmax(); bool get_custom_min(int16_t & val); diff --git a/src/emsesp.cpp b/src/emsesp.cpp index 1e44808ab..fac98d316 100644 --- a/src/emsesp.cpp +++ b/src/emsesp.cpp @@ -1340,6 +1340,7 @@ void EMSESP::scheduled_fetch_values() { last_fetch_ = uuid::get_uptime(); no = 1; } + if (txservice_.tx_queue_empty()) { uint8_t i = 0; for (const auto & emsdevice : emsdevices) { diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 885961db8..be3286ff3 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -915,7 +915,7 @@ void Mqtt::publish_ha_sensor_config(DeviceValue & dv, const std::string & model, // calculate the min and max int16_t dv_set_min; - int16_t dv_set_max; + uint16_t dv_set_max; (void)dv.get_min_max(dv_set_min, dv_set_max); // determine if we're creating the command topics which we use special HA configs @@ -1241,7 +1241,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice publish_ha(topic, doc.as()); } -void Mqtt::publish_ha_climate_config(uint8_t tag, bool has_roomtemp, bool remove) { +void Mqtt::publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp, const bool remove, const int16_t min, const uint16_t max) { uint8_t hc_num = tag - DeviceValueTAG::TAG_HC1 + 1; char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; @@ -1313,9 +1313,9 @@ void Mqtt::publish_ha_climate_config(uint8_t tag, bool has_roomtemp, bool remove doc["curr_temp_t"] = topic_t; doc["curr_temp_tpl"] = currtemp_s; } - - doc["min_temp"] = Helpers::render_value(min_s, (uint32_t)5, 0, EMSESP::system_.fahrenheit() ? 2 : 0); - doc["max_temp"] = Helpers::render_value(max_s, (uint32_t)30, 0, EMSESP::system_.fahrenheit() ? 2 : 0); + + doc["min_temp"] = Helpers::render_value(min_s, min, 0, EMSESP::system_.fahrenheit() ? 2 : 0); + doc["max_temp"] = Helpers::render_value(max_s, max, 0, EMSESP::system_.fahrenheit() ? 2 : 0); doc["temp_step"] = "0.5"; // the HA climate component only responds to auto, heat and off diff --git a/src/mqtt.h b/src/mqtt.h index 1fef21aef..b709c3f9b 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -107,7 +107,7 @@ class Mqtt { const JsonObject & dev_json); static void publish_system_ha_sensor_config(uint8_t type, const char * name, const char * entity, const uint8_t uom); - static void publish_ha_climate_config(uint8_t tag, bool has_roomtemp, bool remove = false); + static void publish_ha_climate_config(const uint8_t tag, const bool has_roomtemp, const bool remove = false, const int16_t min = 5, const uint16_t max = 30); static void show_topic_handlers(uuid::console::Shell & shell, const uint8_t device_type); static void show_mqtt(uuid::console::Shell & shell); @@ -166,6 +166,14 @@ class Mqtt { return mqtt_publish_fails_; } + static uint32_t publish_queued() { + return mqtt_messages_.size(); + } + + static uint8_t connect_count() { + return connectcount_; + } + static void reset_mqtt(); static bool is_nested() { @@ -177,7 +185,7 @@ class Mqtt { } static bool publish_single() { - return publish_single_; + return mqtt_enabled_ && publish_single_; } static bool publish_single2cmd() { @@ -189,7 +197,7 @@ class Mqtt { } static bool ha_enabled() { - return ha_enabled_; + return mqtt_enabled_ && ha_enabled_; } static void ha_enabled(bool ha_enabled) { diff --git a/src/telegram.cpp b/src/telegram.cpp index c23baf6bf..121097fe6 100644 --- a/src/telegram.cpp +++ b/src/telegram.cpp @@ -432,8 +432,13 @@ void TxService::add(const uint8_t operation, LOG_DEBUG("[DEBUG] New Tx [#%d] telegram, length %d", tx_telegram_id_, message_length); #endif - // if the queue is full, make room but removing the last one + // if the queue is full, make room by removing the last one if (tx_telegrams_.size() >= MAX_TX_TELEGRAMS) { + if (tx_telegrams_.front().telegram_->operation == Telegram::Operation::TX_WRITE) { + telegram_write_fail_count_++; + } else { + telegram_read_fail_count_++; + } tx_telegrams_.pop_front(); } @@ -505,8 +510,13 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt auto telegram = std::make_shared(operation, src, dest, type_id, offset, message_data, message_length); // operation is TX_WRITE or TX_READ - // if the queue is full, make room but removing the last one + // if the queue is full, make room by removing the last one if (tx_telegrams_.size() >= MAX_TX_TELEGRAMS) { + if (tx_telegrams_.front().telegram_->operation == Telegram::Operation::TX_WRITE) { + telegram_write_fail_count_++; + } else { + telegram_read_fail_count_++; + } tx_telegrams_.pop_front(); } From 39cbcd4d6f6a40a459a5645fe6168437221a193b Mon Sep 17 00:00:00 2001 From: Proddy Date: Tue, 4 Oct 2022 21:04:04 +0200 Subject: [PATCH 23/28] Polish translation improvements #661 --- interface/src/i18n/pl/index.ts | 266 ++++++++++++++++----------------- 1 file changed, 132 insertions(+), 134 deletions(-) diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index 18a55a1ca..16adb12a5 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -11,194 +11,193 @@ const pl: BaseTranslation = { PASSWORD: 'Hasło', DASHBOARD: 'Pulpit', SETTINGS: 'Ustawienia', - SAVED: 'Zapisano', + SAVED: 'zapisano', HELP: 'Pomoc', LOGGED_IN: 'Zalogowany jako', PLEASE_SIGNIN: 'Zaloguj się aby kontynuować', - UPLOAD_SUCCESSFUL: 'Wgrywanie zakończone', - DOWNLOAD_SUCCESSFUL: 'Ściąganie zakończone', + UPLOAD_SUCCESSFUL: 'Wysyłanie zakończone', + DOWNLOAD_SUCCESSFUL: 'Pobieranie zakończone', INVALID_LOGIN: 'Niepoprawny login', - NETWORK: 'Śieć', + NETWORK: 'Sieć', SECURITY: 'Bezpieczeństwo', ONOFF_CAP: 'WŁ/WYŁ', ONOFF: 'wł/wył', - TYPE: 'Urządzenie', + TYPE: 'Typ', DESCRIPTION: 'Opis', - ENTITIES: 'Ilość', + ENTITIES: 'Encje', REFRESH: 'Odśwież', - EXPORT: 'Exportuj', + EXPORT: 'Eksportuj', DEVICE_DETAILS: 'Szczegóły urządzenia', BRAND: 'Marka', - ENTITY_NAME: 'Nazwa', - VALUE: 'Wartość', - SHOW_FAV: 'Ulubione', - DEVICE_SENSOR_DATA: 'Dane z urządzeń i czujników', + ENTITY_NAME: 'Nazwa encji', + VALUE: 'wartość', + SHOW_FAV: 'Pokaż tylko "ulubione"', + DEVICE_SENSOR_DATA: 'Dane z urządzeń EMS i czujników', DEVICES_SENSORS: 'Urządzenia i czujniki', - ATTACHED_SENSORS: 'dołączone czujniki', - RUN_COMMAND: 'Uruchom komendę', + ATTACHED_SENSORS: 'Podłączone czujniki', + RUN_COMMAND: 'Wykonaj polecenie', CHANGE_VALUE: 'Zmień wartość', CANCEL: 'Anuluj', RESET: 'Resetuj', SEND: 'Wyślij', SAVE: 'Zapisz', REMOVE: 'Usuń', - PROBLEM_UPDATING: '', - PROBLEM_LOADING: '', + PROBLEM_UPDATING: 'Problem z aktualizacją', + PROBLEM_LOADING: 'Problem z pobieraniem', ACCESS_DENIED: 'Brak dostępu', - ANALOG_SENSOR: 'Czujnik analogowy', + ANALOG_SENSOR: 'czujnika analogowego', ANALOG_SENSORS: 'Czujniki analogowe', UPDATED: 'Zaktualizowano', UPDATE: 'Aktualizacja', REMOVED: 'Usunięto', DELETION: 'Skasowano', - // missing translations - OFFSET: 'Offset', - FACTOR: 'Factor', + + OFFSET: 'Korekta +/-', + FACTOR: 'Mnożnik', FREQ: 'Częstotliwość', STARTVALUE: 'Wartość początkowa', - WARN_GPIO: 'Ostrzeżenie', + WARN_GPIO: 'Uwaga! Bądź ostrożny przypisując GPIO do czujnika!', EDIT: 'Edycja', - TEMP_SENSOR: 'Czujnik temperatury', + TEMP_SENSOR: 'czujnika temperatury', TEMP_SENSORS: 'Czujniki temperatury', - WRITE_COMMAND: 'Komenda zapisu', + WRITE_COMMAND: 'Wyślij komendę {cmd}', EMS_BUS_WARNING: - 'Magistrala EMS rozłączona. Jeśli ten błąd występuje dłużej niż kilka sekng, sprawdz ustawienia oraz profil urządzenia/płytki', - EMS_BUS_SCANNING: 'Skanuje w poszukiwaniu urządzeń EMS...', - CONNECTED: 'Połączony', - TX_ISSUES: 'Problem Tx - spróbuj wybrać inny trym Tx', - DISCONNECTED: 'Rozłączony', + 'Brak połączenia z magistralą EMS. Jeśli ten błąd występuje dłużej niż kilka sekund, sprawdź ustawienia oraz profil płytki interfejsu', + EMS_BUS_SCANNING: 'Skanuję w poszukiwaniu urządzeń EMS...', + CONNECTED: 'połączono', + TX_ISSUES: 'Problem z zapisem na magistralę EMS. Spróbuj wybrać inny "tryb Tx"', + DISCONNECTED: 'brak połączenia', EMS_SCAN: 'Czy napewno chcesz uruchomić pełne skanowanie magistrali EMS?', EMS_BUS_STATUS: 'Status magistrali EMS', ACTIVE_DEVICES: 'Aktywne urządzenia i czujniki', DEVICE: 'Urządzenie', - SUCCESS: 'Powodzenie', - FAIL: 'Niepowodzenie', + SUCCESS: 'Udane', + FAIL: 'Nieudane', QUALITY: 'Jakość', SCAN_DEVICES: 'Skanuj w poszukiwaniu nowych urządzeń', - EMS_BUS_STATUS_TITLE: 'Magistrala EMS - aktywności', + EMS_BUS_STATUS_TITLE: 'Aktywność', SCAN: 'Skanuj', STATUS_NAMES: [ - 'EMS Telegram Otrzymany (Rx)', - 'EMS Odczyt (Tx)', - 'EMS Zapis (Tx)', - 'Odczyt czujników temperatury', - 'Odczyt czujników analogowych', - 'Publikacja MQTT', + 'EMS, telegramy odebrane (Rx)', + 'EMS, wysłane telegramy "odczyt" (Tx)', + 'EMS, wysłane telegramy "zapis" (Tx)', + 'Odczyty czujników temperatury 1-Wire®', + 'Odczyty czujników analogowych', + 'Publikacje MQTT', 'Wywołania API', - 'Wiadomości logu systemowego' + 'Wpisy syslog' ], - NUM_DEVICES: '{num} Urządzeni{{a|e|a|a|a}}', - NUM_TEMP_SENSORS: '{num} Czujnik{{ki|k|ki|ki|ki}} temperatury', - NUM_ANALOG_SENSORS: '{num} Czujni{{ki|k|ki|ki|ki}} analogow{{e|y|e|e|e}}', - NUM_DAYS: '{num} {{Dni|Dzień|Dni|Dni|Dni}}', - NUM_SECONDS: '{num} Sekun{{d|da|dy|dy|d}}', - NUM_HOURS: '{num} Godzi{{n|na|ny|ny|n}}', - NUM_MINUTES: '{num} Minu{{t|ta|ty|ty|t}}', + NUM_DEVICES: '{num} urządzeni{{a|e|a|a|a}} EMS', + NUM_TEMP_SENSORS: '{num} czujni{{ki|k|ki|ki|ki}} temperatury', + NUM_ANALOG_SENSORS: '{num} czujni{{ki|k|ki|ki|ki}} analogow{{e|y|e|e|e}}', + NUM_DAYS: '{num} {{dni|dzień|dni|dni|dni}}', + NUM_SECONDS: '{num} sekun{{d|da|dy|dy|d}}', + NUM_HOURS: '{num} godzi{{n|na|ny|ny|n}}', + NUM_MINUTES: '{num} minu{{t|ta|ty|ty|t}}', APPLICATION_SETTINGS: 'Ustawienia aplikacji', CUSTOMIZATION: 'Personalizacja', - APPLICATION_RESTARTING: 'Urządzenie się restartuje', - BOARD_PROFILE_TEXT: - 'Wybierz wstępną konfigurację interfejsu płytki z listy lub stwórz własną konfigurację urządzenia', - BOARD_PROFILE: 'Profil urządzenia', + APPLICATION_RESTARTING: 'Trwa ponowne uruchamianie', + BOARD_PROFILE_TEXT: 'Wybierz z listy wstępną konfigurację płytki interfejsu lub stwórz własną konfigurację', + BOARD_PROFILE: 'Profil płytki', BUTTON: 'Przycisk', TEMPERATURE: 'Temperatura', DISABLED: 'wyłączony', GENERAL_OPTIONS: 'Opcje podstawowe', LANGUAGE_ENTITIES: 'Język', - HIDE_LED: 'Wyłącz diody LED', - ENABLE_TELNET: 'Włącz dostęp dla konsoli Telnet', - ENABLE_ANALOG: 'Włącz czujniki analogowe', - CONVERT_FAHRENHEIT: "Konwertuj temperatury do Farenhaite'a", - BYPASS_TOKEN: '', - READONLY: 'Włącz tryb odczytu ', - UNDERCLOCK_CPU: 'Zastosuj obniżone taktowanie CPU', - // missing translations - ENABLE_SHOWER_TIMER: 'Enable Shower Timer', - ENABLE_SHOWER_ALERT: 'Enable Shower Alert', - TRIGGER_TIME: 'Trigger Time', - COLD_SHOT_DURATION: 'Cold Shot Duration', - FORMATTING_OPTIONS: 'Formatting Options', - BOOLEAN_FORMAT_DASHBOARD: 'Boolean Format Dashboard', - BOOLEAN_FORMAT_API: 'Boolean Format API/MQTT', - ENUM_FORMAT: 'Enum Format API/MQTT', - INDEX: 'Index', - ENABLE_PARASITE: 'Enable parasite power', + HIDE_LED: 'Wyłącz LED', + ENABLE_TELNET: 'Aktywuj dostęp dla konsoli Telnet', + ENABLE_ANALOG: 'Aktywuj czujniki analogowe', + CONVERT_FAHRENHEIT: 'Konwertuj temperatury do skali Fahrenheita', + BYPASS_TOKEN: 'Pomiń autoryzację tokenem w wywołaniach API', + READONLY: 'Tryb pracy "tylko do odczytu" (blokuje wszystkie komendy zapisu na magistralę EMS)', + UNDERCLOCK_CPU: 'Obniż taktowanie CPU', + + ENABLE_SHOWER_TIMER: 'Aktywuj minutnik prysznica', + ENABLE_SHOWER_ALERT: 'Aktywuj alarm przysznica', + TRIGGER_TIME: 'Wyzwalaj po czasie', + COLD_SHOT_DURATION: 'Czas trwania tryśnięcia zimnej wody', + FORMATTING_OPTIONS: 'Opcje formatowania', + BOOLEAN_FORMAT_DASHBOARD: 'Format wartości binarnych dla pulpicie', + BOOLEAN_FORMAT_API: 'Format wartości binarnych dla API/MQTT', + ENUM_FORMAT: 'Format wartości numerowanych dla API/MQTT', + INDEX: 'indeks', + ENABLE_PARASITE: 'Aktywuj zasilanie pasożytnicze dla czujników temperatury 1-Wire®', LOGGING: 'Logowanie', - LOG_HEX: 'Logowanie w systemie szesnastkowym (HEX)', - ENABLE_SYSLOG: 'Włącz log systemowy', + LOG_HEX: 'Loguj telegramy EMS w systemie szesnastkowym (HEX)', + ENABLE_SYSLOG: 'Włącz syslog', MARK_INTERVAL: 'Oznacz interwały', - SECONDS: 'Sekundy', - MINUTES: 'Minuty', - HOURS: 'Godziny', + SECONDS: 'sekundy', + MINUTES: 'minuty', + HOURS: 'godziny', RESTART: 'Restart', - RESTART_TEXT: 'Urządzenie musi zostać zrestartowane aby zastosować wprowadzone zmiany', - RESTART_CONFIRM: 'Are you sure you want to restart EMS-ESP?', - COMMAND: 'Komenda', + RESTART_TEXT: 'Aby zastosować wprowadzone zmainy interfejs EMS-ESP musi zostać zrestartowany', + RESTART_CONFIRM: 'Jesteś pewien, że chcesz zrestartować interfejs EMS-ESP?', + COMMAND: 'Polecenie', CUSTOMIZATIONS_RESTART: 'Wszystkie personalizacje zostały usunięte. Restartuję...', CUSTOMIZATIONS_FULL: 'Wybrano za dużo obiektów. Wprowadź zmiany w mniejszych partiach', CUSTOMIZATIONS_SAVED: 'Personalizacje zapisane', - CUSTOMIZATIONS_HELP_1: 'Zaznacz urządzenie i wprowadź personalizację lub zmień nazwę', - CUSTOMIZATIONS_HELP_2: 'Oznacz jako ulubione', - CUSTOMIZATIONS_HELP_3: '', - CUSTOMIZATIONS_HELP_4: '', + CUSTOMIZATIONS_HELP_1: 'Wybierz urządzenie EMS, dostosuj opcje lub kliknij by zmienić nazwę encji', + CUSTOMIZATIONS_HELP_2: 'oznacz jako ulubioną', + CUSTOMIZATIONS_HELP_3: 'zablokuj możliwość zapisu', + CUSTOMIZATIONS_HELP_4: 'wyklucz z MQTT i API', CUSTOMIZATIONS_HELP_5: 'ukryj na pulpicie', SELECT_DEVICE: 'Wybierz urządzenie', - SET_ALL: 'Zaznacz wszystko', + SET_ALL: 'Zaznacz wszystko jako', OPTIONS: 'Opcje', - NAME: 'Nazwa', + NAME: 'nazwa', CUSTOMIZATIONS_RESET: 'Czy jesteś pewien, że chcesz usunąć wszystkie personalizacje łącznie z ustawieniami dla czujników temperatury i analogowych?', - // missing translations - DEVICE_ENTITIES: 'Device Entities', - USER_CUSTOMIZATION: 'User Customization', + + DEVICE_ENTITIES: 'Encje urządzenia', + USER_CUSTOMIZATION: 'Personalizacje użytkownika', SUPPORT_INFORMATION: 'Dodatkowe informacje', CLICK_HERE: 'Kliknij tu', - HELP_INFORMATION_1: 'Skorzystaj z wiki w celu znalezienia szczegółowych instrukcji jak skonfigurowac EMS-ESP', + HELP_INFORMATION_1: 'Skorzystaj z wiki w celu znalezienia szczegółowych instrukcji jak skonfigurować EMS-ESP', HELP_INFORMATION_2: 'Skorzystaj z serwera Discord w celu komunikacji na żywo ze społecznością', - HELP_INFORMATION_3: 'Aby zaproponować nową funkcjonalność, lub zgłosić problem', + HELP_INFORMATION_3: 'Aby zaproponować nową funkcjonalność lub zgłosić problem', HELP_INFORMATION_4: - 'gdy zgłaszasz problem, będzie on szybciej zadresowany gdy do zgłoszenia dołączysz pełną informację systemową', + 'gdy zgłaszasz problem, będzie on szybciej rozwiązany gdy do zgłoszenia dołączysz pełną informację systemową', HELP_INFORMATION_5: 'EMS-ESP jest darmowym projektem typu open-source. Aby go wesprzeć, rozważ przyznanie nam gwiazdki na Github!', - SUPPORT_INFO: 'Dodatkowe info', - UPLOAD: 'Wgraj', - DOWNLOAD: 'Ściągnij', + SUPPORT_INFO: 'Dodatkowe informacje', + UPLOAD: 'Wysyłanie', + DOWNLOAD: 'Pobieranie', ABORTED: 'przerwano', - FAILED: 'zakończono niepowodzeniem', - SUCCESSFUL: 'sukces', + FAILED: 'nie powiodło się', + SUCCESSFUL: 'udane', SYSTEM: 'System', LOG: 'Log', STATUS: 'Status', - UPLOAD_DOWNLOAD: 'Wgraj/Zapisz', - SYSTEM_VERSION_RUNNING: 'Twoja obecna wersja oprogramowania to:', - SYSTEM_APPLY_FIRMWARE: 'do wgrania nowego oprogramowania wbudowanego', + UPLOAD_DOWNLOAD: 'Pliki', + SYSTEM_VERSION_RUNNING: 'Obecna wersja to:', + SYSTEM_APPLY_FIRMWARE: 'aby zaktualizować firmware', CLOSE: 'Zamknij', USE: 'Skorzystaj z', FACTORY_RESET: 'Ustawienia fabryczne', - SYSTEM_FACTORY_TEXT: 'Urządzenie zostało przywrócone do ustawień fabrycznych i zostanie teraz zrestartowane', - SYSTEM_FACTORY_TEXT_DIALOG: 'Czy jesteś pewien, że chcesz zresetować urządzenie do ustawień fabrycznych? ', - VERSION_CHECK: 'Sprawdź wersję oprogramowania wbudowanego', + SYSTEM_FACTORY_TEXT: 'Interfejs EMS-ESP został przywrócony do ustawień fabrycznych i zostanie teraz zrestartowany', + SYSTEM_FACTORY_TEXT_DIALOG: 'Czy jesteś pewien, że chcesz zresetować interfejs EMS-ESP do ustawień fabrycznych? ', + VERSION_CHECK: 'Firmware', THE_LATEST: 'Ostatnia', - VERSION_IS: 'version is', - PLATFORM: 'Urządzenie (Platforma/SDK)', + VERSION_IS: 'wersja to', + PLATFORM: 'Urządzenie (platforma / SDK)', UPTIME: 'Czas działania systemu', CPU_FREQ: 'Taktowanie procesora (CPU)', - HEAP: 'Pamięć (Wolna / Zaalokowana)', - PSRAM: 'PSRAM (Rozmiar / Wolna)', - FLASH: 'Pamięć flash ( Rozmiar / Taktowanie)', - APPSIZE: 'Application (Wykorzystano / Wolna)', - FILESYSTEM: 'System plików (Wykorzystano / Wolna)', + HEAP: 'Pamięć (wolne / zaalokowane)', + PSRAM: 'PSRAM (rozmiar / wolne)', + FLASH: 'Pamięć flash (rozmiar / taktowanie)', + APPSIZE: 'Aplikacja (wykorzystane / wolne)', + FILESYSTEM: 'System plików (wykorzystane / wolne)', BUFFER_SIZE: 'Rozmiar bufora', COMPACT: 'Kompaktowy', - ENABLE_OTA: 'Włącz aktualizację OTA', - DOWNLOAD_CUSTOMIZATION_TEXT: 'Ściągnij personalizacje', + ENABLE_OTA: 'Aktywuj aktualizacje OTA', + DOWNLOAD_CUSTOMIZATION_TEXT: 'Pobierz personalizacje', DOWNLOAD_SETTINGS_TEXT: - 'Ściągnij ustawienia aplikacji. Uważaj jeśli udostępniasz plik z ustawieniami, ponieważ zawiera on hasła oraz inne wrażliwe informacjie', - UPLOAD_TEXT: 'Wgraj nowe oprogramowanie układowe - firmware (.bin), ustawienia lub personalizacje (.json)', - UPLOADING: 'wgrywanie', + 'Pobierz ustawienia aplikacji. Uważaj jeśli udostępniasz plik z ustawieniami, ponieważ zawiera on hasła oraz inne wrażliwe informacje', + UPLOAD_TEXT: 'Wyślij firmware (.bin), ustawienia lub personalizacje (.json)', + UPLOADING: 'Wysłano', UPLOAD_DROP_TEXT: 'Przeciągnij plik lub kliknij', ERROR: 'Nieoczekiwany błąd, spróbuj ponownie', TIME_SET: 'Ustaw czas', @@ -206,47 +205,47 @@ const pl: BaseTranslation = { IS_ADMIN: 'Admin?', USER_WARNING: 'Przynajmniej jeden użytkownik musi mieć uprawnienia admina', ADD: 'Dodaj', - ACCESS_TOKEN_FOR: 'Token dostępowy dla', + ACCESS_TOKEN_FOR: 'Token dostępu dla', ACCESS_TOKEN_TEXT: 'Token jest używany do korzystania z wywołań REST API, wymagających autoryzacji. Można go przekazać bezpośrednio lub przez URL', - GENERATING_TOKEN: 'Genrowanie tokenu', + GENERATING_TOKEN: 'Generowanie tokenu', USER: 'Użytkownik', MODIFY: 'Modyfikuj', SU_TEXT: - 'Hasło Super Użytkownika jest wykorzystywane do autoryzacji tokenów oraz dostępu do konsoli z uprawnieniami admina', + 'Hasło su (super-użytkownika) jest wykorzystywane do autoryzacji tokenów oraz dostępu do konsoli z uprawnieniami admina', NOT_ENABLED: 'wyłączony', ERRORS: 'Błędy', - DISCONNECT_REASON: 'Powody rozłączenia', - ENABLE_MQTT: 'Włącz MQTT', + DISCONNECT_REASON: 'Powód rozłączenia', + ENABLE_MQTT: 'Aktywuj MQTT', OPTIONAL: 'opcjonalny', FORMATTING: 'Formatuj przesyłane dane', FORMAT: 'Format', MQTT_NEST_1: 'Zagnieżdzone w pojedyńczym temacie', MQTT_NEST_2: 'Jako indywidualne tematy', - MQTT_RESPONSE: 'Publikuj wyjścia jako tematy odpowiedzi', - MQTT_PUBLISH_TEXT_1: 'Publiku pojedyńcze wartości w temacie po zmianie', - MQTT_PUBLISH_TEXT_2: 'Publikuj tematy (ioBroker)', + MQTT_RESPONSE: 'Publikuj odpowiedzi na komendy w temacie "response"', + MQTT_PUBLISH_TEXT_1: 'Publikuj pojedyńcze wartości po zmianie', + MQTT_PUBLISH_TEXT_2: 'Publikuj w temacie "command" (ioBroker)', MQTT_PUBLISH_TEXT_3: 'Włącz opcję MQTT Discovery (Home Assistant, Domoticz)', - MQTT_PUBLISH_TEXT_4: 'Przedrostek do tematów "Discovery"', + MQTT_PUBLISH_TEXT_4: 'Przedrostek do tematów "discovery"', MQTT_PUBLISH_INTERVALS: 'Czas pomiędzy publikacjami', MQTT_INT_BOILER: 'Kotły i pompy ciepła', MQTT_INT_THERMOSTATS: 'Termostaty', MQTT_INT_SOLAR: 'Panele solarne', MQTT_INT_MIXER: 'Mieszacze', DEFAULT: 'Domyślnie', - MQTT_CLEAN_SESSION: 'Clean session', - MQTT_RETAIN_FLAG: 'Retain flag', + MQTT_CLEAN_SESSION: '"Clean session"', + MQTT_RETAIN_FLAG: 'Ustawiaj flagę "Retain"', INACTIVE: 'nieaktywny', ACTIVE: 'aktywny', UNKNOWN: 'nieznany', - SET_TIME: 'Ustawienia data/czas', - SET_TIME_TEXT: 'Wprowadź aktualną datę i czas', - LOCAL_TIME: 'czas lokalny', - UTC_TIME: 'czas UTC', - ENABLE_NTP: 'Włącz NTP', + SET_TIME: 'Ustaw datę i godzinę', + SET_TIME_TEXT: 'Wprowadź aktualną datę i godzinę', + LOCAL_TIME: 'Czas lokalny', + UTC_TIME: 'Czas UTC', + ENABLE_NTP: 'Aktywuj NTP (data i godzina będą synchronizowane z podanym serwerem czasu)', TIME_ZONE: 'Strefa czasowa', - ACCESS_POINT: 'Punkt Dostępowy', - AP_PROVIDE: 'Włącz tryb pracy jako punkt dostępowy (AP)', + ACCESS_POINT: 'Punkt dostępowy', + AP_PROVIDE: 'Aktywuj punkt dostępowy (AP)', AP_PROVIDE_TEXT_1: 'zawsze', AP_PROVIDE_TEXT_2: 'gdy połączenie WiFi jest rozłączone', AP_PROVIDE_TEXT_3: 'nigdy', @@ -259,20 +258,19 @@ const pl: BaseTranslation = { SCAN_AGAIN: 'Skanuj ponownie', NETWORK_SCANNER: 'Skaner sieci WiFi', NETWORK_NO_WIFI: 'Brak sieci WiFi w zasięgu', - NETWORK_BLANK_SSID: 'Zostaw puste aby wyłączyć WiFi', - POWER: 'Zasilanie', - NETWORK_DISABLE_SLEEP: 'Wyłącz tryb uśpienia WiFi', - // missing translation - NETWORK_LOW_BAND: 'Use Lower WiFi Bandwidth', + NETWORK_BLANK_SSID: 'pozostaw puste aby wyłączyć WiFi', + POWER: 'moc', + NETWORK_DISABLE_SLEEP: 'Wyłącz tryb usypiania WiFi', + NETWORK_LOW_BAND: 'Używaj zmniejszonej przepustowości WiFi', NETWORK_USE_DNS: 'Włącz wsparcie dla mDNS', NETWORK_ENABLE_IPV6: 'Włącz wsparcie dla IPv6', - NETWORK_FIXED_IP: 'Korzystaj ze stałego adresu IP', + NETWORK_FIXED_IP: 'Użyj stałego adresu IP', ADMIN: 'Admin', GUEST: 'Gość', NEW: 'Nowy', RENAME: 'Zmień nazwę', - ENTITY: 'Podmiot' + ENTITY: 'encji' }; export default pl; From 619dd0c99ddfac9137b23ed10f5302abe52aeea3 Mon Sep 17 00:00:00 2001 From: Proddy Date: Wed, 5 Oct 2022 12:24:31 +0200 Subject: [PATCH 24/28] merge https://github.com/emsesp/EMS-ESP32/pull/662 --- src/emsdevice.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index fdf302c56..fd79b764b 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -1336,6 +1336,9 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c json[name] = value_b; } else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) { json[name] = value_b ? 1 : 0; + } else { + char s[7]; + json[name] = Helpers::render_boolean(s, value_b); } } From a0a431e0e26f62819eaeeb44b223aeca1b574111 Mon Sep 17 00:00:00 2001 From: Proddy Date: Thu, 6 Oct 2022 17:08:57 +0200 Subject: [PATCH 25/28] merge https://github.com/emsesp/EMS-ESP32/pull/664 --- src/device_library.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/device_library.h b/src/device_library.h index 255d63c3d..13e019991 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -67,6 +67,7 @@ {207, DeviceType::CONTROLLER, "Sense II/CS200", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x10 {209, DeviceType::CONTROLLER, "ErP", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 {218, DeviceType::CONTROLLER, "M200/RFM200", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x50 +{220, DeviceType::CONTROLLER, "BC30", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x16 {224, DeviceType::CONTROLLER, "9000i", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 {229, DeviceType::CONTROLLER, "8700i", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 {230, DeviceType::CONTROLLER, "BC Base", DeviceFlags::EMS_DEVICE_FLAG_NONE}, // 0x09 From c90be992169d6830a4fa5653aaf7506832bb2118 Mon Sep 17 00:00:00 2001 From: Proddy Date: Thu, 6 Oct 2022 17:09:09 +0200 Subject: [PATCH 26/28] fix ha min/max --- src/devices/thermostat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 091df787e..ed9661696 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -3956,7 +3956,7 @@ void Thermostat::register_device_values_hc(std::shared_ptrselTemp, DeviceValueType::SHORT, seltemp_divider, FL_(selRoomTemp), DeviceValueUOM::DEGREES, MAKE_CF_CB(set_temp), 0, 30); } register_device_value(tag, &hc->roomTemp, DeviceValueType::SHORT, roomtemp_divider, FL_(roomTemp), DeviceValueUOM::DEGREES); - register_device_value(tag, &hc->climate, DeviceValueType::ENUM, FL_(enum_climate), FL_(climate), DeviceValueUOM::NONE); // min, max set in ha function + register_device_value(tag, &hc->climate, DeviceValueType::ENUM, FL_(enum_climate), FL_(climate), DeviceValueUOM::NONE, nullptr, 5, 30); switch (model) { case EMS_DEVICE_FLAG_RC10: From 5faffc3886332584bf7f93b7cf0e1bcabe5543d3 Mon Sep 17 00:00:00 2001 From: Proddy Date: Fri, 7 Oct 2022 20:26:17 +0200 Subject: [PATCH 27/28] upgrade axios --- interface/package-lock.json | 112 ++++++++++-------- interface/package.json | 8 +- interface/src/SignIn.tsx | 6 +- interface/src/api/endpoints.ts | 4 +- .../src/components/upload/SingleUpload.tsx | 14 +-- .../src/components/upload/useFileUpload.ts | 6 +- .../authentication/Authentication.tsx | 4 +- .../src/contexts/features/FeaturesLoader.tsx | 2 +- .../framework/network/WiFiNetworkScanner.tsx | 10 +- interface/src/framework/ntp/NTPStatusForm.tsx | 2 +- .../src/framework/security/GenerateToken.tsx | 2 +- .../framework/system/GeneralFileUpload.tsx | 4 +- .../src/framework/system/RestartMonitor.tsx | 2 +- interface/src/framework/system/SystemLog.tsx | 4 +- .../src/framework/system/SystemStatusForm.tsx | 4 +- interface/src/project/DashboardData.tsx | 14 +-- interface/src/project/DashboardStatus.tsx | 2 +- interface/src/project/HelpInformation.tsx | 2 +- interface/src/project/SettingsApplication.tsx | 4 +- .../src/project/SettingsCustomization.tsx | 8 +- interface/src/utils/endpoints.ts | 6 +- interface/src/utils/useRest.ts | 4 +- interface/tsconfig.json | 1 + 23 files changed, 116 insertions(+), 109 deletions(-) diff --git a/interface/package-lock.json b/interface/package-lock.json index 6e6893306..6d3cb8f47 100644 --- a/interface/package-lock.json +++ b/interface/package-lock.json @@ -13,14 +13,14 @@ "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.10.6", "@mui/material": "^5.10.8", - "@table-library/react-table-library": "4.0.18", + "@table-library/react-table-library": "4.0.23", "@types/lodash": "^4.14.186", - "@types/node": "^18.8.2", + "@types/node": "^18.8.3", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", "@types/react-router-dom": "^5.3.3", "async-validator": "^4.2.5", - "axios": "^0.27.2", + "axios": "^1.1.2", "http-proxy-middleware": "^2.0.6", "jwt-decode": "^3.1.2", "lodash": "^4.17.21", @@ -31,7 +31,7 @@ "react-dom": "^18.2.0", "react-dropzone": "^14.2.2", "react-icons": "^4.4.0", - "react-router-dom": "^6.4.1", + "react-router-dom": "^6.4.2", "react-scripts": "5.0.1", "sockette": "^2.0.6", "typesafe-i18n": "^5.14.0", @@ -3470,9 +3470,9 @@ } }, "node_modules/@remix-run/router": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.1.tgz", - "integrity": "sha512-eBV5rvW4dRFOU1eajN7FmYxjAIVz/mRHgUE9En9mBn6m3mulK3WTR5C3iQhL9MZ14rWAq+xOlEaCkDiW0/heOg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.2.tgz", + "integrity": "sha512-GRSOFhJzjGN+d4sKHTMSvNeUPoZiDHWmRnXfzaxrqe7dE/Nzlc8BiMSJdLDESZlndM7jIUrZ/F4yWqVYlI0rwQ==", "engines": { "node": ">=14" } @@ -3796,9 +3796,9 @@ } }, "node_modules/@table-library/react-table-library": { - "version": "4.0.18", - "resolved": "https://registry.npmjs.org/@table-library/react-table-library/-/react-table-library-4.0.18.tgz", - "integrity": "sha512-3GX5712YuWPFeUilr8UG22SCNR9BylD5Y4xPF+pHhb1QM7WXw6SLgpeGq6UDTQGOtmKtKtwKGWXdkmvVDg8pkA==", + "version": "4.0.23", + "resolved": "https://registry.npmjs.org/@table-library/react-table-library/-/react-table-library-4.0.23.tgz", + "integrity": "sha512-o2L/fqhwQNxsNbbm3LIiyZzEwaTslhG1tY9ArkYdS0xJyRhJxcOLfbJ3+dcnOOn+aIJpmPmQH+gr7RYJC0P8uw==", "dependencies": { "clsx": "1.1.1", "react-virtualized-auto-sizer": "1.0.6", @@ -4029,9 +4029,9 @@ "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" }, "node_modules/@types/node": { - "version": "18.8.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.2.tgz", - "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==" + "version": "18.8.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.3.tgz", + "integrity": "sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w==" }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -5008,12 +5008,13 @@ } }, "node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz", + "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==", "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/axobject-query": { @@ -14147,6 +14148,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", @@ -14545,11 +14551,11 @@ } }, "node_modules/react-router": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.1.tgz", - "integrity": "sha512-OJASKp5AykDWFewgWUim1vlLr7yfD4vO/h+bSgcP/ix8Md+LMHuAjovA74MQfsfhQJGGN1nHRhwS5qQQbbBt3A==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.2.tgz", + "integrity": "sha512-Rb0BAX9KHhVzT1OKhMvCDMw776aTYM0DtkxqUBP8dNBom3mPXlfNs76JNGK8wKJ1IZEY1+WGj+cvZxHVk/GiKw==", "dependencies": { - "@remix-run/router": "1.0.1" + "@remix-run/router": "1.0.2" }, "engines": { "node": ">=14" @@ -14559,12 +14565,12 @@ } }, "node_modules/react-router-dom": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.1.tgz", - "integrity": "sha512-MY7NJCrGNVJtGp8ODMOBHu20UaIkmwD2V3YsAOUQoCXFk7Ppdwf55RdcGyrSj+ycSL9Uiwrb3gTLYSnzcRoXww==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.2.tgz", + "integrity": "sha512-yM1kjoTkpfjgczPrcyWrp+OuQMyB1WleICiiGfstnQYo/S8hPEEnVjr/RdmlH6yKK4Tnj1UGXFSa7uwAtmDoLQ==", "dependencies": { - "@remix-run/router": "1.0.1", - "react-router": "6.4.1" + "@remix-run/router": "1.0.2", + "react-router": "6.4.2" }, "engines": { "node": ">=14" @@ -19819,9 +19825,9 @@ "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==" }, "@remix-run/router": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.1.tgz", - "integrity": "sha512-eBV5rvW4dRFOU1eajN7FmYxjAIVz/mRHgUE9En9mBn6m3mulK3WTR5C3iQhL9MZ14rWAq+xOlEaCkDiW0/heOg==" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.0.2.tgz", + "integrity": "sha512-GRSOFhJzjGN+d4sKHTMSvNeUPoZiDHWmRnXfzaxrqe7dE/Nzlc8BiMSJdLDESZlndM7jIUrZ/F4yWqVYlI0rwQ==" }, "@rollup/plugin-babel": { "version": "5.3.1", @@ -20018,9 +20024,9 @@ } }, "@table-library/react-table-library": { - "version": "4.0.18", - "resolved": "https://registry.npmjs.org/@table-library/react-table-library/-/react-table-library-4.0.18.tgz", - "integrity": "sha512-3GX5712YuWPFeUilr8UG22SCNR9BylD5Y4xPF+pHhb1QM7WXw6SLgpeGq6UDTQGOtmKtKtwKGWXdkmvVDg8pkA==", + "version": "4.0.23", + "resolved": "https://registry.npmjs.org/@table-library/react-table-library/-/react-table-library-4.0.23.tgz", + "integrity": "sha512-o2L/fqhwQNxsNbbm3LIiyZzEwaTslhG1tY9ArkYdS0xJyRhJxcOLfbJ3+dcnOOn+aIJpmPmQH+gr7RYJC0P8uw==", "requires": { "clsx": "1.1.1", "react-virtualized-auto-sizer": "1.0.6", @@ -20233,9 +20239,9 @@ "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==" }, "@types/node": { - "version": "18.8.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.2.tgz", - "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==" + "version": "18.8.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.8.3.tgz", + "integrity": "sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w==" }, "@types/parse-json": { "version": "4.0.0", @@ -20973,12 +20979,13 @@ "integrity": "sha512-32+ub6kkdhhWick/UjvEwRchgoetXqTK14INLqbGm5U2TzBkBNF3nQtLYm8ovxSkQWArjEQvftCKryjZaATu3w==" }, "axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.2.tgz", + "integrity": "sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==", "requires": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "axobject-query": { @@ -27407,6 +27414,11 @@ } } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", @@ -27692,20 +27704,20 @@ "integrity": "sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==" }, "react-router": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.1.tgz", - "integrity": "sha512-OJASKp5AykDWFewgWUim1vlLr7yfD4vO/h+bSgcP/ix8Md+LMHuAjovA74MQfsfhQJGGN1nHRhwS5qQQbbBt3A==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.4.2.tgz", + "integrity": "sha512-Rb0BAX9KHhVzT1OKhMvCDMw776aTYM0DtkxqUBP8dNBom3mPXlfNs76JNGK8wKJ1IZEY1+WGj+cvZxHVk/GiKw==", "requires": { - "@remix-run/router": "1.0.1" + "@remix-run/router": "1.0.2" } }, "react-router-dom": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.1.tgz", - "integrity": "sha512-MY7NJCrGNVJtGp8ODMOBHu20UaIkmwD2V3YsAOUQoCXFk7Ppdwf55RdcGyrSj+ycSL9Uiwrb3gTLYSnzcRoXww==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.4.2.tgz", + "integrity": "sha512-yM1kjoTkpfjgczPrcyWrp+OuQMyB1WleICiiGfstnQYo/S8hPEEnVjr/RdmlH6yKK4Tnj1UGXFSa7uwAtmDoLQ==", "requires": { - "@remix-run/router": "1.0.1", - "react-router": "6.4.1" + "@remix-run/router": "1.0.2", + "react-router": "6.4.2" } }, "react-scripts": { diff --git a/interface/package.json b/interface/package.json index 1b97bef90..9a00a3cde 100644 --- a/interface/package.json +++ b/interface/package.json @@ -9,14 +9,14 @@ "@msgpack/msgpack": "^2.8.0", "@mui/icons-material": "^5.10.6", "@mui/material": "^5.10.8", - "@table-library/react-table-library": "4.0.18", + "@table-library/react-table-library": "4.0.23", "@types/lodash": "^4.14.186", - "@types/node": "^18.8.2", + "@types/node": "^18.8.3", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", "@types/react-router-dom": "^5.3.3", "async-validator": "^4.2.5", - "axios": "^0.27.2", + "axios": "^1.1.2", "http-proxy-middleware": "^2.0.6", "jwt-decode": "^3.1.2", "lodash": "^4.17.21", @@ -27,7 +27,7 @@ "react-dom": "^18.2.0", "react-dropzone": "^14.2.2", "react-icons": "^4.4.0", - "react-router-dom": "^6.4.1", + "react-router-dom": "^6.4.2", "react-scripts": "5.0.1", "sockette": "^2.0.6", "typesafe-i18n": "^5.14.0", diff --git a/interface/src/SignIn.tsx b/interface/src/SignIn.tsx index 297658e0e..3467a48d0 100644 --- a/interface/src/SignIn.tsx +++ b/interface/src/SignIn.tsx @@ -9,8 +9,6 @@ import * as AuthenticationApi from './api/authentication'; import { PROJECT_NAME } from './api/env'; import { AuthenticationContext } from './contexts/authentication'; -import { AxiosError } from 'axios'; - import { extractErrorMessage, onEnterCallback, updateValue } from './utils'; import { SignInRequest } from './types'; import { ValidatedTextField } from './components'; @@ -56,8 +54,8 @@ const SignIn: FC = () => { try { const { data: loginResponse } = await AuthenticationApi.signIn(signInRequest); authenticationContext.signIn(loginResponse.access_token); - } catch (error: unknown) { - if (error instanceof AxiosError) { + } catch (error) { + if (error.response) { if (error.response?.status === 401) { enqueueSnackbar(LL.INVALID_LOGIN(), { variant: 'warning' }); } diff --git a/interface/src/api/endpoints.ts b/interface/src/api/endpoints.ts index 4c68bcaf1..4516fbc8f 100644 --- a/interface/src/api/endpoints.ts +++ b/interface/src/api/endpoints.ts @@ -1,4 +1,4 @@ -import axios, { AxiosPromise, CancelToken } from 'axios'; +import axios, { AxiosPromise, CancelToken, AxiosProgressEvent } from 'axios'; import { decode } from '@msgpack/msgpack'; @@ -89,7 +89,7 @@ function calculateEventSourceRoot(endpointPath: string) { export interface FileUploadConfig { cancelToken?: CancelToken; - onUploadProgress?: (progressEvent: ProgressEvent) => void; + onUploadProgress?: (progressEvent: AxiosProgressEvent) => void; } export const startUploadFile = (url: string, file: File, config?: FileUploadConfig): AxiosPromise => { diff --git a/interface/src/components/upload/SingleUpload.tsx b/interface/src/components/upload/SingleUpload.tsx index d4e4e3c3d..ccf8bfed3 100644 --- a/interface/src/components/upload/SingleUpload.tsx +++ b/interface/src/components/upload/SingleUpload.tsx @@ -1,6 +1,8 @@ import { FC, Fragment } from 'react'; import { useDropzone, DropzoneState } from 'react-dropzone'; +import { AxiosProgressEvent } from 'axios'; + import { Box, Button, LinearProgress, Theme, Typography, useTheme } from '@mui/material'; import CloudUploadIcon from '@mui/icons-material/CloudUpload'; @@ -8,8 +10,6 @@ import CancelIcon from '@mui/icons-material/Cancel'; import { useI18nContext } from '../../i18n/i18n-react'; -const progressPercentage = (progress: ProgressEvent) => Math.round((progress.loaded * 100) / progress.total); - const getBorderColor = (theme: Theme, props: DropzoneState) => { if (props.isDragAccept) { return theme.palette.success.main; @@ -27,7 +27,7 @@ export interface SingleUploadProps { onDrop: (acceptedFiles: File[]) => void; onCancel: () => void; uploading: boolean; - progress?: ProgressEvent; + progress?: AxiosProgressEvent; } const SingleUpload: FC = ({ onDrop, onCancel, uploading, progress }) => { @@ -47,8 +47,8 @@ const SingleUpload: FC = ({ onDrop, onCancel, uploading, prog const progressText = () => { if (uploading) { - if (progress?.lengthComputable) { - return LL.UPLOADING() + `: ${progressPercentage(progress)}%`; + if (progress?.total) { + return LL.UPLOADING() + ': ' + Math.round((progress.loaded * 100) / progress.total) + '%'; } return LL.UPLOADING() + `\u2026`; } @@ -80,8 +80,8 @@ const SingleUpload: FC = ({ onDrop, onCancel, uploading, prog + + #endif +#endif #include diff --git a/src/dallassensor.cpp b/src/dallassensor.cpp index ce619d9a1..a22ff566f 100644 --- a/src/dallassensor.cpp +++ b/src/dallassensor.cpp @@ -360,14 +360,15 @@ bool DallasSensor::command_info(const char * value, const int8_t id, JsonObject } for (const auto & sensor : sensors_) { + char val[10]; if (id == -1) { // show number and id JsonObject dataSensor = output.createNestedObject(sensor.name()); dataSensor["id"] = sensor.id(); if (Helpers::hasValue(sensor.temperature_c)) { - dataSensor["temp"] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + dataSensor["temp"] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } } else if (Helpers::hasValue(sensor.temperature_c)) { - output[sensor.name()] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + output[sensor.name()] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } } @@ -392,14 +393,18 @@ bool DallasSensor::get_value_info(JsonObject & output, const char * cmd, const i if (strcmp(command_s, sensor.name().c_str()) == 0) { output["id"] = sensor.id(); output["name"] = sensor.name(); + char val[10]; + if (Helpers::hasValue(sensor.temperature_c)) { - output["value"] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + output["value"] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } + output["type"] = F_(number); - output["min"] = Helpers::transformNumFloat(-55, 0, EMSESP::system_.fahrenheit() ? 2 : 0); - output["max"] = Helpers::transformNumFloat(125, 0, EMSESP::system_.fahrenheit() ? 2 : 0); + output["min"] = serialized(Helpers::render_value(val, -55, 0, EMSESP::system_.fahrenheit() ? 2 : 0)); + output["max"] = serialized(Helpers::render_value(val, 125, 0, EMSESP::system_.fahrenheit() ? 2 : 0)); output["uom"] = EMSdevice::uom_to_string(DeviceValueUOM::DEGREES); output["writeable"] = false; + // if we're filtering on an attribute, go find it if (attribute_s) { if (output.containsKey(attribute_s)) { @@ -469,14 +474,15 @@ void DallasSensor::publish_values(const bool force) { for (auto & sensor : sensors_) { bool has_value = Helpers::hasValue(sensor.temperature_c); + char val[10]; if (Mqtt::is_nested()) { JsonObject dataSensor = doc.createNestedObject(sensor.id()); dataSensor["name"] = sensor.name(); if (has_value) { - dataSensor["temp"] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + dataSensor["temp"] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } } else if (has_value) { - doc[sensor.name()] = Helpers::transformNumFloat((float)(sensor.temperature_c), 10, EMSESP::system_.fahrenheit() ? 2 : 0); + doc[sensor.name()] = serialized(Helpers::render_value(val, sensor.temperature_c, 10, EMSESP::system_.fahrenheit() ? 2 : 0)); } // create the HA MQTT config diff --git a/src/device_library.h b/src/device_library.h index 13e019991..356353f78 100644 --- a/src/device_library.h +++ b/src/device_library.h @@ -110,6 +110,7 @@ {109, DeviceType::THERMOSTAT, "FB10", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, {110, DeviceType::THERMOSTAT, "FB100", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, {111, DeviceType::THERMOSTAT, "FR10", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model +{116, DeviceType::THERMOSTAT, "FW500", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, {147, DeviceType::THERMOSTAT, "FR50", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, {191, DeviceType::THERMOSTAT, "FR120", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS | DeviceFlags::EMS_DEVICE_FLAG_JUNKERS_OLD}, // older model {192, DeviceType::THERMOSTAT, "FW120", DeviceFlags::EMS_DEVICE_FLAG_JUNKERS}, diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index ed9661696..243ba52b3 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -680,13 +680,19 @@ void Thermostat::process_JunkersSet(std::shared_ptr telegram) { return; } - has_update(telegram, hc->daytemp, 17); // is * 2 - has_update(telegram, hc->nighttemp, 16); // is * 2 - has_update(telegram, hc->nofrosttemp, 15); // is * 2 - has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100 - has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,... - has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto - has_update(telegram, hc->roomsensor, 9); // 1-intern, 2-extern, 3-autoselect the lower value + has_update(telegram, hc->daytemp, 17); // is * 2 + has_update(telegram, hc->nighttemp, 16); // is * 2 + has_update(telegram, hc->nofrosttemp, 15); // is * 2 + has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100 + has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,... + has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto + has_update(telegram, hc->daytemp, 17); // is * 2 + has_update(telegram, hc->nighttemp, 16); // is * 2 + has_update(telegram, hc->nofrosttemp, 15); // is * 2 + has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100 + has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,... + has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto + has_enumupdate(telegram, hc->roomsensor, 9, 1); // 1-intern, 2-extern, 3-autoselect the lower value } // type 0x0179, ff @@ -1364,10 +1370,12 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { strftime(newdatetime, sizeof(dateTime_), "%d.%m.%G %H:%M", tm_); has_update(dateTime_, newdatetime, sizeof(dateTime_)); - bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439 - time_t ttime = mktime(tm_); // thermostat time + bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439 + bool junkersclock = model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS; + time_t ttime = mktime(tm_); // thermostat time + // correct thermostat clock if we have valid ntp time, and could write the command - if (!ivtclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) { + if (!ivtclock && !junkersclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) { double difference = difftime(now, ttime); if (difference > 15 || difference < -15) { set_datetime("ntp", -1); // set from NTP @@ -1717,7 +1725,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) { uint8_t ctrl = 0; if (model() == EMS_DEVICE_FLAG_JUNKERS && !has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) { if (Helpers::value2enum(value, ctrl, FL_(enum_roomsensor))) { - write_command(set_typeids[hc->hc()], 9, ctrl); + write_command(set_typeids[hc->hc()], 9, ctrl + 1); return true; } } @@ -2165,6 +2173,10 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { data[5] = tm_->tm_sec; data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su data[7] = tm_->tm_isdst + 2; // set DST and flag for ext. clock + if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { + data[6]++; // Junkers use 1-7; + data[7] = 0; + } } else if (dt.length() == 23) { data[0] = (dt[7] - '0') * 100 + (dt[8] - '0') * 10 + (dt[9] - '0'); // year data[1] = (dt[3] - '0') * 10 + (dt[4] - '0'); // month @@ -2174,6 +2186,9 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { data[5] = (dt[17] - '0') * 10 + (dt[18] - '0'); // sec data[6] = (dt[20] - '0'); // day of week, Mo:0 data[7] = (dt[22] - '0') + 2; // DST and flag + if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { + data[7] = 0; + } } else { LOG_WARNING("Set date: invalid data, wrong length"); return false; @@ -3846,8 +3861,9 @@ void Thermostat::register_device_values() { MAKE_CF_CB(set_wwVacation)); break; case EMS_DEVICE_FLAG_JUNKERS: + // FR100 is not writable, see. https://github.com/emsesp/EMS-ESP32/issues/536 + // FW500 is not writable, see. https://github.com/emsesp/EMS-ESP32/issues/666 if (has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) { - // FR100 is not writable, see. https://github.com/emsesp/EMS-ESP32/issues/536 register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, &dateTime_, DeviceValueType::STRING, FL_(tpl_datetime), FL_(dateTime), DeviceValueUOM::NONE); } else { register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index fd79b764b..6ae24786e 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -790,9 +790,9 @@ void EMSdevice::generate_values_web(JsonObject & output) { } else if ((dv.type == DeviceValueType::USHORT) && Helpers::hasValue(*(uint16_t *)(dv.value_p))) { obj["v"] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if ((dv.type == DeviceValueType::ULONG) && Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator, fahrenheit); + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } else if ((dv.type == DeviceValueType::TIME) && Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - obj["v"] = dv.numeric_operator ? (*(uint32_t *)(dv.value_p) / dv.numeric_operator) : *(uint32_t *)(dv.value_p); + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } else { obj["v"] = ""; // must have a value for sorting to work } @@ -891,40 +891,18 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) { // handle Integers and Floats else { - int8_t num_op = dv.numeric_operator; - bool make_float; - if (num_op == 0) { - // no changes to number - make_float = false; - num_op = 1; // so it gets *1 - } else if (num_op < 0) { - // negative numbers, convert to a positive multiplier - make_float = false; - num_op *= -1; - } else { - // has a divider, make it a float - make_float = true; - } - - // always convert temperatures to floats with 1 decimal place - if ((dv.uom == DeviceValueUOM::DEGREES) || (dv.uom == DeviceValueUOM::DEGREES_R)) { - make_float = true; - } - if (dv.type == DeviceValueType::INT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(int8_t *)(dv.value_p), num_op, fahrenheit) : *(int8_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(int8_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::UINT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), num_op, fahrenheit) : *(uint8_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::SHORT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(int16_t *)(dv.value_p), num_op, fahrenheit) : *(int16_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(int16_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::USHORT) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), num_op, fahrenheit) : *(uint16_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit); } else if (dv.type == DeviceValueType::ULONG) { - obj["v"] = make_float ? Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op) : *(uint32_t *)(dv.value_p) * num_op; + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } else if (dv.type == DeviceValueType::TIME) { - // sometimes we need to divide by 60 - obj["v"] = (num_op == DeviceValueNumOp::DV_NUMOP_DIV60) ? (uint32_t)Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op) - : *(uint32_t *)(dv.value_p); + obj["v"] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), dv.numeric_operator); } } } @@ -1091,8 +1069,6 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 // search device value with this tag for (auto & dv : devicevalues_) { if (!strcmp(command_s, dv.short_name) && (tag <= 0 || tag == dv.tag)) { - int8_t num_op = dv.numeric_operator; - uint8_t fahrenheit = !EMSESP::system_.fahrenheit() ? 0 : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; const char * type = "type"; @@ -1113,6 +1089,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 json["circuit"] = tag_to_mqtt(dv.tag); } + char val[10]; switch (dv.type) { case DeviceValueType::ENUM: { if (*(uint8_t *)(dv.value_p) < dv.options_size) { @@ -1132,35 +1109,35 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 case DeviceValueType::USHORT: if (Helpers::hasValue(*(uint16_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::UINT: if (Helpers::hasValue(*(uint8_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(uint8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::SHORT: if (Helpers::hasValue(*(int16_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(int16_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(int16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::INT: if (Helpers::hasValue(*(int8_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(int8_t *)(dv.value_p), num_op, fahrenheit); + json[value] = serialized(Helpers::render_value(val, *(int8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } json[type] = F_(number); break; case DeviceValueType::ULONG: if (Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op); + json[value] = serialized(Helpers::render_value(val, *(uint32_t *)(dv.value_p), dv.numeric_operator)); } json[type] = F_(number); break; @@ -1182,7 +1159,7 @@ bool EMSdevice::get_value_info(JsonObject & output, const char * cmd, const int8 case DeviceValueType::TIME: if (Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - json[value] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op); + json[value] = serialized(Helpers::render_value(val, *(uint32_t *)(dv.value_p), dv.numeric_operator)); } json[type] = F_(number); break; @@ -1364,64 +1341,22 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c : (dv.uom == DeviceValueUOM::DEGREES) ? 2 : (dv.uom == DeviceValueUOM::DEGREES_R) ? 1 : 0; - - int8_t num_op = dv.numeric_operator; - bool make_float; - if (num_op == 0) { - // no changes to number - make_float = false; - num_op = 1; // so it gets *1 - } else if (num_op < 0) { - // negative numbers, convert to a positive multiplier - make_float = false; - num_op *= -1; - } else { - // has a divider, make it a float - make_float = true; - } - - // always convert temperatures to floats with 1 decimal place - if ((dv.uom == DeviceValueUOM::DEGREES) || (dv.uom == DeviceValueUOM::DEGREES_R)) { - make_float = true; - } + char val[10]; if (dv.type == DeviceValueType::INT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(int8_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(int8_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(int8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::UINT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(uint8_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(uint8_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(uint8_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::SHORT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(int16_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(int16_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(int16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::USHORT) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(uint16_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(uint16_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(uint16_t *)(dv.value_p), dv.numeric_operator, fahrenheit)); } else if (dv.type == DeviceValueType::ULONG) { - if (make_float) { - json[name] = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op, fahrenheit); - } else { - json[name] = *(uint32_t *)(dv.value_p) * num_op; - } + json[name] = serialized(Helpers::render_value(val, *(uint32_t *)(dv.value_p), dv.numeric_operator)); } else if ((dv.type == DeviceValueType::TIME) && Helpers::hasValue(*(uint32_t *)(dv.value_p))) { - uint32_t time_value; - if (num_op == DeviceValueNumOp::DV_NUMOP_DIV60) { - // sometimes we need to divide by 60 - time_value = Helpers::transformNumFloat(*(uint32_t *)(dv.value_p), num_op); - } else { - time_value = *(uint32_t *)(dv.value_p); + uint32_t time_value = *(uint32_t *)(dv.value_p); + if (dv.numeric_operator == DeviceValueNumOp::DV_NUMOP_DIV60) { + time_value /= 60; // sometimes we need to divide by 60 } if (output_target == OUTPUT_TARGET::API_VERBOSE || output_target == OUTPUT_TARGET::CONSOLE) { char time_s[60]; diff --git a/src/system.h b/src/system.h index 0c8330e67..df26f7920 100644 --- a/src/system.h +++ b/src/system.h @@ -29,7 +29,9 @@ #ifndef EMSESP_STANDALONE #include +#ifndef ARDUINO_LOLIN_S2_MINI #include +#endif #include #include #endif diff --git a/src/uart/emsuart_esp32.h b/src/uart/emsuart_esp32.h index a882d6727..b902a38eb 100644 --- a/src/uart/emsuart_esp32.h +++ b/src/uart/emsuart_esp32.h @@ -26,8 +26,8 @@ #define EMS_MAXBUFFERSIZE 33 // max size of the buffer. EMS packets are max 32 bytes, plus extra for BRK -#ifdef ARDUINO_LOLIN_C3_MINI -#define EMSUART_NUM UART_NUM_1 // on C3 mini we're using UART1 +#if (defined(ARDUINO_LOLIN_C3_MINI)) || (defined(ARDUINO_LOLIN_S2_MINI)) +#define EMSUART_NUM UART_NUM_1 // on C3 and S2 we're using UART1 #else #define EMSUART_NUM UART_NUM_2 // on the ESP32 we're using UART2 #endif