Version Bump to 2.2.3 rgbw 3colors

* Version Bump to 2.2.3 rgbw 3colors
 * PubSubClient Bug fixes
This commit is contained in:
bpohvoodoo
2019-03-19 21:29:41 +01:00
parent 0776e8f5f4
commit 9f482877c3
5 changed files with 26 additions and 11 deletions
+2 -1
View File
@@ -86,9 +86,10 @@ uint32_t autoParams[][6] = { // main_color, back_color, xtra_color, speed, mod
#if defined(ENABLE_MQTT)
char mqtt_buf[80];
char mqtt_will_topic[sizeof(HOSTNAME) + 7]; // Topic 'will' will be:HOSTNAME "/status";
char mqtt_will_payload[] = "ONLINE";
const char mqtt_will_payload[] = "OFFLINE";
char mqtt_intopic[sizeof(HOSTNAME) + 3]; // Topic 'in' will be: <HOSTNAME>/in
char mqtt_outtopic[sizeof(HOSTNAME) + 4]; // Topic 'out' will be: <HOSTNAME>/out
bool mqtt_lwt_boot_flag = true;
#if ENABLE_MQTT == 0
#define MQTT_MAX_PACKET_SIZE 512
#define MQTT_MAX_RECONNECT_TRIES 4
+16 -7
View File
@@ -1283,18 +1283,23 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
mqtt_reconnect_retries++;
DBG_OUTPUT_PORT.printf("Attempting MQTT connection %d / %d ...\r\n", mqtt_reconnect_retries, MQTT_MAX_RECONNECT_TRIES);
// Attempt to connect
if (mqtt_client->connect(mqtt_clientid, mqtt_user, mqtt_pass)) {
if (mqtt_client->connect(mqtt_clientid, mqtt_user, mqtt_pass, mqtt_will_topic, 2, true, mqtt_will_payload, true)) {
DBG_OUTPUT_PORT.println("MQTT connected!");
// Once connected, publish an announcement...
char * message = new char[18 + strlen(HOSTNAME) + 1];
char message[18 + strlen(HOSTNAME) + 1];
strcpy(message, "McLighting ready: ");
strcat(message, HOSTNAME);
mqtt_client->publish(mqtt_outtopic, message);
// ... and resubscribe
mqtt_client->subscribe(mqtt_intopic, qossub);
if(mqtt_lwt_boot_flag) {
mqtt_client.publish(mqtt_will_topic, "ONLINE");
//mqtt_lwt_boot_flag = false;
}
#if defined(ENABLE_HOMEASSISTANT)
ha_send_data.detach();
mqtt_client->subscribe(mqtt_ha_state_in, qossub);
ha_send_data.once(5, tickerSendState);
#if defined(MQTT_HOME_ASSISTANT_SUPPORT)
const size_t bufferSize = JSON_ARRAY_SIZE(strip->getModeCount()+ 4) + JSON_OBJECT_SIZE(11) + 1500;
DynamicJsonDocument jsonBuffer(bufferSize);
@@ -1339,9 +1344,9 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
unsigned int msg_len = measureJson(json) + 1;
char buffer[msg_len];
serializeJson(json, buffer, sizeof(buffer));
mqtt_client->beginPublish(mqtt_ha_config, msg_len, true);
mqtt_client->write((const uint8_t*)buffer, msg_len);
DBG_OUTPUT_PORT.println(buffer);
mqtt_client->beginPublish(String("homeassistant/light/" + String(HOSTNAME) + "/config").c_str(), msg_len-1, true);
mqtt_client->write((const uint8_t*)buffer, msg_len-1);
mqtt_client->endPublish();
#endif
#endif
@@ -1392,13 +1397,17 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
DBG_OUTPUT_PORT.println("Connected to MQTT.");
DBG_OUTPUT_PORT.print("Session present: ");
DBG_OUTPUT_PORT.println(sessionPresent);
char * message = new char[18 + strlen(HOSTNAME) + 1];
char message[18 + strlen(HOSTNAME) + 1];
strcpy(message, "McLighting ready: ");
strcat(message, HOSTNAME);
mqtt_client->publish(mqtt_outtopic, qospub, false, message);
//Subscribe
uint16_t packetIdSub1 = mqtt_client->subscribe((char *)mqtt_intopic, qossub);
uint16_t packetIdSub1 = mqtt_client->subscribe(mqtt_intopic, qossub);
DBG_OUTPUT_PORT.printf("Subscribing at QoS %d, packetId: ", qossub); DBG_OUTPUT_PORT.println(packetIdSub1);
if(mqtt_lwt_boot_flag) {
mqtt_client->publish(mqtt_will_topic, qospub, false, "ONLINE");
mqtt_lwt_boot_flag = false;
}
#if defined(ENABLE_HOMEASSISTANT)
ha_send_data.detach();
uint16_t packetIdSub2 = mqtt_client->subscribe((char *)mqtt_ha_state_in, qossub);
+1 -1
View File
@@ -1 +1 @@
#define SKETCH_VERSION "2.2.2.rgbw.3c"
#define SKETCH_VERSION "2.2.3.rgbw.3c"
+5 -1
View File
@@ -133,7 +133,11 @@
* 18 Mar 2019
* adressed issue: #6 (possibly affects R[r_start][r_end][hexrgb] [...]; +[numled][hexrgb]+[numled][hexrgb]+[numled][hexrgb] !<numled><hexrgb>)
*
*19 Mar 2019
* 19 Mar 2019
* included custom mode in UI
* adressed issue #4
*
* Version Bump to 2.2.3 rgbw 3colors
* PubSubClient Bug fixes
*
*/
+2 -1
View File
@@ -31,12 +31,13 @@ upload_resetmethod = nodemcu
lib_deps =
WiFiManager@0.14
AsyncMqttClient
https://github.com/bblanchon/ArduinoJson.git#v6.7.0-beta
ArduinoJson
WS2812FX
NeoPixelBus@2.4.1
WebSockets
ESPAsyncE131
ESPAsyncUDP
https://github.com/FabLab-Luenen/GY33_MCU
Brzo_I2C
[env:esp01_1m]