Merge branch 'dev2' of https://github.com/emsesp/EMS-ESP32 into dev2

This commit is contained in:
MichaelDvP
2023-07-21 09:16:51 +02:00
34 changed files with 69 additions and 72 deletions

View File

@@ -211,13 +211,18 @@ void Mqtt::incoming(const char * topic, const char * payload) {
// received an MQTT message that we subscribed too
// topic is the full path
// payload is json or a single string and converted to a json with key 'value'
void Mqtt::on_message(const char * topic, const char * payload, size_t len) const {
void Mqtt::on_message(const char * topic, const char * message, size_t len) const {
// This causes a compile error "error: variable-sized object may not be initialized"
// so commenting out and assuming with the new mqtt lib it's always null terminated
/*
// sometimes the payload is not terminated correctly, so make a copy
// convert payload to a null-terminated char string
char message[len + 2] = {'\0'};
if (payload != nullptr) {
strlcpy(message, payload, len + 1);
}
*/
#if defined(EMSESP_DEBUG)
if (len) {

View File

@@ -247,7 +247,7 @@ class Mqtt {
static std::vector<MQTTSubFunction> mqtt_subfunctions_; // list of mqtt subscribe callbacks for all devices
uint32_t last_mqtt_poll_ = 0;
// uint32_t last_mqtt_poll_ = 0;
uint32_t last_publish_boiler_ = 0;
uint32_t last_publish_thermostat_ = 0;
uint32_t last_publish_solar_ = 0;
@@ -255,7 +255,7 @@ class Mqtt {
uint32_t last_publish_other_ = 0;
uint32_t last_publish_sensor_ = 0;
uint32_t last_publish_heartbeat_ = 0;
uint32_t last_publish_queue_ = 0;
// uint32_t last_publish_queue_ = 0;
static bool connecting_;
static bool initialized_;