mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
Merge branch 'v2'a9 of https://github.com/proddy/EMS-ESP into v2
This commit is contained in:
@@ -58,8 +58,8 @@ Shell::~Shell() {
|
|||||||
|
|
||||||
void Shell::start() {
|
void Shell::start() {
|
||||||
#ifdef EMSESP_DEBUG
|
#ifdef EMSESP_DEBUG
|
||||||
// uuid::log::Logger::register_handler(this, uuid::log::Level::DEBUG); // added by proddy
|
uuid::log::Logger::register_handler(this, uuid::log::Level::DEBUG); // added by proddy
|
||||||
uuid::log::Logger::register_handler(this, uuid::log::Level::INFO); // added by proddy
|
//uuid::log::Logger::register_handler(this, uuid::log::Level::INFO); // added by proddy
|
||||||
#else
|
#else
|
||||||
uuid::log::Logger::register_handler(this, uuid::log::Level::NOTICE);
|
uuid::log::Logger::register_handler(this, uuid::log::Level::NOTICE);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ void Boiler::check_active() {
|
|||||||
// heating
|
// heating
|
||||||
// using a quick hack for checking the heating by looking at the Selected Flow Temp, but doesn't work for all boilers apparently
|
// using a quick hack for checking the heating by looking at the Selected Flow Temp, but doesn't work for all boilers apparently
|
||||||
if (selFlowTemp_ != EMS_VALUE_UINT_NOTSET && burnGas_ != EMS_VALUE_UINT_NOTSET) {
|
if (selFlowTemp_ != EMS_VALUE_UINT_NOTSET && burnGas_ != EMS_VALUE_UINT_NOTSET) {
|
||||||
heating_active_ = ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF));
|
heating_active_ = (!tap_water_active_ && ((selFlowTemp_ >= EMS_BOILER_SELFLOWTEMP_HEATING) && (burnGas_ != EMS_VALUE_BOOL_OFF)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if the heating or hot tap water has changed, if so send
|
// see if the heating or hot tap water has changed, if so send
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ using uuid::log::Level;
|
|||||||
#ifdef EMSESP_DEBUG
|
#ifdef EMSESP_DEBUG
|
||||||
MAKE_PSTR_WORD(test)
|
MAKE_PSTR_WORD(test)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MAKE_PSTR_WORD(exit)
|
MAKE_PSTR_WORD(exit)
|
||||||
MAKE_PSTR_WORD(help)
|
MAKE_PSTR_WORD(help)
|
||||||
MAKE_PSTR_WORD(settings)
|
MAKE_PSTR_WORD(settings)
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
// check to see if we need to force an MQTT publish
|
// check to see if we need to force an MQTT publish
|
||||||
if (found) {
|
if (found) {
|
||||||
if (emsdevice->updated_values()) {
|
if (emsdevice->updated_values()) {
|
||||||
emsdevice->publish_values();
|
emsdevice->publish_values(); // publish to MQTT if we explicitly have too
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -434,7 +434,7 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
LOG_DEBUG(F("No telegram type handler found for type ID 0x%02X (src 0x%02X, dest 0x%02X)"), telegram->type_id, telegram->src, telegram->dest);
|
LOG_DEBUG(F("No telegram type handler found for ID 0x%02X (src 0x%02X, dest 0x%02X)"), telegram->type_id, telegram->src, telegram->dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
@@ -586,7 +586,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
|||||||
txservice_.send_poll(); // close the bus
|
txservice_.send_poll(); // close the bus
|
||||||
txservice_.post_send_query(); // send type_id to last destination
|
txservice_.post_send_query(); // send type_id to last destination
|
||||||
} else if (first_value == TxService::TX_WRITE_FAIL) {
|
} else if (first_value == TxService::TX_WRITE_FAIL) {
|
||||||
LOG_DEBUG(F("Last Tx write rejected by host"));
|
LOG_ERROR(F("Last Tx write rejected by host"));
|
||||||
txservice_.send_poll(); // close the bus
|
txservice_.send_poll(); // close the bus
|
||||||
} else {
|
} else {
|
||||||
// ignore it, it's probably a poll and we can wait for the next one
|
// ignore it, it's probably a poll and we can wait for the next one
|
||||||
@@ -606,9 +606,9 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
|||||||
// So re-send the last Tx and increment retry count
|
// So re-send the last Tx and increment retry count
|
||||||
uint8_t retries = txservice_.retry_tx(); // returns 0 if exceeded count
|
uint8_t retries = txservice_.retry_tx(); // returns 0 if exceeded count
|
||||||
if (retries) {
|
if (retries) {
|
||||||
LOG_DEBUG(F("Last Tx read failed. Retrying #%d..."), retries);
|
LOG_ERROR(F("Last Tx read failed. Retrying #%d..."), retries);
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG(F("Last Tx read failed. Giving up"));
|
LOG_ERROR(F("Last Tx read failed after %d retries"), txservice_.MAXIMUM_TX_RETRIES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
src/mqtt.cpp
17
src/mqtt.cpp
@@ -394,11 +394,7 @@ void Mqtt::on_publish(uint16_t packetId) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mqtt_message.packet_id_ == packetId) {
|
if (mqtt_message.packet_id_ != packetId) {
|
||||||
#ifdef EMSESP_DEBUG
|
|
||||||
LOG_DEBUG(F("Acknowledged PID %d. Removing from queue"), packetId);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
LOG_DEBUG(F("Mismatch, expecting PID %d, got %d"), mqtt_message.packet_id_, packetId);
|
LOG_DEBUG(F("Mismatch, expecting PID %d, got %d"), mqtt_message.packet_id_, packetId);
|
||||||
mqtt_publish_fails_++; // increment error count
|
mqtt_publish_fails_++; // increment error count
|
||||||
}
|
}
|
||||||
@@ -423,9 +419,7 @@ char * Mqtt::make_topic(char * result, const std::string & topic) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mqtt::start() {
|
void Mqtt::start() {
|
||||||
publish("status", "online", true); // say we're alive to the Last Will topic, with retain on
|
|
||||||
send_start_topic();
|
send_start_topic();
|
||||||
send_heartbeat(); // send heartbeat if enabled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// send online appended with the version information as JSON
|
// send online appended with the version information as JSON
|
||||||
@@ -441,6 +435,11 @@ void Mqtt::on_connect() {
|
|||||||
mqtt_reconnect_delay_ = Mqtt::MQTT_RECONNECT_DELAY_MIN;
|
mqtt_reconnect_delay_ = Mqtt::MQTT_RECONNECT_DELAY_MIN;
|
||||||
mqtt_last_connection_ = uuid::get_uptime();
|
mqtt_last_connection_ = uuid::get_uptime();
|
||||||
mqtt_connecting_ = false;
|
mqtt_connecting_ = false;
|
||||||
|
|
||||||
|
publish("status", "online", true); // say we're alive to the Last Will topic, with retain on
|
||||||
|
|
||||||
|
send_heartbeat(); // send heartbeat if enabled
|
||||||
|
|
||||||
LOG_INFO(F("MQTT connected"));
|
LOG_INFO(F("MQTT connected"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,9 +602,7 @@ void Mqtt::process_queue() {
|
|||||||
// but add the packet_id so we can check it later
|
// but add the packet_id so we can check it later
|
||||||
if (mqtt_qos_ != 0) {
|
if (mqtt_qos_ != 0) {
|
||||||
mqtt_messages_.front().packet_id_ = packet_id;
|
mqtt_messages_.front().packet_id_ = packet_id;
|
||||||
#ifdef EMSESP_DEBUG
|
// LOG_DEBUG(F("Setting packetID for ACK to %d"), packet_id);
|
||||||
LOG_DEBUG(F("Setting packetID for ACK to %d"), packet_id);
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -287,10 +287,9 @@ class TxService : public EMSbus {
|
|||||||
|
|
||||||
std::string last_tx_to_string() const;
|
std::string last_tx_to_string() const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
static constexpr uint8_t MAXIMUM_TX_RETRIES = 3;
|
static constexpr uint8_t MAXIMUM_TX_RETRIES = 3;
|
||||||
|
|
||||||
|
private:
|
||||||
uint8_t tx_telegram_id_ = 0; // queue counter
|
uint8_t tx_telegram_id_ = 0; // queue counter
|
||||||
|
|
||||||
static constexpr uint32_t TX_LOOP_WAIT = 10000; // when to check if Tx is up and running (10 sec)
|
static constexpr uint32_t TX_LOOP_WAIT = 10000; // when to check if Tx is up and running (10 sec)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "2.0.0a8"
|
#define EMSESP_APP_VERSION "2.0.0a9"
|
||||||
|
|||||||
Reference in New Issue
Block a user