- More Auto-Discovery fix for HA version >= 0.84 #286
- Suggestions from https://github.com/home-assistant/home-assistant/issues/19420
This commit is contained in:
Debashish Sahu 2018-12-18 08:02:02 -05:00
parent c755fa2e81
commit 4df3667c38
3 changed files with 7 additions and 5 deletions

View file

@ -936,11 +936,10 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
ha_send_data.detach();
mqtt_client.subscribe(mqtt_ha_state_in.c_str(), qossub);
#ifdef MQTT_HOME_ASSISTANT_SUPPORT
DynamicJsonDocument jsonBuffer(JSON_ARRAY_SIZE(strip.getModeCount()) + JSON_OBJECT_SIZE(12));
DynamicJsonDocument jsonBuffer(JSON_ARRAY_SIZE(strip.getModeCount()) + JSON_OBJECT_SIZE(12) + 1500);
JsonObject json = jsonBuffer.to<JsonObject>();
json["name"] = HOSTNAME;
#ifdef MQTT_HOME_ASSISTANT_0_84_SUPPORT
json["platform"] = "mqtt";
json["schema"] = "json";
#else
json["platform"] = "mqtt_json";
@ -1021,11 +1020,10 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
uint16_t packetIdSub2 = amqttClient.subscribe((char *)mqtt_ha_state_in.c_str(), qossub);
DBG_OUTPUT_PORT.printf("Subscribing at QoS %d, packetId: ", qossub); DBG_OUTPUT_PORT.println(packetIdSub2);
#ifdef MQTT_HOME_ASSISTANT_SUPPORT
DynamicJsonDocument jsonBuffer(JSON_ARRAY_SIZE(strip.getModeCount()) + JSON_OBJECT_SIZE(12));
DynamicJsonDocument jsonBuffer(JSON_ARRAY_SIZE(strip.getModeCount()) + JSON_OBJECT_SIZE(12) + 1500);
JsonObject json = jsonBuffer.to<JsonObject>();
json["name"] = HOSTNAME;
#ifdef MQTT_HOME_ASSISTANT_0_84_SUPPORT
json["platform"] = "mqtt";
json["schema"] = "json";
#else
json["platform"] = "mqtt_json";

View file

@ -1 +1 @@
#define SKETCH_VERSION "2.1.10"
#define SKETCH_VERSION "2.1.11"

View file

@ -44,4 +44,8 @@
*
* 16 Dec 2018 v 1.1.10
* - more ArduinoJson library memory managment fixes
*
* 18 Dec 2018 v 2.1.11
* - More Auto-Discovery fix for HA version >= 0.84 #286
* - Suggestions from https://github.com/home-assistant/home-assistant/issues/19420
*/