Adding mqtt QoS config setting with a default of 0 and updating platformio to use 3.1.1

This commit is contained in:
Matt Holmes 2025-01-30 21:26:01 +00:00
parent 205605dc45
commit 42b1c18d01
3 changed files with 4 additions and 6 deletions

View file

@ -115,6 +115,7 @@
/* MQTT options */
// #define MQTT // Enable this line to enable MQTT
#define MQTT_QOS 0 // MQTT Quality of Service (0, 1, or 2)
#define MQTT_MANUAL_TOPIC_OBJECT_NAME
// Enable MQTT_MANUAL_TOPIC_OBJECT_NAME to use custom MQTT topic, object ID prefix, and device name.
// WARNING: If this is not defined, the previous default naming format 'battery-emulator_esp32-XXXXXX' (based on hardware ID) will be used.

View file

@ -538,6 +538,6 @@ void mqtt_loop(void) {
}
bool mqtt_publish(const char* topic, const char* mqtt_msg, bool retain) {
int msg_id = esp_mqtt_client_publish(client, topic, mqtt_msg, strlen(mqtt_msg), 1, retain);
int msg_id = esp_mqtt_client_publish(client, topic, mqtt_msg, strlen(mqtt_msg), MQTT_QOS, retain);
return msg_id > -1;
}

View file

@ -12,10 +12,7 @@
src_dir = ./Software
[env:esp32dev]
platform = espressif32
platform_packages=
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.4
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.4/esp32-arduino-libs-3.0.4.zip
platform = https://github.com/pioarduino/platform-espressif32/releases/download/53.03.11/platform-espressif32.zip
board = esp32dev
monitor_speed = 115200
monitor_filters = default, time, log2file