discovery message & pio updates
- Add alternative way to send large messages using PubSubClient - Added Jason2866's link to Arduino Core v 2.5.0 as official core on PIO is not yet released
This commit is contained in:
parent
652ff236f6
commit
f71d1565dd
4 changed files with 20 additions and 8 deletions
|
@ -63,7 +63,7 @@ uint32_t autoParams[][4] = { // color, speed, mode, duration (seconds)
|
|||
|
||||
#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)
|
||||
#ifdef ENABLE_MQTT
|
||||
#define MQTT_MAX_PACKET_SIZE 2048
|
||||
#define MQTT_MAX_PACKET_SIZE 512
|
||||
#define MQTT_MAX_RECONNECT_TRIES 4
|
||||
|
||||
int mqtt_reconnect_retries = 0;
|
||||
|
|
|
@ -1032,9 +1032,18 @@ void checkForRequests() {
|
|||
#if defined(ENABLE_E131) and defined(MQTT_HOME_ASSISTANT_SUPPORT)
|
||||
effect_list.add("E131");
|
||||
#endif
|
||||
char buffer[measureJson(json) + 1];
|
||||
// Following will never work for PubSubClient as message size > 1.6kB
|
||||
// char buffer[measureJson(json) + 1];
|
||||
// serializeJson(json, buffer, sizeof(buffer));
|
||||
// mqtt_client.publish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), buffer, true);
|
||||
|
||||
// Alternate way to publish large messages using PubSubClient
|
||||
unsigned int msg_len = measureJson(json) + 1;
|
||||
char buffer[msg_len];
|
||||
serializeJson(json, buffer, sizeof(buffer));
|
||||
mqtt_client.publish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), buffer, true);
|
||||
mqtt->beginPublish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), msg_len, true);
|
||||
mqtt->write((const uint8_t*)buffer, msg_len);
|
||||
mqtt->endPublish();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -70,4 +70,6 @@
|
|||
* - new "REST API": /pixels?rgbo=xxx to change RGB order
|
||||
* - new "REST API": /pixels?pin=GPIO_NO to change PIN# (Allowed GPIO values: 16/5/4/0/2/14/12/13/15/3/1)
|
||||
* - added HA 0.87 version support https://github.com/toblum/McLighting/issues/327
|
||||
* - Added alternative way to send large messages using PubSubClient
|
||||
* - Added Jason2866's link to Arduino Core v2.5.0 in platformio.ini as official core on PIO is not yet released
|
||||
*/
|
||||
|
|
|
@ -20,15 +20,16 @@ arduino_core_2_3_0 = espressif8266@1.5.0
|
|||
arduino_core_2_4_0 = espressif8266@1.6.0
|
||||
arduino_core_2_4_1 = espressif8266@1.7.3
|
||||
arduino_core_2_4_2 = espressif8266@1.8.0
|
||||
arduino_core_2_5_0B2 = https://github.com/platformio/platform-espressif8266.git#feature/stage
|
||||
arduino_core_2_5_0 = https://github.com/Jason2866/platform-espressif8266.git#Tasmota
|
||||
arduino_core_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage
|
||||
|
||||
framework = arduino
|
||||
platform = ${common.arduino_core_2_4_2}
|
||||
;platform = ${common.arduino_core_2_5_0B2}
|
||||
; platform = ${common.arduino_core_2_4_2}
|
||||
platform = ${common.arduino_core_2_5_0}
|
||||
|
||||
build_flags =
|
||||
-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
|
||||
-DMQTT_MAX_PACKET_SIZE=2048 ; PubSubClient Specific flags
|
||||
-DMQTT_MAX_PACKET_SIZE=512 ; PubSubClient Specific flags
|
||||
-w ; supress all warnings
|
||||
monitor_speed = 115200
|
||||
board_build.flash_mode = dout
|
||||
|
@ -39,7 +40,7 @@ lib_deps =
|
|||
AsyncMqttClient
|
||||
https://github.com/bblanchon/ArduinoJson.git#v6.8.0-beta
|
||||
WS2812FX
|
||||
NeoPixelBus@2.4.1
|
||||
NeoPixelBus@2.4.2
|
||||
WebSockets
|
||||
ESPAsyncE131
|
||||
ESPAsyncUDP
|
||||
|
|
Loading…
Add table
Reference in a new issue