mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-13 13:44:10 +00:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -22,3 +22,4 @@ firmware
|
||||
/lib/framework/WWWData.h
|
||||
/interface/build/
|
||||
/interface/node_modules/
|
||||
.VSCodeCounter/
|
||||
|
||||
@@ -84,12 +84,12 @@ void DallasSensor::loop() {
|
||||
bus_.reset_search();
|
||||
state_ = State::SCANNING;
|
||||
} else if (time_now - last_activity_ > READ_TIMEOUT_MS) {
|
||||
LOG_ERROR(F("Sensor read timeout"));
|
||||
LOG_WARNING(F("Dallas sensor read timeout"));
|
||||
state_ = State::IDLE;
|
||||
}
|
||||
} else if (state_ == State::SCANNING) {
|
||||
if (time_now - last_activity_ > SCAN_TIMEOUT_MS) {
|
||||
LOG_ERROR(F("Sensor scan timeout"));
|
||||
LOG_ERROR(F("Dallas sensor scan timeout"));
|
||||
state_ = State::IDLE;
|
||||
} else {
|
||||
uint8_t addr[ADDR_LEN] = {0};
|
||||
@@ -129,11 +129,11 @@ void DallasSensor::loop() {
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR(F("Unknown sensor %s"), Sensor(addr).to_string().c_str());
|
||||
LOG_ERROR(F("Unknown dallas sensor %s"), Sensor(addr).to_string().c_str());
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR(F("Invalid sensor %s"), Sensor(addr).to_string().c_str());
|
||||
LOG_ERROR(F("Invalid dallas sensor %s"), Sensor(addr).to_string().c_str());
|
||||
}
|
||||
} else {
|
||||
if (!parasite_) {
|
||||
|
||||
+2
-1
@@ -43,6 +43,7 @@ class EMSdevice {
|
||||
, name_(name)
|
||||
, flags_(flags)
|
||||
, brand_(brand) {
|
||||
unique_id_++;
|
||||
}
|
||||
|
||||
virtual ~EMSdevice() = default; // destructor of base class must always be virtual because it's a polymorphic class
|
||||
@@ -270,7 +271,7 @@ class EMSdevice {
|
||||
static constexpr uint8_t EMS_DEVICE_FLAG_JUNKERS_2 = (1 << 6); // 6th bit set if older models, like FR120, FR100
|
||||
|
||||
private:
|
||||
uint8_t unique_id_;
|
||||
uint8_t unique_id_ = 0;
|
||||
uint8_t device_type_ = DeviceType::SYSTEM;
|
||||
uint8_t device_id_ = 0;
|
||||
uint8_t product_id_ = 0;
|
||||
|
||||
+6
-5
@@ -63,7 +63,6 @@ bool EMSESP::read_next_ = false;
|
||||
uint16_t EMSESP::publish_id_ = 0;
|
||||
bool EMSESP::tap_water_active_ = false; // for when Boiler states we having running warm water. used in Shower()
|
||||
uint32_t EMSESP::last_fetch_ = 0;
|
||||
uint8_t EMSESP::unique_id_count_ = 0;
|
||||
uint8_t EMSESP::publish_all_idx_ = 0;
|
||||
|
||||
// for a specific EMS device go and request data values
|
||||
@@ -768,17 +767,19 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
|
||||
return false; // not found
|
||||
}
|
||||
|
||||
std::string name = uuid::read_flash_string(device_p->name);
|
||||
emsdevices.push_back(EMSFactory::add(device_p->device_type, device_id, device_p->product_id, version, name, device_p->flags, brand));
|
||||
emsdevices.back()->unique_id(++unique_id_count_);
|
||||
auto name = uuid::read_flash_string(device_p->name);
|
||||
auto device_type = device_p->device_type;
|
||||
auto flags = device_p->flags;
|
||||
LOG_DEBUG(F("Adding new device %s (device ID 0x%02X, product ID %d, version %s)"), name.c_str(), device_id, product_id, version.c_str());
|
||||
emsdevices.push_back(EMSFactory::add(device_type, device_id, product_id, version, name, flags, brand));
|
||||
|
||||
fetch_device_values(device_id); // go and fetch its data
|
||||
|
||||
// add info command, but not for all devices
|
||||
uint8_t device_type = device_p->device_type;
|
||||
if ((device_type == DeviceType::CONNECT) || (device_type == DeviceType::CONTROLLER) || (device_type == DeviceType::GATEWAY)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Command::add_with_json(device_type, F_(info), [device_type](const char * value, const int8_t id, JsonObject & json) {
|
||||
return command_info(device_type, json);
|
||||
});
|
||||
|
||||
+1
-1
@@ -207,8 +207,8 @@ class EMSESP {
|
||||
static bool read_next_;
|
||||
static uint16_t publish_id_;
|
||||
static bool tap_water_active_;
|
||||
static uint8_t unique_id_count_;
|
||||
static uint8_t publish_all_idx_;
|
||||
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
+3
-1
@@ -28,7 +28,9 @@ void Shower::start() {
|
||||
shower_alert_ = settings.shower_alert;
|
||||
});
|
||||
|
||||
send_mqtt_stat(false); // send first MQTT publish
|
||||
if (Mqtt::enabled()) {
|
||||
send_mqtt_stat(false); // send first MQTT publish
|
||||
}
|
||||
}
|
||||
|
||||
void Shower::loop() {
|
||||
|
||||
+74
-101
@@ -27,10 +27,10 @@ namespace emsesp {
|
||||
// used with the 'test' command, under su/admin
|
||||
void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
// switch to su
|
||||
shell.add_flags(CommandFlags::ADMIN);
|
||||
// shell.add_flags(CommandFlags::ADMIN);
|
||||
|
||||
if (command == "default") {
|
||||
run_test(shell, "general"); // add the default test case here
|
||||
run_test(shell, "boiler"); // add the default test case here
|
||||
}
|
||||
|
||||
if (command.empty()) {
|
||||
@@ -38,6 +38,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
}
|
||||
|
||||
if (command == "render") {
|
||||
shell.printfln(F("Testing render..."));
|
||||
|
||||
uint8_t test1 = 12;
|
||||
int8_t test2 = -12;
|
||||
uint16_t test3 = 456;
|
||||
@@ -133,6 +135,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
}
|
||||
|
||||
if (command == "devices") {
|
||||
shell.printfln(F("Testing devices..."));
|
||||
|
||||
EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS); // this is important otherwise nothing will be picked up!
|
||||
|
||||
//emsdevices.push_back(EMSFactory::add(EMSdevice::DeviceType::BOILER, EMSdevice::EMS_DEVICE_ID_BOILER, 0, "", "My Boiler", 0, 0));
|
||||
@@ -141,39 +145,29 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
rx_telegram({0x08, 0x00, 0x07, 0x00, 0x0B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
|
||||
}
|
||||
|
||||
if (command == "boiler") {
|
||||
// question: do we need to set the mask?
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x08, 123, version, EMSdevice::Brand::BUDERUS); // Nefit Trendline
|
||||
|
||||
// UBAuptime
|
||||
uart_telegram({0x08, 0x0B, 0x14, 00, 0x3C, 0x1F, 0xAC, 0x70});
|
||||
|
||||
shell.invoke_command("show");
|
||||
shell.invoke_command("call boiler info");
|
||||
}
|
||||
|
||||
// check for boiler and controller on same product_id
|
||||
if (command == "double") {
|
||||
// question: do we need to set the mask?
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x08, 206, version, EMSdevice::Brand::BUDERUS); // Nefit Excellent HR30
|
||||
EMSESP::add_device(0x09, 206, version, EMSdevice::Brand::BUDERUS); // Nefit Excellent HR30 Controller
|
||||
shell.printfln(F("Testing double..."));
|
||||
|
||||
add_device(0x08, 206); // Nefit Excellent HR30
|
||||
add_device(0x09, 206); // Nefit Excellent HR30 Controller
|
||||
|
||||
// UBAuptime
|
||||
uart_telegram({0x08, 0x0B, 0x14, 00, 0x3C, 0x1F, 0xAC, 0x70});
|
||||
}
|
||||
|
||||
// unknown device -
|
||||
// unknown device
|
||||
if (command == "unknown") {
|
||||
shell.printfln(F("Testing unknown..."));
|
||||
|
||||
// question: do we need to set the mask?
|
||||
std::string version("1.2.3");
|
||||
|
||||
// add boiler
|
||||
EMSESP::add_device(0x08, 84, version, EMSdevice::Brand::BUDERUS);
|
||||
add_device(0x08, 84);
|
||||
|
||||
// add Controller - BC10 GB142 - but using the same device_id to see what happens
|
||||
EMSESP::add_device(0x09, 84, version, EMSdevice::Brand::BUDERUS);
|
||||
// add Controller - BC10 GB142 - but using the same product_id to see what happens
|
||||
add_device(0x09, 84);
|
||||
|
||||
// simulate getting version information back from an unknown device
|
||||
// note there is no brand (byte 9)
|
||||
@@ -184,11 +178,15 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
}
|
||||
|
||||
if (command == "unknown2") {
|
||||
shell.printfln(F("Testing unknown2..."));
|
||||
|
||||
// simulate getting version information back from an unknown device
|
||||
rx_telegram({0x09, 0x0B, 0x02, 0x00, 0x5A, 0x01, 0x02}); // product id is 90 which doesn't exist
|
||||
}
|
||||
|
||||
if (command == "gateway") {
|
||||
shell.printfln(F("Testing Gateway..."));
|
||||
|
||||
// add 0x48 KM200, via a version command
|
||||
rx_telegram({0x48, 0x0B, 0x02, 0x00, 0xBD, 0x04, 0x06, 00, 00, 00, 00, 00, 00, 00});
|
||||
|
||||
@@ -197,8 +195,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
rx_telegram({0x08, 0x00, 0x07, 0x00, 0x09, 01, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00, 00});
|
||||
|
||||
// add thermostat - Thermostat: RC300/RC310/Moduline 3000/CW400/Sense II (DeviceID:0x10, ProductID:158, Version:03.03) ** master device **
|
||||
std::string version("01.03");
|
||||
EMSESP::add_device(0x10, 158, version, EMSdevice::Brand::BUDERUS);
|
||||
add_device(0x10, 158); // Nefit Trendline
|
||||
|
||||
// simulate incoming telegram
|
||||
// Thermostat(0x10) -> 48(0x48), ?(0x26B), data: 6B 08 4F 00 00 00 02 00 00 00 02 00 03 00 03 00 03
|
||||
@@ -208,9 +205,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
if (command == "web") {
|
||||
shell.printfln(F("Testing Web..."));
|
||||
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x08, 123, version, EMSdevice::Brand::BUDERUS); // Nefit Trendline
|
||||
EMSESP::add_device(0x18, 157, version, EMSdevice::Brand::BOSCH); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
add_device(0x18, 157); // Bosch CR100
|
||||
|
||||
// add some data
|
||||
// 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)
|
||||
@@ -238,13 +234,23 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
shell.println();
|
||||
}
|
||||
|
||||
if (command == "boiler") {
|
||||
shell.printfln(F("Testing boiler..."));
|
||||
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
|
||||
// UBAuptime
|
||||
uart_telegram({0x08, 0x0B, 0x14, 00, 0x3C, 0x1F, 0xAC, 0x70});
|
||||
|
||||
shell.invoke_command("show");
|
||||
shell.invoke_command("call boiler info");
|
||||
}
|
||||
|
||||
if (command == "general") {
|
||||
shell.printfln(F("Testing adding a boiler & thermostat..."));
|
||||
shell.printfln(F("Testing adding a general boiler & thermostat..."));
|
||||
|
||||
std::string version("1.2.3");
|
||||
|
||||
EMSESP::add_device(0x08, 123, version, EMSdevice::Brand::BUDERUS); // Nefit Trendline
|
||||
EMSESP::add_device(0x18, 157, version, EMSdevice::Brand::BOSCH); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
// add_device(0x18, 157); // Bosch CR100
|
||||
|
||||
// add some data
|
||||
// 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)
|
||||
@@ -269,20 +275,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
if (command == "fr120") {
|
||||
shell.printfln(F("Testing adding a thermostat FR120..."));
|
||||
|
||||
// add_device(0x10, 165, version, EMSdevice::Brand::BUDERUS);
|
||||
// add_device(0x17, 125, version, EMSdevice::Brand::BUDERUS); // test unknown class test
|
||||
// add_device(0x17, 93, version, EMSdevice::Brand::BUDERUS);
|
||||
// add_device(0x17, 254, version, EMSdevice::Brand::BUDERUS); // test unknown product_id
|
||||
|
||||
// EMSESP::add_device(0x18, 157, version, EMSdevice::Brand::BOSCH); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
|
||||
std::string version("1.2.3");
|
||||
|
||||
// add a boiler
|
||||
// EMSESP::add_device(0x08, 123, version, EMSdevice::Brand::BUDERUS); // Nefit Trendline
|
||||
|
||||
// add a thermostat
|
||||
EMSESP::add_device(0x10, 191, version, EMSdevice::Brand::JUNKERS); // FR120
|
||||
add_device(0x10, 191); // FR120
|
||||
|
||||
// HC1
|
||||
uart_telegram({0x90, 0x00, 0xFF, 0x00, 0x00, 0x6F, 0x00, 0xCF, 0x21, 0x2E, 0x20, 0x00, 0x2E, 0x24,
|
||||
@@ -295,20 +289,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
if (command == "thermostat") {
|
||||
shell.printfln(F("Testing adding a thermostat FW120..."));
|
||||
|
||||
// add_device(0x10, 165, version, EMSdevice::Brand::BUDERUS);
|
||||
// add_device(0x17, 125, version, EMSdevice::Brand::BUDERUS); // test unknown class test
|
||||
// add_device(0x17, 93, version, EMSdevice::Brand::BUDERUS);
|
||||
// add_device(0x17, 254, version, EMSdevice::Brand::BUDERUS); // test unknown product_id
|
||||
|
||||
// EMSESP::add_device(0x18, 157, version, EMSdevice::Brand::BOSCH); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
|
||||
std::string version("1.2.3");
|
||||
|
||||
// add a boiler
|
||||
// EMSESP::add_device(0x08, 123, version, EMSdevice::Brand::BUDERUS); // Nefit Trendline
|
||||
|
||||
// add a thermostat
|
||||
EMSESP::add_device(0x10, 192, version, EMSdevice::Brand::JUNKERS); // FW120
|
||||
add_device(0x10, 192); // FW120
|
||||
|
||||
// HC1
|
||||
uart_telegram({0x90, 0x00, 0xFF, 0x00, 0x00, 0x6F, 0x00, 0xCF, 0x21, 0x2E, 0x20, 0x00, 0x2E, 0x24,
|
||||
@@ -331,13 +313,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
if (command == "tc100") {
|
||||
shell.printfln(F("Testing adding a TC100 thermostat to the EMS bus..."));
|
||||
|
||||
std::string version("02.21");
|
||||
|
||||
// add a boiler
|
||||
// EMSESP::add_device(0x08, 123, version, EMSdevice::Brand::BUDERUS); // Nefit Trendline
|
||||
|
||||
// add a thermostat
|
||||
EMSESP::add_device(0x18, 202, version, EMSdevice::Brand::BOSCH); // Bosch TC100 - https://github.com/proddy/EMS-ESP/issues/474
|
||||
add_device(0x18, 202); // Bosch TC100 - https://github.com/proddy/EMS-ESP/issues/474
|
||||
|
||||
// 0x0A
|
||||
uart_telegram({0x98, 0x0B, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
@@ -349,8 +326,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
|
||||
EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS);
|
||||
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x30, 163, version, EMSdevice::Brand::BUDERUS); // SM100
|
||||
add_device(0x30, 163); // SM100
|
||||
|
||||
// SM100Monitor - type 0x0362 EMS+ - for SM100 and SM200
|
||||
// B0 0B FF 00 02 62 00 44 02 7A 80 00 80 00 80 00 80 00 80 00 80 00 00 7C 80 00 80 00 80 00 80
|
||||
@@ -377,19 +353,19 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
|
||||
EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS);
|
||||
|
||||
std::string version("1.2.3");
|
||||
|
||||
// add heatpump
|
||||
EMSESP::add_device(0x38, 200, version, EMSdevice::Brand::BUDERUS); // Enviline module
|
||||
add_device(0x38, 200); // Enviline module
|
||||
|
||||
// add a thermostat
|
||||
EMSESP::add_device(0x10, 192, version, EMSdevice::Brand::JUNKERS); // FW120
|
||||
add_device(0x10, 192); // FW120
|
||||
|
||||
uart_telegram({0x90, 0x00, 0xFF, 0x00, 0x00, 0x6F, 0x00, 0xCF, 0x21, 0x2E, 0x20, 0x00, 0x2E, 0x24,
|
||||
0x03, 0x25, 0x03, 0x03, 0x01, 0x03, 0x25, 0x00, 0xC8, 0x00, 0x00, 0x11, 0x01, 0x03}); // HC1
|
||||
|
||||
uart_telegram("38 0B FF 00 03 7B 0C 34 00 74");
|
||||
shell.invoke_command("call");
|
||||
shell.invoke_command("call heatpump info");
|
||||
|
||||
EMSESP::show_device_values(shell);
|
||||
}
|
||||
|
||||
@@ -398,8 +374,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
|
||||
EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS);
|
||||
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x30, 164, version, EMSdevice::Brand::BUDERUS); // SM200
|
||||
add_device(0x30, 164); // SM200
|
||||
|
||||
// SM100Monitor - type 0x0362 EMS+ - for SM100 and SM200
|
||||
// B0 0B FF 00 02 62 00 44 02 7A 80 00 80 00 80 00 80 00 80 00 80 00 00 7C 80 00 80 00 80 00 80
|
||||
@@ -433,13 +408,11 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
|
||||
EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS);
|
||||
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x10, 158, version, EMSdevice::Brand::BUDERUS); // RC300
|
||||
EMSESP::add_device(0x48, 189, version, EMSdevice::Brand::BUDERUS); // KM200
|
||||
add_device(0x10, 158); // RC300
|
||||
add_device(0x48, 189); // KM200
|
||||
|
||||
// see https://github.com/proddy/EMS-ESP/issues/390
|
||||
|
||||
/*
|
||||
uart_telegram_withCRC("90 48 FF 04 01 A6 5C");
|
||||
uart_telegram_withCRC("90 48 FF 00 01 A6 4C");
|
||||
uart_telegram_withCRC("90 48 FF 08 01 A7 6D");
|
||||
@@ -477,7 +450,6 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
uart_telegram_withCRC("C8 90 FF 00 02 01 A6 D0");
|
||||
|
||||
// uart_telegram_withCRC("10 00 FF 00 01 A5 00 D7 21 00 00 00 00 30 01 84 01 01 03 01 84 01 F1 00 00 11 01 00 08 63 00");
|
||||
*/
|
||||
|
||||
uart_telegram_withCRC("C8 90 F7 02 01 FF 01 A6 BA");
|
||||
|
||||
@@ -498,8 +470,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
|
||||
EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_HT3); // switch to junkers
|
||||
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x18, 157, version, EMSdevice::Brand::BOSCH); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
add_device(0x18, 157); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
|
||||
// RCPLUSStatusMessage_HC1(0x01A5)
|
||||
// 98 00 FF 00 01 A5 00 CF 21 2E 00 00 2E 24 03 25 03 03 01 03 25 00 C8 00 00 11 01 03 (no CRC)
|
||||
@@ -669,8 +640,8 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
shell.printfln(F("Testing Commands..."));
|
||||
|
||||
// add a thermostat with 3 HCs
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x10, 192, version, EMSdevice::Brand::JUNKERS); // FW120
|
||||
add_device(0x10, 192); // FW120
|
||||
|
||||
uart_telegram({0x90, 0x00, 0xFF, 0x00, 0x00, 0x6F, 0x00, 0xCF, 0x21, 0x2E, 0x20, 0x00, 0x2E, 0x24,
|
||||
0x03, 0x25, 0x03, 0x03, 0x01, 0x03, 0x25, 0x00, 0xC8, 0x00, 0x00, 0x11, 0x01, 0x03}); // HC1
|
||||
uart_telegram({0x90, 0x00, 0xFF, 0x00, 0x00, 0x70, 0x00, 0xCF, 0x22, 0x2F, 0x10, 0x00, 0x2E, 0x24,
|
||||
@@ -711,12 +682,10 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
});
|
||||
|
||||
// add a boiler
|
||||
// question: do we need to set the mask?
|
||||
std::string version("1.2.3");
|
||||
EMSESP::add_device(0x08, 123, version, EMSdevice::Brand::BUDERUS); // Nefit Trendline
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
|
||||
// add a thermostat
|
||||
EMSESP::add_device(0x18, 157, version, EMSdevice::Brand::BOSCH); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
add_device(0x18, 157); // Bosch CR100 - https://github.com/proddy/EMS-ESP/issues/355
|
||||
|
||||
// RCPLUSStatusMessage_HC1(0x01A5) - HC1
|
||||
uart_telegram({0x98, 0x00, 0xFF, 0x00, 0x01, 0xA5, 0x00, 0xCF, 0x21, 0x2E, 0x00, 0x00, 0x2E, 0x24,
|
||||
@@ -791,23 +760,31 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
}
|
||||
|
||||
if (command == "rx2") {
|
||||
shell.printfln(F("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});
|
||||
}
|
||||
|
||||
// https://github.com/proddy/EMS-ESP/issues/380#issuecomment-633663007
|
||||
if (command == "rx3") {
|
||||
shell.printfln(F("Testing rx3..."));
|
||||
|
||||
uart_telegram({0x21, 0x0B, 0xFF, 0x00});
|
||||
}
|
||||
|
||||
// testing the UART tx command, without a queue
|
||||
if (command == "tx2") {
|
||||
shell.printfln(F("Testing tx2..."));
|
||||
|
||||
uint8_t t[] = {0x0B, 0x88, 0x18, 0x00, 0x20, 0xD4}; // including CRC
|
||||
EMSuart::transmit(t, sizeof(t));
|
||||
}
|
||||
|
||||
// send read request with offset
|
||||
if (command == "offset") {
|
||||
shell.printfln(F("Testing offset..."));
|
||||
|
||||
// send_read_request(0x18, 0x08);
|
||||
EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset
|
||||
}
|
||||
@@ -824,14 +801,13 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
});
|
||||
|
||||
EMSESP::rxservice_.ems_mask(EMSbus::EMS_MASK_BUDERUS);
|
||||
std::string version("1.2.3");
|
||||
|
||||
// add controller
|
||||
EMSESP::add_device(0x09, 114, version, EMSdevice::Brand::BUDERUS);
|
||||
add_device(0x09, 114);
|
||||
|
||||
EMSESP::add_device(0x28, 160, version, EMSdevice::Brand::BUDERUS); // MM100, WWC
|
||||
EMSESP::add_device(0x29, 161, version, EMSdevice::Brand::BUDERUS); // MM200, WWC
|
||||
EMSESP::add_device(0x20, 160, version, EMSdevice::Brand::BOSCH); // MM100
|
||||
add_device(0x28, 160); // MM100, WWC
|
||||
add_device(0x29, 161); // MM200, WWC
|
||||
add_device(0x20, 160); // MM100
|
||||
|
||||
// WWC1 on 0x29
|
||||
uart_telegram({0xA9, 0x00, 0xFF, 0x00, 0x02, 0x32, 0x02, 0x6C, 0x00, 0x3C, 0x00, 0x3C, 0x3C, 0x46, 0x02, 0x03, 0x03, 0x00, 0x3C});
|
||||
@@ -849,9 +825,6 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & command) {
|
||||
shell.invoke_command("show mqtt");
|
||||
shell.invoke_command("call mixer");
|
||||
}
|
||||
|
||||
// finally dump to console
|
||||
EMSESP::loop();
|
||||
}
|
||||
|
||||
// simulates a telegram in the Rx queue, but without the CRC which is added automatically
|
||||
@@ -878,7 +851,7 @@ void Test::uart_telegram(const std::vector<uint8_t> & rx_data) {
|
||||
}
|
||||
data[i] = EMSESP::rxservice_.calculate_crc(data, i);
|
||||
EMSESP::incoming_telegram(data, i + 1);
|
||||
EMSESP::rxservice_.loop();
|
||||
// EMSESP::rxservice_.loop();
|
||||
}
|
||||
|
||||
// takes raw string, assuming it contains the CRC. This is what is output from 'watch raw'
|
||||
@@ -916,7 +889,7 @@ void Test::uart_telegram_withCRC(const char * rx_data) {
|
||||
}
|
||||
|
||||
EMSESP::incoming_telegram(data, count + 1);
|
||||
EMSESP::rxservice_.loop();
|
||||
// EMSESP::rxservice_.loop();
|
||||
}
|
||||
|
||||
// takes raw string, adds CRC to end
|
||||
@@ -956,14 +929,14 @@ void Test::uart_telegram(const char * rx_data) {
|
||||
data[count + 1] = EMSESP::rxservice_.calculate_crc(data, count + 1); // add CRC
|
||||
|
||||
EMSESP::incoming_telegram(data, count + 2);
|
||||
EMSESP::rxservice_.loop();
|
||||
// EMSESP::rxservice_.loop();
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
// Sends version telegram. Version is hardcoded to 1.0
|
||||
void Test::add_device(uint8_t device_id, uint8_t product_id) {
|
||||
// Send version: 09 0B 02 00 PP V1 V2
|
||||
uart_telegram({device_id, EMSESP_DEFAULT_EMS_BUS_ID, EMSdevice::EMS_TYPE_VERSION, 0, product_id, 1, 0});
|
||||
}
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
|
||||
+2
-1
@@ -40,12 +40,13 @@ namespace emsesp {
|
||||
|
||||
class Test {
|
||||
public:
|
||||
static void run_test(uuid::console::Shell & shell, const std::string & command); // only for testing
|
||||
static void run_test(uuid::console::Shell & shell, const std::string & command);
|
||||
static void dummy_mqtt_commands(const char * message);
|
||||
static void rx_telegram(const std::vector<uint8_t> & data);
|
||||
static void uart_telegram(const std::vector<uint8_t> & rx_data);
|
||||
static void uart_telegram(const char * rx_data);
|
||||
static void uart_telegram_withCRC(const char * rx_data);
|
||||
static void add_device(uint8_t device_id, uint8_t product_id);
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "2.1.1b1"
|
||||
#define EMSESP_APP_VERSION "2.1.1b2"
|
||||
|
||||
Reference in New Issue
Block a user