From 10cc2036258c24650f0af96ac1cdba5b73aa9e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 20 Nov 2017 17:12:56 +0100 Subject: [PATCH] Support for LLMNR --- code/espurna/config/arduino.h | 1 + code/espurna/config/general.h | 6 +++++- code/espurna/espurna.ino | 6 ++++++ code/espurna/llmnr.ino | 18 ++++++++++++++++++ code/platformio.ini | 6 +++--- 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 code/espurna/llmnr.ino diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 030a5818..0a9d7586 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -69,6 +69,7 @@ //#define I2C_SUPPORT 1 //#define INFLUXDB_SUPPORT 0 //#define IR_SUPPORT 1 +//#define LLMNR_SUPPORT 1 //#define MDNS_SUPPORT 0 //#define NOFUSS_SUPPORT 1 //#define NTP_SUPPORT 0 diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 040d3480..0869e205 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -324,13 +324,17 @@ PROGMEM const char* const custom_reset_string[] = { #define API_REAL_TIME_VALUES 0 // Show filtered/median values by default (0 => median, 1 => real time) // ----------------------------------------------------------------------------- -// MDNS +// MDNS & LLMNR // ----------------------------------------------------------------------------- #ifndef MDNS_SUPPORT #define MDNS_SUPPORT 1 // Publish services using mDNS by default #endif +#ifndef LLMNR_SUPPORT +#define LLMNR_SUPPORT 0 // Publish device using LLMNR protocol by default - requires 2.4.0 +#endif + // ----------------------------------------------------------------------------- // SPIFFS // ----------------------------------------------------------------------------- diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index 296021a0..7ec4a284 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -168,6 +168,9 @@ void welcome() { #if INFLUXDB_SUPPORT DEBUG_MSG_P(PSTR(" INFLUXDB")); #endif + #if LLMNR_SUPPORT + DEBUG_MSG_P(PSTR(" LLMNR")); + #endif #if MDNS_SUPPORT DEBUG_MSG_P(PSTR(" MDNS")); #endif @@ -308,6 +311,9 @@ void setup() { #if HOMEASSISTANT_SUPPORT haSetup(); #endif + #if LLMNR_SUPPORT + llmnrSetup(); + #endif // Prepare configuration for version 2.0 hwUpwardsCompatibility(); diff --git a/code/espurna/llmnr.ino b/code/espurna/llmnr.ino new file mode 100644 index 00000000..0a8b1db2 --- /dev/null +++ b/code/espurna/llmnr.ino @@ -0,0 +1,18 @@ +/* + +LLMNR MODULE + +Copyright (C) 2017 by Xose PĂ©rez + +*/ + +#if LLMNR_SUPPORT + +#include + +void llmnrSetup() { + LLMNR.begin(getSetting("hostname").c_str()); + DEBUG_MSG_P(PSTR("[LLMNR] Configured\n")); +} + +#endif // LLMNR_SUPPORT diff --git a/code/platformio.ini b/code/platformio.ini index 8ccc15a6..89f122bd 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -4,8 +4,8 @@ src_dir = espurna data_dir = espurna/data [common] -platform = espressif8266 -#platform = espressif8266_stage +#platform = espressif8266 +platform = espressif8266_stage build_flags = -g -DMQTT_MAX_PACKET_SIZE=400 ${env.ESPURNA_FLAGS} debug_flags = -DDEBUG_ESP_CORE -DDEBUG_ESP_SSL -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_TLS_MEM build_flags_512k = ${common.build_flags} -Wl,-Tesp8266.flash.512k0.ld @@ -15,7 +15,7 @@ build_flags_1m = ${common.build_flags} -Wl,-Tesp8266.flash.1m0.ld lib_deps = https://github.com/xoseperez/Time ArduinoJson - https://github.com/me-no-dev/ESPAsyncTCP#9b0cc37 + https://github.com/me-no-dev/ESPAsyncTCP#289a681 https://github.com/me-no-dev/ESPAsyncWebServer#313f337 https://github.com/marvinroger/async-mqtt-client#v0.8.1 PubSubClient