Completed HA autodiscovery
Modified platformio.ini
This commit is contained in:
parent
8a929a8348
commit
238d7119e0
@ -5,6 +5,7 @@
|
||||
src_dir = ./wled00
|
||||
data_dir = ./wled00/data
|
||||
lib_extra_dirs = ./wled00/src
|
||||
; Please uncomment one of the 5 lines below to select your board
|
||||
; env_default = nodemcuv2
|
||||
; env_default = esp01
|
||||
; env_default = esp01_1m
|
||||
@ -56,34 +57,35 @@ arduino_core_2_4_1 = espressif8266@1.7.3
|
||||
arduino_core_2_4_2 = espressif8266@1.8.0
|
||||
arduino_core_2_5_0 = espressif8266@2.0.4
|
||||
arduino_core_stage = https://github.com/platformio/platform-espressif8266.git#feature/stage
|
||||
platform = ${common:esp8266.arduino_core_2_5_0}
|
||||
platform = ${common:esp8266.arduino_core_2_4_2}
|
||||
build_flags =
|
||||
-D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
|
||||
-Wl,-Teagle.flash.4m3m.ld ;;;; Required for core > v2.5.0 or staging version 4MB Flash 3MB SPIFFs
|
||||
-Wl,-Teagle.flash.4m1m.ld ;;;; Required for core > v2.5.0 or staging version 4MB Flash 3MB SPIFFs
|
||||
|
||||
[common:esp8266_1M]
|
||||
platform = ${common:esp8266.platform}
|
||||
platform = espressif8266@1.8.0
|
||||
build_flags =
|
||||
-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
||||
-Wl,-Teagle.flash.1m512.ld ;;;; Required for core > v2.5.0 or staging version 1MB Flash 512kB SPIFFs
|
||||
-Wl,-Teagle.flash.1m0.ld ;;;; Compile with no SPIFFS to leave space for OTA
|
||||
; -D WLED_DISABLE_MOBILE_UI
|
||||
-D WLED_DISABLE_OTA
|
||||
; -D WLED_DISABLE_OTA
|
||||
; -D WLED_DISABLE_ALEXA
|
||||
-D WLED_DISABLE_BLYNK
|
||||
-D WLED_DISABLE_CRONIXIE
|
||||
-D WLED_DISABLE_HUESYNC
|
||||
; -D WLED_DISABLE_BLYNK
|
||||
; -D WLED_DISABLE_CRONIXIE
|
||||
; -D WLED_DISABLE_HUESYNC
|
||||
-D WLED_DISABLE_INFRARED
|
||||
|
||||
[common:esp8266_512k]
|
||||
platform = espressif8266@1.7.0
|
||||
platform = espressif8266@1.8.0
|
||||
build_flags =
|
||||
-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
||||
-Wl,-Teagle.flash.512k0.ld ;;;; Compile with no SPIFFS
|
||||
; -D WLED_DISABLE_MOBILE_UI
|
||||
-D WLED_DISABLE_OTA
|
||||
; -D WLED_DISABLE_ALEXA
|
||||
-D WLED_DISABLE_BLYNK
|
||||
-D WLED_DISABLE_CRONIXIE
|
||||
-D WLED_DISABLE_HUESYNC
|
||||
; -D WLED_DISABLE_BLYNK
|
||||
; -D WLED_DISABLE_CRONIXIE
|
||||
; -D WLED_DISABLE_HUESYNC
|
||||
-D WLED_DISABLE_INFRARED
|
||||
|
||||
[common:esp32]
|
||||
|
@ -24,7 +24,6 @@
|
||||
//#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01
|
||||
//#define WLED_DISABLE_MOBILE_UI
|
||||
|
||||
#define WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
|
||||
|
||||
#define WLED_DISABLE_FILESYSTEM //SPIFFS is not used by any WLED feature yet
|
||||
//#define WLED_ENABLE_FS_SERVING //Enable sending html file from SPIFFS before serving progmem version
|
||||
@ -99,7 +98,7 @@
|
||||
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 1903233
|
||||
#define VERSION 1903242
|
||||
char versionString[] = "0.8.4-dev";
|
||||
|
||||
|
||||
|
@ -99,7 +99,6 @@ void publishMqtt()
|
||||
mqtt->publish(subuf, 0, true, apires);
|
||||
}
|
||||
|
||||
#ifdef WLED_ENABLE_HOMEASSISTANT_AUTODISCOVERY
|
||||
const char HA_static_JSON[] PROGMEM = R"=====(,"bri_val_tpl":"{{value}}","rgb_cmd_tpl":"{{'#%02x%02x%02x' | format(red, green, blue)}}","rgb_val_tpl":"{{value[1:3]|int(base=16)}},{{value[3:5]|int(base=16)}},{{value[5:7]|int(base=16)}}","qos":0,"opt":true,"pl_on":"ON","pl_off":"OFF","fx_val_tpl":"{{value}}","fx_list":[)=====";
|
||||
|
||||
void sendHADiscoveryMQTT(){
|
||||
@ -128,88 +127,11 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
|
||||
"fx_stat_t":"YYYY/api",
|
||||
"fx_val_tpl":"{{value}}",
|
||||
"fx_list":[
|
||||
"[FX=00] STATIC",
|
||||
"[FX=01] BLINK",
|
||||
"[FX=02] BREATH",
|
||||
"[FX=03] COLOR_WIPE",
|
||||
"[FX=04] COLOR_WIPE_RANDOM",
|
||||
"[FX=05] RANDOM_COLOR",
|
||||
"[FX=06] COLOR_SWEEP",
|
||||
"[FX=07] DYNAMIC",
|
||||
"[FX=08] RAINBOW",
|
||||
"[FX=09] RAINBOW_CYCLE",
|
||||
"[FX=10] SCAN",
|
||||
"[FX=11] DUAL_SCAN",
|
||||
"[FX=12] FADE",
|
||||
"[FX=13] THEATER_CHASE",
|
||||
"[FX=14] THEATER_C_RAINBOW",
|
||||
"[FX=15] RUNNING_LIGHTS",
|
||||
"[FX=16] SAW",
|
||||
"[FX=17] TWINKLE",
|
||||
"[FX=18] DISSOLVE",
|
||||
"[FX=19] DISSOLVE_RANDOM",
|
||||
"[FX=20] SPARKLE",
|
||||
"[FX=21] FLASH_SPARKLE",
|
||||
"[FX=22] HYPER_SPARKLE",
|
||||
"[FX=23] STROBE",
|
||||
"[FX=24] STROBE_RAINBOW",
|
||||
"[FX=25] MULTI_STROBE",
|
||||
"[FX=26] BLINK_RAINBOW",
|
||||
"[FX=27] ANDROID",
|
||||
"[FX=28] CHASE_COLOR",
|
||||
"[FX=29] CHASE_RANDOM",
|
||||
"[FX=30] CHASE_RAINBOW",
|
||||
"[FX=31] CHASE_FLASH",
|
||||
"[FX=32] CHASE_FLASH_RANDOM",
|
||||
"[FX=33] CHASE_RAINBOW_WHITE",
|
||||
"[FX=34] COLORFUL",
|
||||
"[FX=35] TRAFFIC_LIGHT",
|
||||
"[FX=36] COLOR_SWEEP_RANDOM",
|
||||
"[FX=37] RUNNING_COLOR",
|
||||
"[FX=38] RUNNING_RED_BLUE",
|
||||
"[FX=39] RUNNING_RANDOM",
|
||||
"[FX=40] LARSON_SCANNER",
|
||||
"[FX=41] COMET",
|
||||
"[FX=42] FIREWORKS",
|
||||
"[FX=43] RAIN",
|
||||
"[FX=44] MERRY_CHRISTMAS",
|
||||
"[FX=45] FIRE_FLICKER",
|
||||
"[FX=46] GRADIENT",
|
||||
"[FX=47] LOADING",
|
||||
"[FX=48] DUAL_COLOR_WIPE_IN_OUT",
|
||||
"[FX=49] DUAL_COLOR_WIPE_IN_IN",
|
||||
"[FX=50] DUAL_COLOR_WIPE_OUT_OUT",
|
||||
"[FX=51] DUAL_COLOR_WIPE_OUT_IN",
|
||||
"[FX=52] CIRCUS_COMBUSTUS",
|
||||
"[FX=53] HALLOWEEN",
|
||||
"[FX=54] TRICOLOR_CHASE",
|
||||
"[FX=55] TRICOLOR_WIPE",
|
||||
"[FX=56] TRICOLOR_FADE",
|
||||
"[FX=57] LIGHTNING",
|
||||
"[FX=58] ICU",
|
||||
"[FX=59] MULTI_COMET",
|
||||
"[FX=60] DUAL_LARSON_SCANNER",
|
||||
"[FX=61] RANDOM_CHASE",
|
||||
"[FX=62] OSCILLATE",
|
||||
"[FX=63] PRIDE_2015",
|
||||
"[FX=64] JUGGLE",
|
||||
"[FX=65] PALETTE",
|
||||
"[FX=66] FIRE_2012",
|
||||
"[FX=67] COLORWAVES",
|
||||
"[FX=68] BPM",
|
||||
"[FX=69] FILLNOISE8",
|
||||
"[FX=70] NOISE16_1",
|
||||
"[FX=71] NOISE16_2",
|
||||
"[FX=72] NOISE16_3",
|
||||
"[FX=73] NOISE16_4",
|
||||
"[FX=74] COLORTWINKLE",
|
||||
"[FX=75] LAKE",
|
||||
"[FX=76] METEOR",
|
||||
"[FX=77] METEOR_SMOOTH",
|
||||
"[FX=78] RAILWAY",
|
||||
"[FX=79] RIPPLE"
|
||||
"[FX=00] Solid",
|
||||
"[FX=01] Blink",
|
||||
"[FX=02] ...",
|
||||
"[FX=79] Ripple"
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
@ -225,7 +147,7 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
|
||||
strcat(bufg, "/g");
|
||||
strcat(bufapi, "/api");
|
||||
|
||||
StaticJsonBuffer<JSON_OBJECT_SIZE(8)> jsonBuffer;
|
||||
StaticJsonBuffer<JSON_OBJECT_SIZE(9) +512> jsonBuffer;
|
||||
JsonObject& root = jsonBuffer.createObject();
|
||||
root["name"] = serverDescription;
|
||||
root["stat_t"] = bufc;
|
||||
@ -277,6 +199,8 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
|
||||
isNameStart = !isNameStart;
|
||||
}
|
||||
}
|
||||
olen--;
|
||||
oappend("]}");
|
||||
|
||||
DEBUG_PRINT("HA Discovery Sending >>");
|
||||
DEBUG_PRINTLN(buffer);
|
||||
@ -286,7 +210,6 @@ Send out HA MQTT Discovery message on MQTT connect (~2.4kB):
|
||||
strcat(pubt, "/config");
|
||||
mqtt->publish(pubt, 0, true, buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool initMqtt()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user