diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index cf6d8e7..0d44b8b 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -37,7 +37,7 @@ const char HOSTNAME[] = "McLighting01"; // Friedly hostname #endif #ifdef MQTT_HOME_ASSISTANT_SUPPORT - #define MQTT_HOME_ASSISTANT_0_84_SUPPORT // Comment if using HA version < 0.84 + #define MQTT_HOME_ASSISTANT_0_87_SUPPORT // Comment if using HA version < 0.87 #endif #if defined(USE_WS2812FX_DMA) and defined(USE_WS2812FX_UART) diff --git a/Arduino/McLighting/request_handlers.h b/Arduino/McLighting/request_handlers.h index 96cf4b3..327b7a1 100644 --- a/Arduino/McLighting/request_handlers.h +++ b/Arduino/McLighting/request_handlers.h @@ -1010,14 +1010,16 @@ void checkForRequests() { DynamicJsonDocument jsonBuffer(JSON_ARRAY_SIZE(strip->getModeCount()) + JSON_OBJECT_SIZE(12) + 1500); JsonObject json = jsonBuffer.to(); json["name"] = HOSTNAME; - #ifdef MQTT_HOME_ASSISTANT_0_84_SUPPORT + #ifdef MQTT_HOME_ASSISTANT_0_87_SUPPORT json["schema"] = "json"; #else json["platform"] = "mqtt_json"; #endif json["state_topic"] = mqtt_ha_state_out; json["command_topic"] = mqtt_ha_state_in; + #ifndef MQTT_HOME_ASSISTANT_0_87_SUPPORT json["on_command_type"] = "first"; + #endif json["brightness"] = "true"; json["rgb"] = "true"; json["optimistic"] = "false"; @@ -1097,14 +1099,16 @@ void checkForRequests() { DynamicJsonDocument jsonBuffer(JSON_ARRAY_SIZE(strip->getModeCount()) + JSON_OBJECT_SIZE(12) + 1500); JsonObject json = jsonBuffer.to(); json["name"] = HOSTNAME; - #ifdef MQTT_HOME_ASSISTANT_0_84_SUPPORT + #ifdef MQTT_HOME_ASSISTANT_0_87_SUPPORT json["schema"] = "json"; #else json["platform"] = "mqtt_json"; #endif json["state_topic"] = mqtt_ha_state_out; json["command_topic"] = mqtt_ha_state_in; + #ifndef MQTT_HOME_ASSISTANT_0_87_SUPPORT json["on_command_type"] = "first"; + #endif json["brightness"] = "true"; json["rgb"] = "true"; json["optimistic"] = "false";