Merge branch 'emsesp:dev' into dev

This commit is contained in:
Proddy
2026-06-27 14:32:48 +02:00
committed by GitHub
10 changed files with 34 additions and 39 deletions

View File

@@ -34,7 +34,8 @@ class Roomctrl {
static bool is_remote(const uint8_t hc) {
return (hc < 4 && remotetemp_[hc] != EMS_VALUE_INT16_NOTSET);
}
static void set_timeout(uint8_t t);
static void set_timeout(uint8_t t);
static int16_t calc_dew(int16_t temp, uint8_t hum);
private:
static constexpr uint32_t SEND_INTERVAL = 15000; // 15 sec
@@ -50,7 +51,6 @@ class Roomctrl {
static void nack_write();
static void ack_write();
static void replyF7(uint8_t addr, uint8_t dst, uint8_t offset, uint8_t typehh, uint8_t typeh, uint8_t typel, uint8_t hc);
static int16_t calc_dew(int16_t temp, uint8_t hum);
static bool switch_off_[HCS];
static uint32_t send_time_[HCS];

View File

@@ -333,7 +333,10 @@ std::deque<Token> shuntingYard(const std::deque<Token> & tokens) {
// check if string is a number
bool isnum(const std::string & s) {
if (!s.empty() && (s.find_first_not_of("0123456789.") == std::string::npos || (s[0] == '-' && s.find_first_not_of("0123456789.", 1) == std::string::npos))) {
if (s.empty() || s.find_first_of("0123456789") == std::string::npos) {
return false;
}
if (s.find_first_not_of("0123456789.") == std::string::npos || (s[0] == '-' && s.find_first_not_of("0123456789.", 1) == std::string::npos)) {
return true;
}
return false;
@@ -636,6 +639,10 @@ std::string calculate(const std::string & expr) {
stack.push_back(lhs + rhs);
break;
}
if (!isnum(rhs) || !isnum(lhs)) {
stack.push_back(lhs + token.str + rhs);
break;
}
auto lhd = std::stod(lhs);
auto rhd = std::stod(rhs);
switch (token.str[0]) {

View File

@@ -222,22 +222,10 @@ bool System::command_message(const char * value, const int8_t id, JsonObject out
LOG_WARNING("Message is empty");
return false; // must have a string value
}
EMSESP::webSchedulerService.computed_value.clear();
EMSESP::webSchedulerService.raw_value = value;
for (uint16_t wait = 0; wait < 2000 && !EMSESP::webSchedulerService.raw_value.empty(); wait++) {
delay(1);
}
if (EMSESP::webSchedulerService.computed_value.empty()) {
LOG_WARNING("Message result is empty");
return false;
}
LOG_INFO("Message: %s", EMSESP::webSchedulerService.computed_value.c_str()); // send to log
Mqtt::queue_publish(F_(message), EMSESP::webSchedulerService.computed_value); // send to MQTT if enabled
output["api_data"] = EMSESP::webSchedulerService.computed_value; // send to API
std::string computed_value = EMSESP::webSchedulerService.compute_value(value);
LOG_INFO("Message: %s", computed_value.c_str()); // send to log
Mqtt::queue_publish(F_(message), computed_value); // send to MQTT if enabled
output["api_data"] = computed_value; // send to API
return true;
}

View File

@@ -810,16 +810,15 @@ void Thermostat::process_RemoteTemp(std::shared_ptr<const Telegram> telegram) {
// e.g. "38 10 FF 00 03 7B 08 24 00 4B"
void Thermostat::process_RemoteHumidity(std::shared_ptr<const Telegram> telegram) {
// has_update(telegram, dewtemperature_, 0); // this is int8
has_update(telegram, humidity_, 1);
has_update(telegram, dewtemperature_, 2); // this is int16
// some thermostats use short telegram with int8 dewpoint, https://github.com/emsesp/EMS-ESP32/issues/1491
if (telegram->offset == 0 && telegram->message_length < 4) {
int8_t dew = dewtemperature_ / 10;
telegram->read_value(dew, 0);
if (dew != EMS_VALUE_INT8_NOTSET && dewtemperature_ != dew * 10) {
dewtemperature_ = dew * 10;
has_update(dewtemperature_);
}
// but it's not a dewpoint in offset 0, removed, see https://github.com/emsesp/EMS-ESP32/issues/3135
has_update(telegram, humidity_, 1);
// has_update(telegram, dewtemperature_, 2); // this is int16
int16_t dew = EMS_VALUE_INT16_NOTSET;
if (telegram->read_value(dew, 2)) {
has_update(dewtemperature_, dew);
} else if (telegram->offset == 0 && telegram->message_length < 4) {
has_update(dewtemperature_, Roomctrl::calc_dew(tempsensor1_, humidity_));
}
}

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.8.3-dev.6"
#define EMSESP_APP_VERSION "3.8.3-dev.7"

View File

@@ -472,6 +472,10 @@ void WebSchedulerService::condition() {
}
}
std::string WebSchedulerService::compute_value(const char * value) {
return compute(value);
}
// process any scheduled jobs
void WebSchedulerService::loop() {
// initialize static value on startup
@@ -479,11 +483,6 @@ void WebSchedulerService::loop() {
static uint32_t last_uptime_min = 0;
static uint32_t last_uptime_sec = 0;
if (!raw_value.empty()) { // process a value from system/message command
computed_value = compute(raw_value);
raw_value.clear();
}
// get list of scheduler events and exit if it's empty
if (scheduleItems_->empty()) {
return;

View File

@@ -89,9 +89,7 @@ class WebSchedulerService : public StatefulService<WebScheduler> {
bool onChange(const char * cmd);
std::string get_metrics_prometheus();
std::string raw_value;
std::string computed_value;
std::string compute_value(const char * value);
#if defined(EMSESP_TEST)
void load_test_data();