From c6f8cd0e17abdf306e5ec2dc9ae041022f5445de Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 22 Dec 2018 16:13:07 +0100 Subject: [PATCH] 6.4.0.3 Hass and Alexa fixes 6.4.0.3 20181222 * Change Hass discovery to short MQTT messages as used by Hass 0.81 and up (#4711) * Change FallbackTopic detection (#4706) * Add define WIFI_SOFT_AP_CHANNEL in my_user_config.h to set Soft Access Point Channel number between 1 and 13 as used by Wifi Manager web GUI (#4673) * Fix Alexa "this value is outside the range of the device". Needs power cycle and Alexa deletion/discovery cycle. (#3159, #4712) --- sonoff/_changelog.ino | 10 ++++++++-- sonoff/my_user_config.h | 1 + sonoff/sonoff.ino | 3 ++- sonoff/xdrv_01_webserver.ino | 10 +++++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index e1414882a159..53c7895c3d54 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,6 +1,12 @@ -/* 6.4.0.2 20181221 +/* 6.4.0.3 20181222 + * Change Hass discovery to short MQTT messages as used by Hass 0.81 and up (#4711) + * Change FallbackTopic detection (#4706) + * Add define WIFI_SOFT_AP_CHANNEL in my_user_config.h to set Soft Access Point Channel number between 1 and 13 as used by Wifi Manager web GUI (#4673) + * Fix Alexa "this value is outside the range of the device". Needs power cycle and Alexa deletion/discovery cycle. (#3159, #4712) + * + * 6.4.0.2 20181221 * Fix possible dtostrf buffer overflows by increasing buffers - * + * * 6.4.0.1 20181217 * Add support for AZ-Instrument 7798 CO2 meter/datalogger (#4672) * Change RAM usage BMP/BME I2C sensors diff --git a/sonoff/my_user_config.h b/sonoff/my_user_config.h index aa92cba85dda..c0fcf3d3f24e 100644 --- a/sonoff/my_user_config.h +++ b/sonoff/my_user_config.h @@ -217,6 +217,7 @@ //#define MY_LANGUAGE zh-TW // Chinese (Traditional) in Taiwan // -- Wifi Config tools --------------------------- +#define WIFI_SOFT_AP_CHANNEL 1 // Soft Access Point Channel number between 1 and 13 as used by Wifi Manager web GUI //#define USE_WPS // Add support for WPS as initial wifi configuration tool (+33k code, 1k mem (5k mem with core v2.4.2+)) //#define USE_SMARTCONFIG // Add support for Wifi SmartConfig as initial wifi configuration tool (+23k code, +0.6k mem) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 362b48ced2b2..b262c7d9b04c 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -467,7 +467,8 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len) if (XdrvMqttData(topicBuf, sizeof(topicBuf), dataBuf, sizeof(dataBuf))) return; grpflg = (strstr(topicBuf, Settings.mqtt_grptopic) != NULL); - fallback_topic_flag = (strstr(topicBuf, mqtt_client) != NULL); + snprintf_P(stemp1, sizeof(stemp1), PSTR(D_CMND "/%s/"), mqtt_client); // Full Fallback topic = cmnd/DVES_xxxxxxxx + fallback_topic_flag = (!strncmp(topicBuf, stemp1, strlen(stemp1))); type = strrchr(topicBuf, '/'); // Last part of received topic is always the command (type) index = 1; diff --git a/sonoff/xdrv_01_webserver.ino b/sonoff/xdrv_01_webserver.ino index 959a42353a1e..bd76b3c0e95c 100644 --- a/sonoff/xdrv_01_webserver.ino +++ b/sonoff/xdrv_01_webserver.ino @@ -27,6 +27,10 @@ #define XDRV_01 1 +#ifndef WIFI_SOFT_AP_CHANNEL +#define WIFI_SOFT_AP_CHANNEL 1 // Soft Access Point Channel number between 1 and 11 as used by SmartConfig web GUI +#endif + #define HTTP_REFRESH_TIME 2345 // milliseconds #define HTTP_RESTART_RECONNECT_TIME 9000 // milliseconds #define HTTP_OTA_RESTART_RECONNECT_TIME 20000 // milliseconds @@ -441,7 +445,11 @@ void WifiManagerBegin(void) StopWebserver(); DnsServer = new DNSServer(); - WiFi.softAP(my_hostname); + + int channel = WIFI_SOFT_AP_CHANNEL; + if ((channel < 1) || (channel > 13)) { channel = 1; } + WiFi.softAP(my_hostname, NULL, channel); + delay(500); // Without delay I've seen the IP address blank /* Setup the DNS server redirecting all the domains to the apIP */ DnsServer->setErrorReplyCode(DNSReplyCode::NoError);