mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-05 06:45:40 +00:00
publish energy mqtt data with qos zero (#1518)
This commit is contained in:
@ -716,7 +716,7 @@ void BL_ProcessUpdate(float voltage, float current, float power,
|
||||
} else { //all other sensors
|
||||
float val = sensors[i].lastReading;
|
||||
if (sensors[i].names.units == UNIT_WH) val = BL_ChangeEnergyUnitIfNeeded(val);
|
||||
MQTT_PublishMain_StringFloat(sensors[i].names.name_mqtt, val, sensors[i].rounding_decimals, 0);
|
||||
MQTT_PublishMain_StringFloat(sensors[i].names.name_mqtt, val, sensors[i].rounding_decimals, OBK_PUBLISH_FLAG_QOS_ZERO);
|
||||
}
|
||||
stat_updatesSent++;
|
||||
}
|
||||
|
||||
@ -815,6 +815,10 @@ static OBK_Publish_Result MQTT_PublishTopicToClient(mqtt_client_t* client, const
|
||||
{
|
||||
err_t err;
|
||||
u8_t qos = 1; /* 0 1 or 2, see MQTT specification */
|
||||
if (flags & OBK_PUBLISH_FLAG_QOS_ZERO)
|
||||
{
|
||||
qos = 0;
|
||||
}
|
||||
u8_t retain = 0; /* No don't retain such crappy payload... */
|
||||
size_t sVal_len;
|
||||
char* pub_topic;
|
||||
|
||||
@ -68,6 +68,7 @@ enum OBK_Publish_Result_e {
|
||||
#define OBK_PUBLISH_FLAG_FORCE_REMOVE_GET 4
|
||||
// do not add anything to given topic
|
||||
#define OBK_PUBLISH_FLAG_RAW_TOPIC_NAME 8
|
||||
#define OBK_PUBLISH_FLAG_QOS_ZERO 16
|
||||
|
||||
|
||||
#include "new_mqtt_deduper.h"
|
||||
|
||||
Reference in New Issue
Block a user