Skip to content

Commit

Permalink
add missing 'yarn webUI'
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Oct 17, 2023
1 parent 6783d5b commit a17f8db
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
yarn typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn build
yarn webUI
- name: Build firmware
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/tagged_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
yarn typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn build
yarn webUI
- name: Build firmware
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
yarn typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn build
yarn webUI
- name: Build firmware
run: |
Expand Down
1 change: 0 additions & 1 deletion src/emsesp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,6 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
uint8_t offset = telegram->offset;

// find name for src and dest by looking up known devices

std::string src_name("");
std::string dest_name("");
std::string type_name("");
Expand Down
16 changes: 15 additions & 1 deletion src/telegram.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class Telegram {
return (val != value);
}

// read a value from a telegram. We always store the value, regardless if its garbage
// read a value from a telegram if its not out of bounds.
// Then we update the value, regardless if its garbage
template <typename Value>
// assuming negative numbers are stored as 2's-complement
// https://medium.com/@LeeJulija/how-integers-are-stored-in-memory-using-twos-complement-5ba04d61a56c
Expand All @@ -124,7 +125,20 @@ class Telegram {
uint8_t num_bytes = (!s) ? sizeof(Value) : s;
// check for out of bounds, if so don't modify the value
auto msg_size = (index - this->offset + num_bytes - 1);
// TODO remove
Serial.print(" index: ");
Serial.print(index);
Serial.print(" offset: ");
Serial.print(offset);
Serial.print(" index: ");
Serial.print(" message_length: ");
Serial.print(this->message_length);
Serial.print(" msg_size: ");
Serial.print(msg_size);
Serial.println();

if ((index < this->offset) || (msg_size >= this->message_length) || (msg_size > EMS_MAX_TELEGRAM_MESSAGE_LENGTH)) {
Serial.println("Rejedcting!"); // TODO: remove
return false;
}

Expand Down
44 changes: 32 additions & 12 deletions src/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ bool Test::run_test(const char * command, int8_t id) {
//
#ifdef EMSESP_STANDALONE

if (strcmp(command, "heat_exchange") == 0) {
EMSESP::logger().info("Testing heating exchange...");

add_device(0x08, 219); // Greenstar HIU/Logamax kompakt WS170

// [emsesp] boiler(0x08) -W-> Me(0x0B), UBAMonitorFastPlus(0xE4), data: 00 01 35 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 80 00 (offset 6)
uart_telegram({0x08, 0x00, 0xE4, 0x00, //
00, 01, 0x35, 00, 00, 00, 00, 00, 00, 00, 00, 0x80, 00, 00, 00, 00, 00, 00, 00, 0x80, 00});

return true;
}

if (strcmp(command, "2thermostats") == 0) {
EMSESP::logger().info("Testing with multiple thermostats...");

Expand Down Expand Up @@ -493,16 +505,24 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
shell.printfln("Testing RC310...");
run_test("310");
shell.invoke_command("show devices");
shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("call system publish");
shell.invoke_command("show mqtt");
ok = true;
}

if (command == "heat_exchange") {
shell.printfln("Testing heat exchange...");
run_test("heat_exchange");
shell.invoke_command("show devices");
shell.invoke_command("show values");
ok = true;
}

if (command == "2thermostats") {
shell.printfln("Testing multiple thermostats...");
run_test("2thermostats");
shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("show devices");
ok = true;
}
Expand Down Expand Up @@ -571,7 +591,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const

run_test("boiler");
shell.invoke_command("show devices");
shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("call boiler info");
shell.invoke_command("call system publish");

Expand Down Expand Up @@ -610,7 +630,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
// HC1
uart_telegram({0x90, 0x00, 0xFF, 0x00, 0x00, 0x6F, 0x01, 0x02, 0x00, 0xCF, 0x00, 0xE6});

shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("show devices");
ok = true;
}
Expand Down Expand Up @@ -653,7 +673,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
uart_telegram(
{0x08, 0x0B, 0xC2, 0, 0x08, 0xAC, 00, 0x10, 0x31, 0x48, 0x30, 0x31, 0x15, 0x80, 0x95, 0x0B, 0x0E, 0x10, 0x38, 00, 0x7F, 0xFF, 0xFF, 0xFF});

// shell.invoke_command("show");
// shell.invoke_command("show values");

ok = true;
}
Expand Down Expand Up @@ -686,12 +706,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
// Mqtt::nested_format(0);

emsesp::EMSESP::temperaturesensor_.test();
shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("call system publish");

// rename
EMSESP::temperaturesensor_.update("01-0203-0405-0607", "testtemperature", 2);
shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("call system publish");
ok = true;
}
Expand All @@ -704,14 +724,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
// Mqtt::nested_format(0);

emsesp::EMSESP::analogsensor_.test();
shell.invoke_command("show");
shell.invoke_command("show values");
// shell.invoke_command("call system publish");
// shell.invoke_command("show mqtt");

// rename
// bool update(uint8_t id, const std::string & name, int16_t offset, float factor, uint8_t uom, uint8_t type);
EMSESP::analogsensor_.update(36, "analogtest", 2, 0.7, 17, 1);
shell.invoke_command("show");
shell.invoke_command("show values");
// shell.invoke_command("call system publish");
ok = true;
}
Expand Down Expand Up @@ -1174,7 +1194,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
shell.printfln("Testing adding a thermostat FW120...");

run_test("thermostat");
shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("call system publish");

EMSESP::mqtt_.incoming("ems-esp/thermostat_hc1", "heat");
Expand Down Expand Up @@ -1243,7 +1263,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const

uart_telegram("30 00 FF 0A 02 6A 03"); // SM100 pump off 0

shell.invoke_command("show");
shell.invoke_command("show values");
ok = true;
}

Expand Down Expand Up @@ -1676,7 +1696,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
// check for error "No telegram type handler found for ID 0x255 (src 0x20)"
uart_telegram({0xA0, 0x00, 0xFF, 0x00, 0x01, 0x55, 0x00, 0x1A});

shell.invoke_command("show");
shell.invoke_command("show values");
shell.invoke_command("call mixer info");
shell.invoke_command("call system publish");
shell.invoke_command("show mqtt");
Expand Down
4 changes: 3 additions & 1 deletion src/test/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

namespace emsesp {

#define EMSESP_DEBUG_DEFAULT "general"
// #define EMSESP_DEBUG_DEFAULT "general"

// #define EMSESP_DEBUG_DEFAULT "thermostat"
// #define EMSESP_DEBUG_DEFAULT "solar"
Expand Down Expand Up @@ -56,6 +56,8 @@ namespace emsesp {
// #define EMSESP_DEBUG_DEFAULT "memory"
// #define EMSESP_DEBUG_DEFAULT "coldshot"
// #define EMSESP_DEBUG_DEFAULT "custom_entities"
#define EMSESP_DEBUG_DEFAULT "heat_exchange"


class Test {
public:
Expand Down

0 comments on commit a17f8db

Please sign in to comment.