mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
Sync with upstream/dev
This commit is contained in:
@@ -78,6 +78,7 @@ MyESP::MyESP() {
|
||||
_mqtt_will_topic = strdup(MQTT_WILL_TOPIC);
|
||||
_mqtt_will_online_payload = strdup(MQTT_WILL_ONLINE_PAYLOAD);
|
||||
_mqtt_will_offline_payload = strdup(MQTT_WILL_OFFLINE_PAYLOAD);
|
||||
_mqtt_publish_fails = 0; // count of number of failed MQTT topic publishes
|
||||
|
||||
// network
|
||||
_network_password = nullptr;
|
||||
@@ -425,9 +426,19 @@ bool MyESP::mqttPublish(const char * topic, const char * payload, bool retain) {
|
||||
if (packet_id) {
|
||||
_addMQTTLog(topic, payload, MYESP_MQTTLOGTYPE_PUBLISH); // add to the log
|
||||
return true;
|
||||
} else {
|
||||
myDebug_P(PSTR("[MQTT] Error publishing to %s with payload %s [error %d]"), _mqttTopic(topic), payload, packet_id);
|
||||
}
|
||||
|
||||
// it failed, try again https://github.com/proddy/EMS-ESP/issues/264
|
||||
delay(100); // this is blocking and probably not a good idea
|
||||
packet_id = mqttClient.publish(_mqttTopic(topic), _mqtt_qos, retain, payload);
|
||||
if (packet_id) {
|
||||
_addMQTTLog(topic, payload, MYESP_MQTTLOGTYPE_PUBLISH); // add to the log
|
||||
return true; // ok this time
|
||||
}
|
||||
|
||||
// it didn't work again, will return false
|
||||
myDebug_P(PSTR("[MQTT] Error publishing to %s with payload %s [error %d]"), _mqttTopic(topic), payload, packet_id);
|
||||
_mqtt_publish_fails++; // increment failure counter
|
||||
}
|
||||
|
||||
return false; // failed
|
||||
@@ -1372,6 +1383,7 @@ void MyESP::showSystemStats() {
|
||||
|
||||
if (isMQTTConnected()) {
|
||||
myDebug_P(PSTR(" [MQTT] is connected (heartbeat %s)"), getHeartbeat() ? "enabled" : "disabled");
|
||||
myDebug_P(PSTR(" [MQTT] # failed topic publishes: %d"), _mqtt_publish_fails);
|
||||
} else {
|
||||
myDebug_P(PSTR(" [MQTT] is disconnected"));
|
||||
}
|
||||
|
||||
@@ -366,6 +366,7 @@ class MyESP {
|
||||
uint32_t _mqtt_last_connection;
|
||||
bool _mqtt_connecting;
|
||||
bool _mqtt_heartbeat;
|
||||
uint16_t _mqtt_publish_fails;
|
||||
|
||||
// wifi
|
||||
void _wifiCallback(justwifi_messages_t code, char * parameter);
|
||||
|
||||
@@ -480,17 +480,17 @@ void showInfo() {
|
||||
myDebug_P(PSTR("")); // newline
|
||||
myDebug_P(PSTR("%sMixing module stats:%s"), COLOR_BOLD_ON, COLOR_BOLD_OFF);
|
||||
myDebug_P(PSTR(" Mixing: %s"), ems_getDeviceDescription(EMS_DEVICE_TYPE_MIXING, buffer_type,false));
|
||||
//if (EMS_Boiler.switchTemp > EMS_VALUE_SHORT_NOTSET)
|
||||
if (EMS_Boiler.switchTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
_renderShortValue("Switch temperature", "C", EMS_Boiler.switchTemp);
|
||||
|
||||
for (uint8_t hc_num = 1; hc_num <= EMS_THERMOSTAT_MAXHC; hc_num++) {
|
||||
if (EMS_Mixing.hc[hc_num - 1].active) {
|
||||
myDebug_P(PSTR(" Mixing Circuit %d"), hc_num);
|
||||
//if (EMS_Mixing.hc[hc_num - 1].flowTemp > EMS_VALUE_SHORT_NOTSET)
|
||||
_renderShortValue(" Current flow temperature", "C", EMS_Mixing.hc[hc_num - 1].flowTemp);
|
||||
//if (EMS_Mixing.hc[hc_num - 1].flowSetTemp != EMS_VALUE_INT_NOTSET)
|
||||
if (EMS_Mixing.hc[hc_num - 1].flowTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
_renderUShortValue(" Current flow temperature", "C", EMS_Mixing.hc[hc_num - 1].flowTemp);
|
||||
if (EMS_Mixing.hc[hc_num - 1].flowSetTemp != EMS_VALUE_INT_NOTSET)
|
||||
_renderIntValue(" Setpoint flow temperature", "C", EMS_Mixing.hc[hc_num - 1].flowSetTemp);
|
||||
//if (EMS_Mixing.hc[hc_num - 1].pumpMod != EMS_VALUE_INT_NOTSET)
|
||||
if (EMS_Mixing.hc[hc_num - 1].pumpMod != EMS_VALUE_INT_NOTSET)
|
||||
_renderIntValue(" Current pump modulation", "%", EMS_Mixing.hc[hc_num - 1].pumpMod);
|
||||
if (EMS_Mixing.hc[hc_num - 1].valveStatus != EMS_VALUE_INT_NOTSET)
|
||||
_renderIntValue(" Current valve status", "", EMS_Mixing.hc[hc_num - 1].valveStatus);
|
||||
@@ -612,7 +612,7 @@ void publishEMSValues(bool force) {
|
||||
rootBoiler["curFlowTemp"] = (float)EMS_Boiler.curFlowTemp / 10;
|
||||
if (EMS_Boiler.retTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
rootBoiler["retTemp"] = (float)EMS_Boiler.retTemp / 10;
|
||||
if (EMS_Boiler.switchTemp > EMS_VALUE_SHORT_NOTSET)
|
||||
if (EMS_Boiler.switchTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
rootBoiler["switchTemp"] = (float)EMS_Boiler.switchTemp / 10;
|
||||
if (EMS_Boiler.sysPress != EMS_VALUE_INT_NOTSET)
|
||||
rootBoiler["sysPress"] = (float)EMS_Boiler.sysPress / 10;
|
||||
@@ -668,7 +668,7 @@ void publishEMSValues(bool force) {
|
||||
if (abs(EMS_Boiler.heatWorkMin) != EMS_VALUE_LONG_NOTSET)
|
||||
rootBoiler["heatWorkMin"] = (float)EMS_Boiler.heatWorkMin;
|
||||
|
||||
if (EMS_Boiler.serviceCode < EMS_VALUE_USHORT_NOTSET) {
|
||||
if (EMS_Boiler.serviceCode != EMS_VALUE_USHORT_NOTSET) {
|
||||
rootBoiler["ServiceCode"] = EMS_Boiler.serviceCodeChar;
|
||||
rootBoiler["ServiceCodeNumber"] = EMS_Boiler.serviceCode;
|
||||
}
|
||||
@@ -778,11 +778,7 @@ void publishEMSValues(bool force) {
|
||||
strlcat(hc, _int_to_char(s, mixing->hc), sizeof(hc));
|
||||
JsonObject dataMixing = rootMixing.createNestedObject(hc);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (mixing->flowTemp > EMS_VALUE_SHORT_NOTSET)
|
||||
=======
|
||||
if (mixing->flowTemp != EMS_VALUE_USHORT_NOTSET)
|
||||
>>>>>>> upstream/dev
|
||||
if (mixing->flowTemp < EMS_VALUE_USHORT_NOTSET)
|
||||
dataMixing["flowTemp"] = (float)mixing->flowTemp / 10;
|
||||
if (mixing->flowSetTemp != EMS_VALUE_INT_NOTSET)
|
||||
dataMixing["setflowTemp"] = mixing->flowSetTemp;
|
||||
|
||||
@@ -123,7 +123,7 @@ void ems_init() {
|
||||
// init all mixing modules
|
||||
for (uint8_t i = 0; i < EMS_THERMOSTAT_MAXHC; i++) {
|
||||
EMS_Mixing.hc[i].hc = i + 1;
|
||||
EMS_Mixing.hc[i].flowTemp = EMS_VALUE_SHORT_NOTSET;
|
||||
EMS_Mixing.hc[i].flowTemp = EMS_VALUE_USHORT_NOTSET;
|
||||
EMS_Mixing.hc[i].pumpMod = EMS_VALUE_INT_NOTSET;
|
||||
EMS_Mixing.hc[i].valveStatus = EMS_VALUE_INT_NOTSET;
|
||||
EMS_Mixing.hc[i].flowSetTemp = EMS_VALUE_INT_NOTSET;
|
||||
@@ -161,7 +161,7 @@ void ems_init() {
|
||||
EMS_Boiler.burnStarts = EMS_VALUE_LONG_NOTSET; // # burner restarts
|
||||
EMS_Boiler.burnWorkMin = EMS_VALUE_LONG_NOTSET; // Total burner operating time
|
||||
EMS_Boiler.heatWorkMin = EMS_VALUE_LONG_NOTSET; // Total heat operating time
|
||||
EMS_Boiler.switchTemp = EMS_VALUE_SHORT_NOTSET;
|
||||
EMS_Boiler.switchTemp = EMS_VALUE_USHORT_NOTSET;
|
||||
|
||||
// UBAMonitorWWMessage
|
||||
EMS_Boiler.wWCurTmp = EMS_VALUE_USHORT_NOTSET; // Warm Water current temperature
|
||||
@@ -1273,11 +1273,7 @@ void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
|
||||
// Mixer - 0xAB
|
||||
void _process_MMStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
|
||||
<<<<<<< HEAD
|
||||
uint8_t hc = 1; // fixed, for 0xAB
|
||||
=======
|
||||
uint8_t hc = 0; // fixed, for 0xAB (HC1 only
|
||||
>>>>>>> upstream/dev
|
||||
EMS_Mixing.hc[hc].active = true;
|
||||
|
||||
_setValue(EMS_RxTelegram, &EMS_Mixing.hc[hc].flowTemp, EMS_OFFSET_MMStatusMessage_flow_temp);
|
||||
@@ -2865,7 +2861,6 @@ const _EMS_Type EMS_Types[] = {
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_HC1, "MMPLUSStatusMessage_HC1", _process_MMPLUSStatusMessage},
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMPLUSStatusMessage_HC2, "MMPLUSStatusMessage_HC2", _process_MMPLUSStatusMessage},
|
||||
{EMS_DEVICE_UPDATE_FLAG_MIXING, EMS_TYPE_MMStatusMessage, "MMStatusMessage", _process_MMStatusMessage}
|
||||
|
||||
};
|
||||
|
||||
// calculate sizes of arrays at compile time
|
||||
|
||||
@@ -298,7 +298,7 @@ typedef struct {
|
||||
uint32_t burnStarts; // # burner starts
|
||||
uint32_t burnWorkMin; // Total burner operating time
|
||||
uint32_t heatWorkMin; // Total heat operating time
|
||||
int16_t switchTemp; // Switch temperature
|
||||
uint16_t switchTemp; // Switch temperature
|
||||
|
||||
// UBAMonitorWWMessage
|
||||
uint16_t wWCurTmp; // Warm Water current temperature
|
||||
@@ -338,7 +338,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint8_t hc; // heating circuit 1, 2, 3 or 4
|
||||
bool active; // true if there is data for this HC
|
||||
int16_t flowTemp;
|
||||
uint16_t flowTemp;
|
||||
uint8_t pumpMod;
|
||||
uint8_t valveStatus;
|
||||
uint8_t flowSetTemp;
|
||||
|
||||
Reference in New Issue
Block a user