[SYS] Fix ESP8266 discovery publications (#2100)
Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
1 parent
742945906d
commit
3cd7c92d8f
3 files changed
+9
-8
No files matched your search
+7
-6
@@ -152,13 +152,14 @@
|
|||||||
#ifndef JSON_MSG_BUFFER
|
#ifndef JSON_MSG_BUFFER
|
||||||
# if defined(ESP32)
|
# if defined(ESP32)
|
||||||
# define JSON_MSG_BUFFER 1024 // adjusted to minimum size covering largest home assistant discovery messages
|
# define JSON_MSG_BUFFER 1024 // adjusted to minimum size covering largest home assistant discovery messages
|
||||||
|
# if MQTT_SECURE_DEFAULT
|
||||||
|
# define JSON_MSG_BUFFER_MAX 2048 // Json message buffer size increased to handle certificate changes through MQTT, used for the queue and the coming MQTT messages
|
||||||
|
# else
|
||||||
|
# define JSON_MSG_BUFFER_MAX 1024 // Minimum size for the cover MQTT discovery message
|
||||||
|
# endif
|
||||||
# elif defined(ESP8266)
|
# elif defined(ESP8266)
|
||||||
# define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 768 or higher it is causing unexpected behaviour on ESP8266, certificates handling with ESP8266 is not tested
|
# define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 768 or higher it is causing unexpected behaviour on ESP8266, certificates handling with ESP8266 is not tested
|
||||||
# endif
|
# define JSON_MSG_BUFFER_MAX 832 // Minimum size for MQTT discovery message
|
||||||
# if MQTT_SECURE_DEFAULT
|
|
||||||
# define JSON_MSG_BUFFER_MAX 2048 // Json message buffer size increased to handle certificate changes through MQTT, used for the queue and the coming MQTT messages
|
|
||||||
# else
|
|
||||||
# define JSON_MSG_BUFFER_MAX 1024 // Minimum size for the cover MQTT discovery message
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ void createDiscovery(const char* sensor_type,
|
|||||||
const char* payload_available, const char* payload_not_available, bool gateway_entity, const char* cmd_topic,
|
const char* payload_available, const char* payload_not_available, bool gateway_entity, const char* cmd_topic,
|
||||||
const char* device_name, const char* device_manufacturer, const char* device_model, const char* device_id, bool retainCmd,
|
const char* device_name, const char* device_manufacturer, const char* device_model, const char* device_id, bool retainCmd,
|
||||||
const char* state_class, const char* state_off, const char* state_on, const char* enum_options, const char* command_template) {
|
const char* state_class, const char* state_off, const char* state_on, const char* enum_options, const char* command_template) {
|
||||||
StaticJsonDocument<JSON_MSG_BUFFER_MAX> jsonBuffer;
|
StaticJsonDocument<JSON_MSG_BUFFER> jsonBuffer;
|
||||||
JsonObject sensor = jsonBuffer.to<JsonObject>();
|
JsonObject sensor = jsonBuffer.to<JsonObject>();
|
||||||
|
|
||||||
// If a component cannot render it's state (f.i. KAKU relays) no state topic
|
// If a component cannot render it's state (f.i. KAKU relays) no state topic
|
||||||
|
|||||||
+1
-1
@@ -526,7 +526,7 @@ void emptyQueue() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.trace(F("Dequeue JSON" CR));
|
Log.trace(F("Dequeue JSON" CR));
|
||||||
DynamicJsonDocument jsonBuffer(JSON_MSG_BUFFER);
|
DynamicJsonDocument jsonBuffer(JSON_MSG_BUFFER_MAX);
|
||||||
JsonObject obj = jsonBuffer.to<JsonObject>();
|
JsonObject obj = jsonBuffer.to<JsonObject>();
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
if (xSemaphoreTake(xQueueMutex, pdMS_TO_TICKS(QueueSemaphoreTimeOutTask)) == pdFALSE) {
|
if (xSemaphoreTake(xQueueMutex, pdMS_TO_TICKS(QueueSemaphoreTimeOutTask)) == pdFALSE) {
|
||||||
|
|||||||
Reference in new issue
Block a user