diff --git a/.gitignore b/.gitignore index 4a2aa300..3cedb39b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ credentials.h node_modules code/utils custom.h +.python +.env diff --git a/README.md b/README.md index 578ee7c5..eb5e1545 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Here is the list of supported hardware. For more information please refer to the ## License -Copyright (C) 2016-2017 by Xose Pérez (@xoseperez) +Copyright (C) 2016-2018 by Xose Pérez (@xoseperez) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/code/build.sh b/code/build.sh index de85f451..7eed5290 100755 --- a/code/build.sh +++ b/code/build.sh @@ -45,7 +45,7 @@ echo "Building firmware images..." mkdir -p firmware/espurna-$version for environment in $environments; do echo "* espurna-$version-$environment.bin" - platformio run -s -e $environment || exit + platformio run --silent --environment $environment || exit mv .pioenvs/$environment/firmware.bin firmware/espurna-$version/espurna-$version-$environment.bin done echo "--------------------------------------------------------------" diff --git a/code/core_version.py b/code/core_version.py deleted file mode 100644 index bffcb03a..00000000 --- a/code/core_version.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/python - -import json -import commands -import subprocess -import os -import sys - -def core_version(env): - - # Get the core folder - fwdir = env["FRAMEWORK_ARDUINOESP8266_DIR"] - - # Get the core version - with open(fwdir + '/package.json') as data_file: - data = json.load(data_file) - core_version = data["version"].upper().replace(".", "_").replace("-", "_") - print "CORE VERSION: %s" % core_version - - # Get git version - pr = subprocess.Popen( - "git --git-dir .git rev-parse --short=8 HEAD 2>/dev/null || echo ffffffff", - cwd = fwdir, - shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE ) - (out, error) = pr.communicate() - git_version = str(out).replace('\n', "") - print "GIT VERSION: %s" % git_version - - #env["BUILD_FLAGS"][0] += str(" -DARDUINO_ESP8266_RELEASE=" + core_version) - #env["BUILD_FLAGS"][0] += str(" -DARDUINO_ESP8266_RELEASE_" + core_version) - #env["BUILD_FLAGS"][0] += str(" -DARDUINO_ESP8266_GIT_VER=" + git_version) - - with open('espurna/config/core_version.h', 'w') as the_file: - the_file.write('#define ARDUINO_ESP8266_RELEASE "%s"\n' % core_version) - the_file.write('#define ARDUINO_ESP8266_RELEASE_%s\n' % core_version) - the_file.write('#define ARDUINO_ESP8266_GIT_VER "%s"\n' % git_version) - - #env.Append( - # CFLAGS = [ - # str("-DARDUINO_ESP8266_RELEASE=" + core_version), - # str("-DARDUINO_ESP8266_RELEASE_" + core_version), - # str("-DARDUINO_ESP8266_GIT_VER=" + git_version) - # ] - #) - - #print " -DARDUINO_ESP8266_RELEASE=" + core_version + - # " -DARDUINO_ESP8266_RELEASE_" + core_version + - # " -DARDUINO_ESP8266_GIT_VER=" + git_version - -Import('env') -core_version(env) diff --git a/code/espurna/alexa.ino b/code/espurna/alexa.ino index cfbdf25b..35b1ba88 100644 --- a/code/espurna/alexa.ino +++ b/code/espurna/alexa.ino @@ -2,7 +2,7 @@ ALEXA MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/api.ino b/code/espurna/api.ino index 8a9a750b..ef24432c 100644 --- a/code/espurna/api.ino +++ b/code/espurna/api.ino @@ -2,7 +2,7 @@ API MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/button.ino b/code/espurna/button.ino index 27bef53e..3b0d72bc 100644 --- a/code/espurna/button.ino +++ b/code/espurna/button.ino @@ -2,7 +2,7 @@ BUTTON MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 2a2b9ac5..2ddfdadc 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -57,6 +57,7 @@ //#define GENERIC_8CH //#define ARILUX_AL_LC01 //#define ARILUX_AL_LC11 +//#define ARILUX_AL_LC02 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 54beb4c3..0819215c 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -7,8 +7,9 @@ // GENERAL //------------------------------------------------------------------------------ +#define DEVICE_NAME MANUFACTURER "_" DEVICE // Concatenate both to get a unique device name #define ADMIN_PASS "fibonacci" // Default password (WEB, OTA, WIFI) -#define DEVICE_NAME MANUFACTURER "_" DEVICE // Concatenate both to get a unique device name +#define USE_PASSWORD 1 // Insecurity caution! Disabling this will disable password querying completely. #define LOOP_DELAY_TIME 10 // Delay for this millis in the main loop [0-250] #define ARRAYINIT(type, name, ...) \ @@ -208,7 +209,7 @@ PROGMEM const char* const custom_reset_string[] = { #define RELAY_BOOT_OFF 0 #define RELAY_BOOT_ON 1 #define RELAY_BOOT_SAME 2 -#define RELAY_BOOT_TOOGLE 3 +#define RELAY_BOOT_TOGGLE 3 #define RELAY_TYPE_NORMAL 0 #define RELAY_TYPE_INVERSE 1 @@ -589,6 +590,11 @@ PROGMEM const char* const custom_reset_string[] = { #define HOMEASSISTANT_SUPPORT MQTT_SUPPORT // Build with home assistant support (if MQTT, 1.64Kb) #endif +#if HOMEASSISTANT_SUPPORT +#undef MQTT_SUPPORT +#define MQTT_SUPPORT 1 // If Home Assistant enabled enable MQTT +#endif + #define HOMEASSISTANT_ENABLED 0 // Integration not enabled by default #define HOMEASSISTANT_PREFIX "homeassistant" // Default MQTT prefix diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 87f47cc3..7137a936 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -728,7 +728,6 @@ // LEDs #define LED1_PIN 13 #define LED1_PIN_INVERSE 0 - #define LED_WIFI 0 // ----------------------------------------------------------------------------- @@ -1183,6 +1182,26 @@ #define LIGHT_CH4_INVERSE 0 +#elif defined(ARILUX_AL_LC02) + + // Info + #define MANUFACTURER "ARILUX" + #define DEVICE "AL_LC02" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + // Light + #define LIGHT_CHANNELS 4 + #define LIGHT_CH1_PIN 12 // RED + #define LIGHT_CH2_PIN 5 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 15 // WHITE1 + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + #elif defined(ARILUX_AL_LC06) // Info diff --git a/code/espurna/config/sensors.h b/code/espurna/config/sensors.h index 957676cc..4dad0ab1 100644 --- a/code/espurna/config/sensors.h +++ b/code/espurna/config/sensors.h @@ -512,12 +512,12 @@ PROGMEM const char magnitude_reactive_power_topic[] = "reactive"; PROGMEM const char magnitude_power_factor_topic[] = "factor"; PROGMEM const char magnitude_energy_topic[] = "energy"; PROGMEM const char magnitude_energy_delta_topic[] = "energy_delta"; -PROGMEM const char magnitude_pm1dot0_topic[] = "pm1dot0"; -PROGMEM const char magnitude_pm2dot5_topic[] = "pm2dot5"; -PROGMEM const char magnitude_pm10_topic[] = "pm10"; PROGMEM const char magnitude_analog_topic[] = "analog"; PROGMEM const char magnitude_digital_topic[] = "digital"; PROGMEM const char magnitude_events_topic[] = "events"; +PROGMEM const char magnitude_pm1dot0_topic[] = "pm1dot0"; +PROGMEM const char magnitude_pm2dot5_topic[] = "pm2dot5"; +PROGMEM const char magnitude_pm10_topic[] = "pm10"; PROGMEM const char magnitude_co2_topic[] = "co2"; PROGMEM const char magnitude_lux_topic[] = "lux"; @@ -526,8 +526,8 @@ PROGMEM const char* const magnitude_topics[] = { magnitude_pressure_topic, magnitude_current_topic, magnitude_voltage_topic, magnitude_active_power_topic, magnitude_apparent_power_topic, magnitude_reactive_power_topic, magnitude_power_factor_topic, magnitude_energy_topic, magnitude_energy_delta_topic, - magnitude_pm1dot0_topic, magnitude_pm2dot5_topic, magnitude_pm10_topic, magnitude_analog_topic, magnitude_digital_topic, magnitude_events_topic, + magnitude_pm1dot0_topic, magnitude_pm2dot5_topic, magnitude_pm10_topic, magnitude_co2_topic, magnitude_lux_topic }; @@ -549,8 +549,8 @@ PROGMEM const char* const magnitude_units[] = { magnitude_hectopascals, magnitude_amperes, magnitude_volts, magnitude_watts, magnitude_watts, magnitude_watts, magnitude_percentage, magnitude_joules, magnitude_joules, - magnitude_ugm3, magnitude_ugm3, magnitude_ugm3, magnitude_empty, magnitude_empty, magnitude_empty, + magnitude_ugm3, magnitude_ugm3, magnitude_ugm3, magnitude_ppm, magnitude_lux }; diff --git a/code/espurna/config/version.h b/code/espurna/config/version.h index 1b9b8b57..004c4b69 100644 --- a/code/espurna/config/version.h +++ b/code/espurna/config/version.h @@ -1,5 +1,5 @@ #define APP_NAME "ESPURNA" -#define APP_VERSION "1.11.3" +#define APP_VERSION "1.11.4a" #define APP_AUTHOR "xose.perez@gmail.com" #define APP_WEBSITE "http://tinkerman.cat" #define CFG_VERSION 3 diff --git a/code/espurna/debug.ino b/code/espurna/debug.ino index 29873719..2b661cf8 100644 --- a/code/espurna/debug.ino +++ b/code/espurna/debug.ino @@ -2,7 +2,7 @@ DEBUG MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/domoticz.ino b/code/espurna/domoticz.ino index 892f7e83..6ddca627 100644 --- a/code/espurna/domoticz.ino +++ b/code/espurna/domoticz.ino @@ -2,7 +2,7 @@ DOMOTICZ MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index 0ba5c7b5..9ad20828 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -2,7 +2,7 @@ ESPurna -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/code/espurna/filters/BaseFilter.h b/code/espurna/filters/BaseFilter.h index f337c7a3..3ad2852e 100644 --- a/code/espurna/filters/BaseFilter.h +++ b/code/espurna/filters/BaseFilter.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Base Filter (other filters inherit from this) -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT diff --git a/code/espurna/filters/MaxFilter.h b/code/espurna/filters/MaxFilter.h index bf660322..9668fc95 100644 --- a/code/espurna/filters/MaxFilter.h +++ b/code/espurna/filters/MaxFilter.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Max Filter -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT diff --git a/code/espurna/filters/MedianFilter.h b/code/espurna/filters/MedianFilter.h index 98376e3f..1d34a309 100644 --- a/code/espurna/filters/MedianFilter.h +++ b/code/espurna/filters/MedianFilter.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Median Filter -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT diff --git a/code/espurna/filters/MovingAverageFilter.h b/code/espurna/filters/MovingAverageFilter.h index beb08c55..21ba66d4 100644 --- a/code/espurna/filters/MovingAverageFilter.h +++ b/code/espurna/filters/MovingAverageFilter.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Moving Average Filter -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT diff --git a/code/espurna/gpio.ino b/code/espurna/gpio.ino index c65e95b6..ed0399fe 100644 --- a/code/espurna/gpio.ino +++ b/code/espurna/gpio.ino @@ -2,7 +2,7 @@ GPIO MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/homeassitant.ino b/code/espurna/homeassitant.ino index 24e9ed82..67c1ec4f 100644 --- a/code/espurna/homeassitant.ino +++ b/code/espurna/homeassitant.ino @@ -2,7 +2,7 @@ HOME ASSISTANT MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/i2c.ino b/code/espurna/i2c.ino index ccbf27bb..422ff4c8 100644 --- a/code/espurna/i2c.ino +++ b/code/espurna/i2c.ino @@ -2,7 +2,7 @@ I2C MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/influxdb.ino b/code/espurna/influxdb.ino index 22b36c67..45da0f44 100644 --- a/code/espurna/influxdb.ino +++ b/code/espurna/influxdb.ino @@ -2,7 +2,7 @@ I2C MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/ir.ino b/code/espurna/ir.ino index 2a1e59b0..13d23f15 100644 --- a/code/espurna/ir.ino +++ b/code/espurna/ir.ino @@ -2,8 +2,8 @@ IR MODULE -Copyright (C) 2016-2017 by Xose Pérez -Copyright (C) 2017 by François Déchery +Copyright (C) 2016-2018 by Xose Pérez +Copyright (C) 2017-2018 by François Déchery */ diff --git a/code/espurna/led.ino b/code/espurna/led.ino index 0f07a3e1..93d04dd4 100644 --- a/code/espurna/led.ino +++ b/code/espurna/led.ino @@ -2,7 +2,7 @@ LED MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/light.ino b/code/espurna/light.ino index 3200fcd2..f558e27b 100644 --- a/code/espurna/light.ino +++ b/code/espurna/light.ino @@ -2,7 +2,7 @@ LIGHT MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -309,6 +309,17 @@ void _toLong(char * color, size_t len) { _toLong(color, len, false); } +void _toCSV(char * buffer, size_t len, bool applyBrightness) { + char num[10]; + float b = applyBrightness ? (float) _light_brightness / LIGHT_MAX_BRIGHTNESS : 1; + for (unsigned char i=0; i<_light_channel.size(); i++) { + itoa(_light_channel[i].value * b, num, 10); + if (i>0) strncat(buffer, ",", len--); + strncat(buffer, num, len); + len = len - strlen(num); + } +} + // Thanks to Sacha Telgenhof for sharing this code in his AiLight library // https://github.com/stelgenhof/AiLight void _fromKelvin(unsigned long kelvin) { @@ -451,6 +462,7 @@ void _lightColorRestore() { #if MQTT_SUPPORT void _lightMQTTCallback(unsigned int type, const char * topic, const char * payload) { + String mqtt_group_color = getSetting("mqttGroupColor"); if (type == MQTT_CONNECT_EVENT) { @@ -463,6 +475,10 @@ void _lightMQTTCallback(unsigned int type, const char * topic, const char * payl mqttSubscribe(MQTT_TOPIC_COLOR_HSV); } + // Group color + if (mqtt_group_color.length() > 0) mqttSubscribeRaw(mqtt_group_color.c_str()); + + // Channels char buffer[strlen(MQTT_TOPIC_CHANNEL) + 3]; snprintf_P(buffer, sizeof(buffer), PSTR("%s/+"), MQTT_TOPIC_CHANNEL); mqttSubscribe(buffer); @@ -471,6 +487,13 @@ void _lightMQTTCallback(unsigned int type, const char * topic, const char * payl if (type == MQTT_MESSAGE_EVENT) { + // Group color + if ((mqtt_group_color.length() > 0) & (mqtt_group_color.equals(topic))) { + lightColor(payload, true); + lightUpdate(true, mqttForward(), false); + return; + } + // Match topic String t = mqttSubtopic((char *) topic); @@ -478,28 +501,33 @@ void _lightMQTTCallback(unsigned int type, const char * topic, const char * payl if (t.equals(MQTT_TOPIC_MIRED)) { _fromMireds(atol(payload)); lightUpdate(true, mqttForward()); + return; } // Color temperature in kelvins if (t.equals(MQTT_TOPIC_KELVIN)) { _fromKelvin(atol(payload)); lightUpdate(true, mqttForward()); + return; } // Color if (t.equals(MQTT_TOPIC_COLOR) || t.equals(MQTT_TOPIC_COLOR_RGB)) { // DEPRECATE MQTT_TOPIC_COLOR lightColor(payload, true); lightUpdate(true, mqttForward()); + return; } if (t.equals(MQTT_TOPIC_COLOR_HSV)) { lightColor(payload, false); lightUpdate(true, mqttForward()); + return; } // Brightness if (t.equals(MQTT_TOPIC_BRIGHTNESS)) { _light_brightness = constrain(atoi(payload), 0, LIGHT_MAX_BRIGHTNESS); lightUpdate(true, mqttForward()); + return; } // Channel @@ -511,6 +539,7 @@ void _lightMQTTCallback(unsigned int type, const char * topic, const char * payl } lightChannel(channelID, atoi(payload)); lightUpdate(true, mqttForward()); + return; } } @@ -519,7 +548,7 @@ void _lightMQTTCallback(unsigned int type, const char * topic, const char * payl void lightMQTT() { - char buffer[12]; + char buffer[20]; if (_light_has_color) { @@ -548,6 +577,15 @@ void lightMQTT() { } +void lightMQTTGroup() { + String mqtt_group_color = getSetting("mqttGroupColor"); + if (mqtt_group_color.length()>0) { + char buffer[20]; + _toCSV(buffer, sizeof(buffer), true); + mqttSendRaw(mqtt_group_color.c_str(), buffer); + } +} + #endif // ----------------------------------------------------------------------------- @@ -566,7 +604,7 @@ unsigned char lightWhiteChannels() { return _light_channel.size() % 3; } -void lightUpdate(bool save, bool forward) { +void lightUpdate(bool save, bool forward, bool group_forward) { // Configure color transition _light_steps_left = _light_use_transitions ? LIGHT_TRANSITION_STEPS : 1; @@ -575,6 +613,7 @@ void lightUpdate(bool save, bool forward) { // Report color & brightness to MQTT broker #if MQTT_SUPPORT if (forward) lightMQTT(); + if (group_forward) lightMQTTGroup(); #endif // Report color to WS clients (using current brightness setting) @@ -589,6 +628,10 @@ void lightUpdate(bool save, bool forward) { }; +void lightUpdate(bool save, bool forward) { + lightUpdate(save, forward, true); +} + #if LIGHT_SAVE_ENABLED == 0 void lightSave() { _lightColorSave(); @@ -667,6 +710,7 @@ void lightBrightnessStep(int steps) { void _lightWebSocketOnSend(JsonObject& root) { root["colorVisible"] = 1; + root["mqttGroupColor"] = getSetting("mqttGroupColor"); root["useColor"] = _light_has_color; root["useWhite"] = _light_use_white; root["useGamma"] = _light_use_gamma; diff --git a/code/espurna/llmnr.ino b/code/espurna/llmnr.ino index 0a8b1db2..2cb73587 100644 --- a/code/espurna/llmnr.ino +++ b/code/espurna/llmnr.ino @@ -2,7 +2,7 @@ LLMNR MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/mdns.ino b/code/espurna/mdns.ino index 1cdc689e..90fce569 100644 --- a/code/espurna/mdns.ino +++ b/code/espurna/mdns.ino @@ -2,7 +2,7 @@ MDNS MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index fe6a0c7e..de7476fb 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -2,7 +2,7 @@ MIGRATE MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -683,6 +683,21 @@ void migrate() { setSetting("chLogic", 4, 0); setSetting("relays", 1); + #elif defined(ARILUX_AL_LC02) + + setSetting("board", 52); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("chGPIO", 0, 12); + setSetting("chGPIO", 1, 5); + setSetting("chGPIO", 2, 13); + setSetting("chGPIO", 3, 15); + setSetting("chLogic", 0, 0); + setSetting("chLogic", 1, 0); + setSetting("chLogic", 2, 0); + setSetting("chLogic", 3, 0); + setSetting("relays", 1); + #else // Allow users to define new settings without migration config diff --git a/code/espurna/mqtt.ino b/code/espurna/mqtt.ino index f7ab5784..03174bff 100644 --- a/code/espurna/mqtt.ino +++ b/code/espurna/mqtt.ino @@ -2,7 +2,7 @@ MQTT MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -45,6 +45,7 @@ bool _mqtt_forward; char *_mqtt_user = 0; char *_mqtt_pass = 0; char *_mqtt_will; +char *_mqtt_clientid; #if MQTT_SKIP_RETAINED unsigned long _mqtt_connected_at = 0; #endif @@ -209,6 +210,8 @@ void mqttRegister(mqtt_callback_f callback) { // Callbacks // ----------------------------------------------------------------------------- +#if WEB_SUPPORT + void _mqttWebSocketOnSend(JsonObject& root) { root["mqttVisible"] = 1; root["mqttStatus"] = mqttConnected(); @@ -216,6 +219,7 @@ void _mqttWebSocketOnSend(JsonObject& root) { root["mqttServer"] = getSetting("mqttServer", MQTT_SERVER); root["mqttPort"] = getSetting("mqttPort", MQTT_PORT); root["mqttUser"] = getSetting("mqttUser"); + root["mqttClientID"] = getSetting("mqttClientID"); root["mqttPassword"] = getSetting("mqttPassword"); root["mqttKeep"] = _mqtt_keepalive; root["mqttRetain"] = _mqtt_retain; @@ -229,6 +233,12 @@ void _mqttWebSocketOnSend(JsonObject& root) { root["mqttUseJson"] = getSetting("mqttUseJson", MQTT_USE_JSON).toInt() == 1; } +void _mqttConfigure() { + if (getSetting("mqttClientID").length() == 0) delSetting("mqttClientID"); +} + +#endif + void _mqttCallback(unsigned int type, const char * topic, const char * payload) { if (type == MQTT_CONNECT_EVENT) { @@ -385,17 +395,21 @@ void mqttConnect() { if (_mqtt_user) free(_mqtt_user); if (_mqtt_pass) free(_mqtt_pass); if (_mqtt_will) free(_mqtt_will); + if (_mqtt_clientid) free(_mqtt_clientid); _mqtt_user = strdup(getSetting("mqttUser", MQTT_USER).c_str()); _mqtt_pass = strdup(getSetting("mqttPassword", MQTT_PASS).c_str()); _mqtt_will = strdup((_mqtt_topic + MQTT_TOPIC_STATUS).c_str()); + _mqtt_clientid = strdup(getSetting("mqttClientID", getIdentifier()).c_str()); DEBUG_MSG_P(PSTR("[MQTT] Connecting to broker at %s:%d\n"), host, port); #if MQTT_USE_ASYNC _mqtt.setServer(host, port); - _mqtt.setKeepAlive(_mqtt_keepalive).setCleanSession(false); + _mqtt.setClientId(_mqtt_clientid); + _mqtt.setKeepAlive(_mqtt_keepalive); + _mqtt.setCleanSession(false); _mqtt.setWill(_mqtt_will, _mqtt_qos, _mqtt_retain, "0"); if ((strlen(_mqtt_user) > 0) && (strlen(_mqtt_pass) > 0)) { DEBUG_MSG_P(PSTR("[MQTT] Connecting as user %s\n"), _mqtt_user); @@ -418,9 +432,10 @@ void mqttConnect() { #endif // ASYNC_TCP_SSL_ENABLED - DEBUG_MSG_P(PSTR("[MQTT] Will topic: %s\n"), _mqtt_will); + DEBUG_MSG_P(PSTR("[MQTT] Client ID: %s\n"), _mqtt_clientid); DEBUG_MSG_P(PSTR("[MQTT] QoS: %d\n"), _mqtt_qos); DEBUG_MSG_P(PSTR("[MQTT] Retain flag: %d\n"), _mqtt_retain ? 1 : 0); + DEBUG_MSG_P(PSTR("[MQTT] Will topic: %s\n"), _mqtt_will); _mqtt.connect(); @@ -469,14 +484,15 @@ void mqttConnect() { if ((strlen(_mqtt_user) > 0) && (strlen(_mqtt_pass) > 0)) { DEBUG_MSG_P(PSTR("[MQTT] Connecting as user %s\n"), _mqtt_user); - response = _mqtt.connect(getIdentifier().c_str(), _mqtt_user, _mqtt_pass, _mqtt_will, _mqtt_qos, _mqtt_retain, "0"); + response = _mqtt.connect(_mqtt_clientid, _mqtt_user, _mqtt_pass, _mqtt_will, _mqtt_qos, _mqtt_retain, "0"); } else { - response = _mqtt.connect(getIdentifier().c_str(), _mqtt_will, _mqtt_qos, _mqtt_retain, "0"); + response = _mqtt.connect(_mqtt_clientid, _mqtt_will, _mqtt_qos, _mqtt_retain, "0"); } - DEBUG_MSG_P(PSTR("[MQTT] Will topic: %s\n"), _mqtt_will); + DEBUG_MSG_P(PSTR("[MQTT] Client ID: %s\n"), _mqtt_clientid); DEBUG_MSG_P(PSTR("[MQTT] QoS: %d\n"), _mqtt_qos); DEBUG_MSG_P(PSTR("[MQTT] Retain flag: %d\n"), _mqtt_retain ? 1 : 0); + DEBUG_MSG_P(PSTR("[MQTT] Will topic: %s\n"), _mqtt_will); } @@ -589,6 +605,7 @@ void mqttSetup() { #if WEB_SUPPORT wsOnSendRegister(_mqttWebSocketOnSend); + wsOnAfterParseRegister(_mqttConfigure); #endif } diff --git a/code/espurna/netbios.ino b/code/espurna/netbios.ino index 478b81f9..418a1843 100644 --- a/code/espurna/netbios.ino +++ b/code/espurna/netbios.ino @@ -2,7 +2,7 @@ NETBIOS MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/nofuss.ino b/code/espurna/nofuss.ino index 6350b82e..004ba713 100644 --- a/code/espurna/nofuss.ino +++ b/code/espurna/nofuss.ino @@ -2,7 +2,7 @@ NOFUSS MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/ntp.ino b/code/espurna/ntp.ino index 0bc30f88..d387e4ac 100644 --- a/code/espurna/ntp.ino +++ b/code/espurna/ntp.ino @@ -2,7 +2,7 @@ NTP MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/ota.ino b/code/espurna/ota.ino index 457fd576..d1aad3ad 100644 --- a/code/espurna/ota.ino +++ b/code/espurna/ota.ino @@ -2,7 +2,7 @@ OTA MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -15,7 +15,9 @@ Copyright (C) 2016-2017 by Xose Pérez void _otaConfigure() { ArduinoOTA.setPort(OTA_PORT); ArduinoOTA.setHostname(getSetting("hostname").c_str()); - ArduinoOTA.setPassword(getSetting("adminPass", ADMIN_PASS).c_str()); + #if USE_PASSWORD + ArduinoOTA.setPassword(getSetting("adminPass", ADMIN_PASS).c_str()); + #endif } // ----------------------------------------------------------------------------- diff --git a/code/espurna/relay.ino b/code/espurna/relay.ino index 5834f353..48b19240 100644 --- a/code/espurna/relay.ino +++ b/code/espurna/relay.ino @@ -2,7 +2,7 @@ RELAY MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -345,7 +345,7 @@ void _relayBoot() { case RELAY_BOOT_SAME: status = ((mask & bit) == bit); break; - case RELAY_BOOT_TOOGLE: + case RELAY_BOOT_TOGGLE: status = ((mask & bit) != bit); mask ^= bit; trigger_save = true; @@ -364,7 +364,7 @@ void _relayBoot() { bit <<= 1; } - // Save if there is any relay in the RELAY_BOOT_TOOGLE mode + // Save if there is any relay in the RELAY_BOOT_TOGGLE mode if (trigger_save) { EEPROM.write(EEPROM_RELAY_STATUS, mask); EEPROM.commit(); diff --git a/code/espurna/rf.ino b/code/espurna/rf.ino index 384fca8d..34597b4c 100644 --- a/code/espurna/rf.ino +++ b/code/espurna/rf.ino @@ -2,7 +2,7 @@ RF MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/rfbridge.ino b/code/espurna/rfbridge.ino index e340bfe3..4979e8d6 100644 --- a/code/espurna/rfbridge.ino +++ b/code/espurna/rfbridge.ino @@ -2,7 +2,7 @@ ITEAD RF BRIDGE MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ @@ -300,11 +300,14 @@ void _rfbReceive() { //DEBUG_MSG_P(PSTR("[RFBRIDGE] Received 0x%02X\n"), c); if (receiving) { - if (c == RF_CODE_STOP) { + if (c == RF_CODE_STOP && (_uartpos == 1 || _uartpos == 10)) { _rfbDecode(); receiving = false; - } else { + } else if (_uartpos < 10) { _uartbuf[_uartpos++] = c; + } else { + // wrong message, should have received a RF_CODE_STOP + receiving = false; } } else if (c == RF_CODE_START) { _uartpos = 0; diff --git a/code/espurna/sensor.ino b/code/espurna/sensor.ino index fefe633b..ab2c16c7 100644 --- a/code/espurna/sensor.ino +++ b/code/espurna/sensor.ino @@ -2,7 +2,7 @@ SENSOR MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/sensors/AnalogSensor.h b/code/espurna/sensors/AnalogSensor.h index 12d76923..abf23460 100644 --- a/code/espurna/sensors/AnalogSensor.h +++ b/code/espurna/sensors/AnalogSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Analog Sensor (maps to an analogRead) -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && ANALOG_SUPPORT diff --git a/code/espurna/sensors/BH1750Sensor.h b/code/espurna/sensors/BH1750Sensor.h index 93b44448..47a84927 100644 --- a/code/espurna/sensors/BH1750Sensor.h +++ b/code/espurna/sensors/BH1750Sensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // BH1750 Liminosity sensor over I2C -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && BH1750_SUPPORT diff --git a/code/espurna/sensors/BMX280Sensor.h b/code/espurna/sensors/BMX280Sensor.h index 29d5aa2f..af585629 100644 --- a/code/espurna/sensors/BMX280Sensor.h +++ b/code/espurna/sensors/BMX280Sensor.h @@ -1,7 +1,7 @@ // ----------------------------------------------------------------------------- // BME280/BMP280 Sensor over I2C // Uses SparkFun BME280 library -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && BMX280_SUPPORT diff --git a/code/espurna/sensors/BaseSensor.h b/code/espurna/sensors/BaseSensor.h index 394e2418..04840d1c 100644 --- a/code/espurna/sensors/BaseSensor.h +++ b/code/espurna/sensors/BaseSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Abstract sensor class (other sensor classes extend this class) -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT diff --git a/code/espurna/sensors/DHTSensor.h b/code/espurna/sensors/DHTSensor.h index ba4e48b0..8fa295ba 100644 --- a/code/espurna/sensors/DHTSensor.h +++ b/code/espurna/sensors/DHTSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // DHTXX Sensor -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && DHT_SUPPORT @@ -137,7 +137,11 @@ class DHTSensor : public BaseSensor { pinMode(_gpio, OUTPUT); noInterrupts(); digitalWrite(_gpio, LOW); - delayMicroseconds(_type == DHT_CHIP_DHT11 ? 20000 : 500); + if (_type == DHT_CHIP_DHT11) { + delay(20); + } else { + delayMicroseconds(500); + } digitalWrite(_gpio, HIGH); delayMicroseconds(40); pinMode(_gpio, INPUT_PULLUP); diff --git a/code/espurna/sensors/DallasSensor.h b/code/espurna/sensors/DallasSensor.h index dadd0f1e..985fa0f9 100644 --- a/code/espurna/sensors/DallasSensor.h +++ b/code/espurna/sensors/DallasSensor.h @@ -1,7 +1,7 @@ // ----------------------------------------------------------------------------- // Dallas OneWire Sensor // Uses OneWire library -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && DALLAS_SUPPORT diff --git a/code/espurna/sensors/DigitalSensor.h b/code/espurna/sensors/DigitalSensor.h index e72607da..39205cc4 100644 --- a/code/espurna/sensors/DigitalSensor.h +++ b/code/espurna/sensors/DigitalSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Digital Sensor (maps to a digitalRead) -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && DIGITAL_SUPPORT diff --git a/code/espurna/sensors/ECH1560Sensor.h b/code/espurna/sensors/ECH1560Sensor.h index c4b87cbc..c5b40946 100644 --- a/code/espurna/sensors/ECH1560Sensor.h +++ b/code/espurna/sensors/ECH1560Sensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // ECH1560 based power monitor -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && ECH1560_SUPPORT diff --git a/code/espurna/sensors/EmonADC121Sensor.h b/code/espurna/sensors/EmonADC121Sensor.h index a8335ce7..d96d4aec 100644 --- a/code/espurna/sensors/EmonADC121Sensor.h +++ b/code/espurna/sensors/EmonADC121Sensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // ADS121-based Energy Monitor Sensor over I2C -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && EMON_ADC121_SUPPORT diff --git a/code/espurna/sensors/EmonADS1X15Sensor.h b/code/espurna/sensors/EmonADS1X15Sensor.h index 2691da9e..e355b88e 100644 --- a/code/espurna/sensors/EmonADS1X15Sensor.h +++ b/code/espurna/sensors/EmonADS1X15Sensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // ADS1X15-based Energy Monitor Sensor over I2C -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && EMON_ADS1X15_SUPPORT diff --git a/code/espurna/sensors/EmonAnalogSensor.h b/code/espurna/sensors/EmonAnalogSensor.h index 767825a3..bbabbe26 100644 --- a/code/espurna/sensors/EmonAnalogSensor.h +++ b/code/espurna/sensors/EmonAnalogSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Energy Monitor Sensor using builtin ADC -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && EMON_ANALOG_SUPPORT diff --git a/code/espurna/sensors/EmonSensor.h b/code/espurna/sensors/EmonSensor.h index 8bb6eed4..ad12189c 100644 --- a/code/espurna/sensors/EmonSensor.h +++ b/code/espurna/sensors/EmonSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Abstract Energy Monitor Sensor (other EMON sensors extend this class) -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT diff --git a/code/espurna/sensors/EventSensor.h b/code/espurna/sensors/EventSensor.h index c593be04..e10b4bb8 100644 --- a/code/espurna/sensors/EventSensor.h +++ b/code/espurna/sensors/EventSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Event Counter Sensor -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && EVENTS_SUPPORT diff --git a/code/espurna/sensors/HLW8012Sensor.h b/code/espurna/sensors/HLW8012Sensor.h index 5a45241c..e20cc83b 100644 --- a/code/espurna/sensors/HLW8012Sensor.h +++ b/code/espurna/sensors/HLW8012Sensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Event Counter Sensor -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && HLW8012_SUPPORT diff --git a/code/espurna/sensors/I2CSensor.h b/code/espurna/sensors/I2CSensor.h index f4391d03..1d6cebc6 100644 --- a/code/espurna/sensors/I2CSensor.h +++ b/code/espurna/sensors/I2CSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // Abstract I2C sensor class (other sensor classes extend this class) -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && ( I2C_SUPPORT || EMON_ANALOG_SUPPORT ) diff --git a/code/espurna/sensors/MHZ19Sensor.h b/code/espurna/sensors/MHZ19Sensor.h index 576d649b..fc08fb9b 100644 --- a/code/espurna/sensors/MHZ19Sensor.h +++ b/code/espurna/sensors/MHZ19Sensor.h @@ -3,7 +3,7 @@ // Based on: https://github.com/nara256/mhz19_uart // http://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf // Uses SoftwareSerial library -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && MHZ19_SUPPORT diff --git a/code/espurna/sensors/SHT3XI2CSensor.h b/code/espurna/sensors/SHT3XI2CSensor.h index 95e149fe..74b29d61 100644 --- a/code/espurna/sensors/SHT3XI2CSensor.h +++ b/code/espurna/sensors/SHT3XI2CSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // SHT3X Sensor over I2C (Wemos) -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && SHT3X_I2C_SUPPORT diff --git a/code/espurna/sensors/SI7021Sensor.h b/code/espurna/sensors/SI7021Sensor.h index 6dbfb457..04d75775 100644 --- a/code/espurna/sensors/SI7021Sensor.h +++ b/code/espurna/sensors/SI7021Sensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // SI7021 / HTU21D Sensor over I2C -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && SI7021_SUPPORT diff --git a/code/espurna/sensors/V9261FSensor.h b/code/espurna/sensors/V9261FSensor.h index 4ffdeb20..b38a36b5 100644 --- a/code/espurna/sensors/V9261FSensor.h +++ b/code/espurna/sensors/V9261FSensor.h @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- // V9261F based power monitor -// Copyright (C) 2017 by Xose Pérez +// Copyright (C) 2017-2018 by Xose Pérez // ----------------------------------------------------------------------------- #if SENSOR_SUPPORT && V9261F_SUPPORT diff --git a/code/espurna/settings.ino b/code/espurna/settings.ino index b8b0f90f..81d9719f 100644 --- a/code/espurna/settings.ino +++ b/code/espurna/settings.ino @@ -2,7 +2,7 @@ SETTINGS MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ diff --git a/code/espurna/ssdp.ino b/code/espurna/ssdp.ino index 9b4ca697..87f7df86 100644 --- a/code/espurna/ssdp.ino +++ b/code/espurna/ssdp.ino @@ -2,7 +2,7 @@ SSDP MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez Uses SSDP library by PawelDino (https://github.com/PawelDino) https://github.com/esp8266/Arduino/issues/2283#issuecomment-299635604 diff --git a/code/espurna/telnet.ino b/code/espurna/telnet.ino index c0b2f1b9..228d0b62 100644 --- a/code/espurna/telnet.ino +++ b/code/espurna/telnet.ino @@ -2,7 +2,7 @@ TELNET MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez Parts of the code have been borrowed from Thomas Sarlandie's NetServer (https://github.com/sarfata/kbox-firmware/tree/master/src/esp) diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index 6eec91ec..c28f4a34 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -2,7 +2,7 @@ UTILS MODULE -Copyright (C) 2017 by Xose Pérez +Copyright (C) 2017-2018 by Xose Pérez */ diff --git a/code/espurna/web.ino b/code/espurna/web.ino index 43de5ea3..a628410e 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -2,7 +2,7 @@ WEBSERVER MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -267,10 +267,14 @@ void _onUpgradeData(AsyncWebServerRequest *request, String filename, size_t inde // ----------------------------------------------------------------------------- bool _authenticate(AsyncWebServerRequest *request) { - String password = getSetting("adminPass", ADMIN_PASS); - char httpPassword[password.length() + 1]; - password.toCharArray(httpPassword, password.length() + 1); - return request->authenticate(WEB_USERNAME, httpPassword); + #if USE_PASSWORD + String password = getSetting("adminPass", ADMIN_PASS); + char httpPassword[password.length() + 1]; + password.toCharArray(httpPassword, password.length() + 1); + return request->authenticate(WEB_USERNAME, httpPassword); + #else + return true; + #endif } // ----------------------------------------------------------------------------- diff --git a/code/espurna/wifi.ino b/code/espurna/wifi.ino index 81a45442..528a584d 100644 --- a/code/espurna/wifi.ino +++ b/code/espurna/wifi.ino @@ -2,7 +2,7 @@ WIFI MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -73,7 +73,11 @@ void wifiReconnectCheck() { void wifiConfigure() { jw.setHostname(getSetting("hostname").c_str()); - jw.setSoftAP(getSetting("hostname").c_str(), getSetting("adminPass", ADMIN_PASS).c_str()); + #if USE_PASSWORD + jw.setSoftAP(getSetting("hostname").c_str(), getSetting("adminPass", ADMIN_PASS).c_str()); + #else + jw.setSoftAP(getSetting("hostname").c_str()); + #endif jw.setConnectTimeout(WIFI_CONNECT_TIMEOUT); wifiReconnectCheck(); jw.setAPMode(WIFI_AP_MODE); diff --git a/code/espurna/ws.ino b/code/espurna/ws.ino index 117947e0..fb750e32 100644 --- a/code/espurna/ws.ino +++ b/code/espurna/ws.ino @@ -2,7 +2,7 @@ WEBSOCKET MODULE -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez */ @@ -205,7 +205,7 @@ void _wsParse(AsyncWebSocketClient *client, uint8_t * payload, size_t length) { void _wsOnStart(JsonObject& root) { - #if WEB_FORCE_PASS_CHANGE + #if USE_PASSWORD && WEB_FORCE_PASS_CHANGE String adminPass = getSetting("adminPass", ADMIN_PASS); bool changePassword = adminPass.equals(ADMIN_PASS); #else @@ -350,7 +350,9 @@ void wsSend_P(uint32_t client_id, PGM_P payload) { } void wsConfigure() { - _ws.setAuthentication(WEB_USERNAME, (const char *) getSetting("adminPass", ADMIN_PASS).c_str()); + #if USE_PASSWORD + _ws.setAuthentication(WEB_USERNAME, (const char *) getSetting("adminPass", ADMIN_PASS).c_str()); + #endif } void wsSetup() { diff --git a/code/extra_scripts.py b/code/extra_scripts.py new file mode 100644 index 00000000..2a0a42f1 --- /dev/null +++ b/code/extra_scripts.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +Import("env") + +# ------------------------------------------------------------------------------ +# Utils +# ------------------------------------------------------------------------------ + +class Color: + BLACK = '\x1b[1;30m' + RED = '\x1b[1;31m' + GREEN = '\x1b[1;32m' + YELLOW = '\x1b[1;33m' + BLUE = '\x1b[1;34m' + MAGENTA = '\x1b[1;35m' + CYAN = '\x1b[1;36m' + WHITE = '\x1b[1;37m' + LIGHT_GREY = '\x1b[0;30m' + LIGHT_RED = '\x1b[0;31m' + LIGHT_GREEN = '\x1b[0;32m' + LIGHT_YELLOW = '\x1b[0;33m' + LIGHT_BLUE = '\x1b[0;34m' + LIGHT_MAGENTA = '\x1b[0;35m' + LIGHT_CYAN = '\x1b[0;36m' + LIGHT_WHITE = '\x1b[0;37m' + +def clr(color, text): + return color + str(text) + '\x1b[0m' + +# ------------------------------------------------------------------------------ +# Callbacks +# ------------------------------------------------------------------------------ + +def check_size(source, target, env): + size = target[0].get_size() + print clr(Color.LIGHT_BLUE, "Binary size: %s bytes" % size) + if size > 512000: + print clr(Color.LIGHT_RED, "File too large for OTA!") + Exit(1) + +# ------------------------------------------------------------------------------ +# Hooks +# ------------------------------------------------------------------------------ + +env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_size) diff --git a/code/gulpfile.js b/code/gulpfile.js index 9ba13b30..5b4db6c5 100644 --- a/code/gulpfile.js +++ b/code/gulpfile.js @@ -2,7 +2,7 @@ ESP8266 file system builder -Copyright (C) 2016-2017 by Xose Pérez +Copyright (C) 2016-2018 by Xose Pérez This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/code/html/index.html b/code/html/index.html index 40df6a3c..b73d0952 100644 --- a/code/html/index.html +++ b/code/html/index.html @@ -133,7 +133,7 @@ +
+
+
+
+
Sync color between different lights.
+
+ @@ -564,9 +571,19 @@ +
+ + +
+
+
+ If left empty the firmware will generate a client ID based on the serial number of the chip. +
+
+
- @@ -575,22 +592,22 @@
-
+
- +
-
+
- +
This is the fingerprint for the SSL certificate of the server.
@@ -602,7 +619,7 @@
- +
This is the root topic for this device. A trailing slash will be added if not preset. The {identifier} placeholder will be replaced by the device hostname.
@@ -618,7 +635,7 @@
-
+
All messages (except the device status) will be included in a JSON payload along with the timestamp and hostname @@ -983,7 +1000,7 @@ - +
diff --git a/code/memanalyzer.py b/code/memanalyzer.py index a2903643..ee1f6a52 100644 --- a/code/memanalyzer.py +++ b/code/memanalyzer.py @@ -19,6 +19,7 @@ import shlex import commands import subprocess import sys +import os import re import argparse @@ -39,6 +40,12 @@ description = "ESPurna Memory Analyzer v0.1" #------------------------------------------------------------------------------- +def file_size(file): + try: + return os.stat(file).st_size + except: + return 0 + def analyse_memory(elf_file): command = "%s -t '%s' " % (objdump_binary, elf_file) @@ -107,7 +114,7 @@ try: # Parse command line options parser = argparse.ArgumentParser(description=description) - parser.add_argument("modules", nargs='*', help="Modules to test") + parser.add_argument("modules", nargs='*', help="Modules to test (use ALL to test them all)") parser.add_argument("-c", "--core", help="use core as base configuration instead of default", default=0, action='count') parser.add_argument("-l", "--list", help="list available modules", default=0, action='count') args = parser.parse_args() @@ -133,10 +140,12 @@ try: sys.exit(0) # Which modules to test? + test_modules = [] if len(args.modules) > 0: - test_modules = args.modules - else: - test_modules = available_modules.keys() + if "ALL" in args.modules: + test_modules = available_modules.keys() + else: + test_modules = args.modules # Check test modules exist for module in test_modules: @@ -153,20 +162,26 @@ try: modules = available_modules # Show init message - print "Analyzing module(s) %s on top of %s configuration\n" % (", ".join(test_modules), "CORE" if args.core > 0 else "DEFAULT") - output_format="{:<20}|{:<11}|{:<11}|{:<11}|{:<11}|{:<11}" + if len(test_modules) > 0: + print "Analyzing module(s) %s on top of %s configuration\n" % (", ".join(test_modules), "CORE" if args.core > 0 else "DEFAULT") + else: + print "Analyzing %s configuration\n" % ("CORE" if args.core > 0 else "DEFAULT") + + output_format="{:<20}|{:<11}|{:<11}|{:<11}|{:<11}|{:<11}|{:<12}" print(output_format.format( "Module", "Cache IRAM", "Init RAM", "R.O. RAM", "Uninit RAM", - "Flash ROM" + "Flash ROM", + "Binary size" )) # Build the core without modules to get base memory usage run(env, modules) - base = analyse_memory(".pioenvs/"+env+"/firmware.elf") + base = analyse_memory(".pioenvs/%s/firmware.elf" % env) + base['size'] = file_size(".pioenvs/%s/firmware.bin" % env) print(output_format.format( "CORE" if args.core == 1 else "DEFAULT", base['text'], @@ -174,6 +189,7 @@ try: base['rodata'], base['bss'], base['irom0_text'], + base['size'], )) # Test each module @@ -182,7 +198,8 @@ try: modules[module] = 1 run(env, modules) - results[module]=analyse_memory(".pioenvs/"+env+"/firmware.elf") + results[module]=analyse_memory(".pioenvs/%s/firmware.elf" % env) + results[module]['size'] = file_size(".pioenvs/%s/firmware.bin" % env) modules[module] = 0 print(output_format.format( @@ -192,33 +209,39 @@ try: results[module]['rodata'] - base['rodata'], results[module]['bss'] - base['bss'], results[module]['irom0_text'] - base['irom0_text'], + results[module]['size'] - base['size'], )) # Test all modules - for module in test_modules: - modules[module] = 1 - run(env, modules) - total = analyse_memory(".pioenvs/"+env+"/firmware.elf") + if len(test_modules) > 0: + + for module in test_modules: + modules[module] = 1 + run(env, modules) + total = analyse_memory(".pioenvs/%s/firmware.elf" % env) + total['size'] = file_size(".pioenvs/%s/firmware.bin" % env) + + if len(test_modules) > 1: + print(output_format.format( + "ALL MODULES", + total['text'] - base['text'], + total['data'] - base['data'], + total['rodata'] - base['rodata'], + total['bss'] - base['bss'], + total['irom0_text'] - base['irom0_text'], + total['size'] - base['size'], + )) - if len(test_modules) > 1: print(output_format.format( - "ALL MODULES", - total['text'] - base['text'], - total['data'] - base['data'], - total['rodata'] - base['rodata'], - total['bss'] - base['bss'], - total['irom0_text'] - base['irom0_text'], + "TOTAL", + total['text'], + total['data'], + total['rodata'], + total['bss'], + total['irom0_text'], + total['size'], )) - print(output_format.format( - "TOTAL", - total['text'], - total['data'], - total['rodata'], - total['bss'], - total['irom0_text'], - )) - except: raise diff --git a/code/ota.py b/code/ota.py new file mode 100644 index 00000000..8e5a4bc6 --- /dev/null +++ b/code/ota.py @@ -0,0 +1,210 @@ +#!/usr/bin/env python +#------------------------------------------------------------------------------- +# ESPurna OTA manager +# xose.perez@gmail.com +# +# Requires PlatformIO Core +#------------------------------------------------------------------------------- + +import sys +import re +import logging +import socket +import argparse +import subprocess +from time import sleep +from zeroconf import ServiceBrowser, ServiceStateChange, Zeroconf + +#------------------------------------------------------------------------------- + +devices = [] +description = "ESPurna OTA Manager v0.1" + +#------------------------------------------------------------------------------- + +def on_service_state_change(zeroconf, service_type, name, state_change): + ''' + Callback that adds discovered devices to "devices" list + ''' + + if state_change is ServiceStateChange.Added: + info = zeroconf.get_service_info(service_type, name) + if info: + hostname = info.server.split(".")[0] + device = { + 'hostname': hostname.upper(), + 'ip': socket.inet_ntoa(info.address) + } + device['app'] = info.properties.get('app_name', '') + device['version'] = info.properties.get('app_version', '') + device['device'] = info.properties.get('target_board', '') + device['mem_size'] = info.properties.get('mem_size', '') + device['sdk_size'] = info.properties.get('sdk_size', '') + devices.append(device) + +def list(): + ''' + Shows the list of discovered devices + ''' + output_format="{:>3} {:<25}{:<25}{:<15}{:<15}{:<30}{:<10}{:<10}" + print(output_format.format( + "#", + "HOSTNAME", + "IP", + "APP", + "VERSION", + "DEVICE", + "MEM_SIZE", + "SDK_SIZE", + )) + print "-" * 135 + + index = 0 + for device in devices: + index = index + 1 + print(output_format.format( + index, + device.get('hostname', ''), + device.get('ip', ''), + device.get('app', ''), + device.get('version', ''), + device.get('device', ''), + device.get('mem_size', ''), + device.get('sdk_size', ''), + )) + + print + +def get_boards(): + ''' + Grabs board types fro hardware.h file + ''' + boards = [] + for line in open("espurna/config/hardware.h"): + m = re.search(r'defined\((\w*)\)', line) + if m: + boards.append(m.group(1)) + return sorted(boards) + +def flash(): + ''' + Grabs info from the user about what device to flash + ''' + + # Choose the board + try: + index = int(input("Choose the board you want to flash (empty if none of these): ")) + except: + index = 0 + if index < 0 or len(devices) < index: + print "Board number must be between 1 and %s\n" % str(len(devices)) + return None + + board = {'board': '', 'ip': '', 'size': 0 , 'auth': '', 'flags': ''} + + if index > 0: + device = devices[index-1] + board['board'] = device.get('device', '') + board['ip'] = device.get('ip', '') + board['size'] = int(device.get('mem_size', 0) if device.get('mem_size', 0) == device.get('sdk_size', 0) else 0) / 1024 + + # Choose board type if none before + if len(board['board']) == 0: + + print + count = 1 + boards = get_boards() + for name in boards: + print "%3d\t%s" % (count, name) + count = count + 1 + print + + try: + index = int(input("Choose the board type you want to flash: ")) + except: + index = 0 + if index < 1 or len(boards) < index: + print "Board number must be between 1 and %s\n" % str(len(boards)) + return None + board['board'] = boards[index-1] + + # Choose board size of none before + if board['size'] == 0: + try: + board['size'] = int(input("Board memory size (1 for 1M, 4 for 4M): ")) + except: + print "Wrong memory size" + return None + + # Choose IP of none before + if len(board['ip']) == 0: + try: + board['ip'] = raw_input("IP of the device to flash (empty for 192.168.4.1): ") or "192.168.4.1" + except: + print "Wrong IP" + return None + + board['auth'] = raw_input("Authorization key of the device to flash: ") + board['flags'] = raw_input("Extra flags for the build: ") + + return board + +def run(device, env): + command = "export ESPURNA_IP=\"%s\"; export ESPURNA_BOARD=\"%s\"; export ESPURNA_AUTH=\"%s\"; export ESPURNA_FLAGS=\"%s\"; platformio run --silent --environment %s -t upload" + command = command % (device['ip'], device['board'], device['auth'], device['flags'], env) + subprocess.check_call(command, shell=True) + +#------------------------------------------------------------------------------- + +if __name__ == '__main__': + + # Parse command line options + parser = argparse.ArgumentParser(description=description) + #parser.add_argument("-v", "--verbose", help="show verbose output", default=0, action='count') + parser.add_argument("-f", "--flash", help="flash device", default=0, action='count') + parser.add_argument("-s", "--sort", help="sort devices list by field", default='hostname') + args = parser.parse_args() + + print + print description + print + + # Enable logging if verbose + #logging.basicConfig(level=logging.DEBUG) + #logging.getLogger('zeroconf').setLevel(logging.DEBUG) + + # Look for sevices + zeroconf = Zeroconf() + browser = ServiceBrowser(zeroconf, "_arduino._tcp.local.", handlers=[on_service_state_change]) + sleep(1) + zeroconf.close() + + # Sort list + field = args.sort.lower() + if field not in devices[0]: + print "Unknown field '%s'\n" % field + sys.exit(1) + devices = sorted(devices, key=lambda device: device.get(field, '')) + + # List devices + list() + + # Flash device + if args.flash > 0: + device = flash() + if device: + + env = "esp8266-%sm-ota" % device['size'] + + # Summary + print + print "ESPURNA_IP = %s" % device['ip'] + print "ESPURNA_BOARD = %s" % device['board'] + print "ESPURNA_AUTH = %s" % device['auth'] + print "ESPURNA_FLAGS = %s" % device['flags'] + print "ESPURNA_ENV = %s" % env + + response = raw_input("\nAre these values right [y/N]: ") + print + if response == "y": + run(device, env) diff --git a/code/ota_flash.sh b/code/ota_flash.sh deleted file mode 100755 index aef002cf..00000000 --- a/code/ota_flash.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/bash - -ip= -board= -size= -auth= -flags= - -export boards=() -ips="" - -exists() { - command -v "$1" >/dev/null 2>&1 -} - -echo_pad() { - string=$1 - pad=$2 - printf '%s' "$string" - printf '%*s' $(( $pad - ${#string} )) -} - -useAvahi() { - - echo_pad "#" 4 - echo_pad "HOSTNAME" 25 - echo_pad "IP" 25 - echo_pad "APP" 15 - echo_pad "VERSION" 15 - echo_pad "DEVICE" 30 - echo_pad "MEM_SIZE" 10 - echo_pad "SDK_SIZE" 10 - echo - - printf -v line '%*s\n' 134 - echo ${line// /-} - - counter=0 - - ip_file="/tmp/espurna.flash.ips" - board_file="/tmp/espurna.flash.boards" - count_file="/tmp/espurna.flash.count" - size_file="/tmp/espurna.flash.size" - echo -n "" > $ip_file - echo -n "" > $board_file - echo -n "" > $size_file - echo -n "$counter" > $count_file - - avahi-browse -t -r -p "_arduino._tcp" 2>/dev/null | grep ^= | sort -t ';' -k 3 | while read line; do - - (( counter++ )) - echo "$counter" > $count_file - - hostname=`echo $line | cut -d ';' -f4` - ip=`echo $line | cut -d ';' -f8` - txt=`echo $line | cut -d ';' -f10` - app_name=`echo $txt | sed -n "s/.*app_name=\([^\"]*\).*/\1/p"` - app_version=`echo $txt | sed -n "s/.*app_version=\([^\"]*\).*/\1/p"` - board=`echo $txt | sed -n "s/.*target_board=\([^\"]*\).*/\1/p"` - mem_size=`echo $txt | sed -n "s/.*mem_size=\([^\"]*\).*/\1/p"` - sdk_size=`echo $txt | sed -n "s/.*sdk_size=\([^\"]*\).*/\1/p"` - - echo_pad "$counter" 4 - echo_pad "$hostname" 25 - echo_pad "http://$ip" 25 - echo_pad "$app_name" 15 - echo_pad "$app_version" 15 - echo_pad "$board" 30 - echo_pad "$mem_size" 10 - echo_pad "$sdk_size" 10 - echo - - echo -n "$ip;" >> $ip_file - echo -n "$board;" >> $board_file - if [ "$mem_size" == "$sdk_size" ]; then - mem_size=`echo $mem_size | head -c 1` - echo -n "$mem_size;" >> $size_file - else - echo -n ";" >> $size_file - fi - - done - - echo - read -p "Choose the board you want to flash (empty if none of these): " num - - # None of these - if [ "$num" == "" ]; then - return - fi - - # Check boundaries - counter=`cat $count_file` - if [ $num -lt 1 ] || [ $num -gt $counter ]; then - echo "Board number must be between 1 and $counter" - exit 1 - fi - - # Fill the fields - ip=`cat $ip_file | cut -d ';' -f$num` - board=`cat $board_file | cut -d ';' -f$num` - size=`cat $size_file | cut -d ';' -f$num` - -} - -getBoard() { - - boards=(`cat espurna/config/hardware.h | grep "defined" | sed "s/.*(\(.*\)).*/\1/" | sort`) - - echo_pad "#" 4 - echo_pad "DEVICE" 30 - echo - - printf -v line '%*s\n' 34 - echo ${line// /-} - - counter=0 - for board in "${boards[@]}"; do - (( counter++ )) - echo_pad "$counter" 4 - echo_pad "$board" 30 - echo - done - - echo - read -p "Choose the board you want to flash (empty if none of these): " num - - # None of these - if [ "$num" == "" ]; then - return - fi - - # Check boundaries - counter=${#boards[*]} - if [ $num -lt 1 ] || [ $num -gt $counter ]; then - echo "Board code must be between 1 and $counter" - exit 1 - fi - - # Fill the fields - (( num -- )) - board=${boards[$num]} - -} - -# ------------------------------------------------------------------------------ - -# Welcome -echo -echo "--------------------------------------------------------------" -echo "ESPURNA FIRMWARE OTA FLASHER" - -# Get current version -version=`cat espurna/config/version.h | grep APP_VERSION | awk '{print $3}' | sed 's/"//g'` -echo "Building for version $version" - -echo "--------------------------------------------------------------" -echo - -if exists avahi-browse; then - useAvahi -fi - -if [ "$board" == "" ]; then - getBoard -fi - -if [ "$board" == "" ]; then - read -p "Board type of the device to flash: " -e -i "NODEMCU_LOLIN" board -fi - -if [ "$board" == "" ]; then - echo "You must define the board type" - exit 2 -fi - -if [ "$size" == "" ]; then - read -p "Board memory size (1 for 1M, 4 for 4M): " -e size -fi - -if [ "$size" == "" ]; then - echo "You must define the board memory size" - exit 2 -fi - -if [ "$ip" == "" ]; then - read -p "IP of the device to flash: " -e -i 192.168.4.1 ip -fi - -if [ "$ip" == "" ]; then - echo "You must define the IP of the device" - exit 2 -fi - -if [ "$auth" == "" ]; then - read -p "Authorization key of the device to flash: " auth -fi - -if [ "$flags" == "" ]; then - read -p "Extra flags for the build: " -e -i "" flags -fi - -env="esp8266-${size}m-ota" - -echo -echo "ESPURNA_IP = $ip" -echo "ESPURNA_BOARD = $board" -echo "ESPURNA_AUTH = $auth" -echo "ESPURNA_FLAGS = $flags" -echo "ESPURNA_ENV = $env" - -echo -echo -n "Are these values corrent [y/N]: " -read response - -if [ "$response" != "y" ]; then - exit -fi - -export ESPURNA_IP=$ip -export ESPURNA_BOARD=$board -export ESPURNA_AUTH=$auth -export ESPURNA_FLAGS=$flags - -pio run -e $env -t upload diff --git a/code/ota_list.sh b/code/ota_list.sh deleted file mode 100755 index 6a988db9..00000000 --- a/code/ota_list.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -exists() { - command -v "$1" >/dev/null 2>&1 -} - -echo_pad() { - string=$1 - pad=$2 - printf '%s' "$string" - printf '%*s' $(( $pad - ${#string} )) -} - -useAvahi() { - - echo_pad "#" 4 - echo_pad "HOSTNAME" 25 - echo_pad "IP" 25 - echo_pad "APP" 15 - echo_pad "VERSION" 15 - echo_pad "DEVICE" 30 - echo_pad "MEM_SIZE" 10 - echo_pad "SDK_SIZE" 10 - echo - - printf -v line '%*s\n' 134 - echo ${line// /-} - - counter=0 - - avahi-browse -t -r -p "_arduino._tcp" 2>/dev/null | grep ^= | sort -t ';' -k 3 | while read line; do - - (( counter++ )) - - hostname=`echo $line | cut -d ';' -f4` - ip=`echo $line | cut -d ';' -f8` - txt=`echo $line | cut -d ';' -f10` - app_name=`echo $txt | sed -n "s/.*app_name=\([^\"]*\).*/\1/p"` - app_version=`echo $txt | sed -n "s/.*app_version=\([^\"]*\).*/\1/p"` - board=`echo $txt | sed -n "s/.*target_board=\([^\"]*\).*/\1/p"` - mem_size=`echo $txt | sed -n "s/.*mem_size=\([^\"]*\).*/\1/p"` - sdk_size=`echo $txt | sed -n "s/.*sdk_size=\([^\"]*\).*/\1/p"` - - echo_pad "$counter" 4 - echo_pad "$hostname" 25 - echo_pad "http://$ip" 25 - echo_pad "$app_name" 15 - echo_pad "$app_version" 15 - echo_pad "$board" 30 - echo_pad "$mem_size" 10 - echo_pad "$sdk_size" 10 - echo - - done - - echo - -} - -# ------------------------------------------------------------------------------ - -# Welcome -echo -echo "--------------------------------------------------------------" -echo "OTA-UPDATABLE DEVICES" -echo "--------------------------------------------------------------" -echo - -if exists avahi-browse; then - useAvahi -else - echo "Avahi not installed" - exit 1 -fi diff --git a/code/platformio.ini b/code/platformio.ini index a50af3c8..f87550a7 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -4,8 +4,8 @@ src_dir = espurna data_dir = espurna/data [common] -platform = espressif8266 -#platform = https://github.com/platformio/platform-espressif8266.git#feature/stage +#platform = espressif8266 +platform = https://github.com/platformio/platform-espressif8266.git#v1.5.0 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 @@ -33,8 +33,7 @@ lib_deps = https://github.com/xoseperez/RemoteSwitch-arduino-library.git https://github.com/markszabo/IRremoteESP8266#v2.2.0 lib_ignore = -#extra_scripts = post:core_version.py -extra_scripts = +extra_scripts = extra_scripts.py # ------------------------------------------------------------------------------ @@ -58,6 +57,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1 upload_speed = 460800 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:wemos-d1mini-relayshield-ota] platform = ${common.platform} @@ -69,6 +69,7 @@ build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=S upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 +extra_scripts = ${common.extra_scripts} [env:nodemcu-lolin] platform = ${common.platform} @@ -79,6 +80,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH upload_speed = 460800 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:nodemcu-lolin-ssl] platform = espressif8266_stage @@ -89,6 +91,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1 upload_speed = 460800 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:nodemcu-lolin-ota] platform = ${common.platform} @@ -101,6 +104,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} # ------------------------------------------------------------------------------ @@ -112,6 +116,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DTINKERMAN_ESPURNA_H06 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:tinkerman-espurna-h06-ota] platform = ${common.platform} @@ -124,6 +129,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:tinkerman-espurna-h08] platform = ${common.platform} @@ -133,6 +139,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DTINKERMAN_ESPURNA_H08 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:tinkerman-espurna-h08-ota] platform = ${common.platform} @@ -145,6 +152,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} # ------------------------------------------------------------------------------ @@ -157,6 +165,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-basic-ota] platform = ${common.platform} @@ -170,6 +179,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-basic-dht] platform = ${common.platform} @@ -180,6 +190,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC -DDHT_SUPPORT=1 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-basic-dht-ota] platform = ${common.platform} @@ -193,6 +204,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-basic-dallas] platform = ${common.platform} @@ -203,6 +215,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC -DDALLAS_SUPPORT=1 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-rf] platform = ${common.platform} @@ -213,6 +226,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RF monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-rf-ota] platform = ${common.platform} @@ -226,6 +240,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-th] platform = ${common.platform} @@ -236,6 +251,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_TH monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-th-ota] platform = ${common.platform} @@ -249,6 +265,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-pow] platform = ${common.platform} @@ -259,6 +276,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_POW monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-pow-ota] platform = ${common.platform} @@ -272,6 +290,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-dual] platform = ${common.platform} @@ -281,6 +300,7 @@ board_flash_mode = dout lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_DUAL +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-dual-ota] platform = ${common.platform} @@ -293,6 +313,7 @@ build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_DUAL upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-dual-r2] platform = ${common.platform} @@ -302,6 +323,7 @@ board_flash_mode = dout lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_DUAL_R2 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-dual-ota-r2] platform = ${common.platform} @@ -314,6 +336,7 @@ build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_DUAL_R2 upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-4ch] platform = ${common.platform} @@ -324,6 +347,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_4CH monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-4ch-ota] platform = ${common.platform} @@ -337,6 +361,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-4ch-pro] platform = ${common.platform} @@ -347,6 +372,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_4CH_PRO monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-4ch-pro-ota] platform = ${common.platform} @@ -360,6 +386,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-touch] platform = ${common.platform} @@ -370,6 +397,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_TOUCH monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-touch-ota] platform = ${common.platform} @@ -383,6 +411,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-b1] platform = ${common.platform} @@ -393,6 +422,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_B1 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-b1-ota] platform = ${common.platform} @@ -406,6 +436,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-t1-1ch] platform = ${common.platform} @@ -416,6 +447,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_1CH monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-t1-1ch-ota] platform = ${common.platform} @@ -429,6 +461,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-t1-2ch] platform = ${common.platform} @@ -439,6 +472,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_2CH monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-t1-2ch-ota] platform = ${common.platform} @@ -452,6 +486,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-t1-3ch] platform = ${common.platform} @@ -462,6 +497,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_3CH monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-t1-3ch-ota] platform = ${common.platform} @@ -475,6 +511,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-led] platform = ${common.platform} @@ -485,6 +522,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_LED monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-led-ota] platform = ${common.platform} @@ -498,6 +536,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-rfbridge] platform = ${common.platform} @@ -508,6 +547,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RFBRIDGE -DRF_RAW_SUPPORT monitor_baud = 19200 +extra_scripts = ${common.extra_scripts} [env:itead-sonoff-rfbridge-ota] platform = ${common.platform} @@ -521,6 +561,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=Algernon1 --port 8266 monitor_baud = 19200 +extra_scripts = ${common.extra_scripts} # ------------------------------------------------------------------------------ @@ -533,6 +574,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_SLAMPHER monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-slampher-ota] platform = ${common.platform} @@ -546,6 +588,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-s20] platform = ${common.platform} @@ -556,6 +599,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_S20 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-s20-ota] platform = ${common.platform} @@ -569,6 +613,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-1ch-inching] platform = ${common.platform} @@ -579,6 +624,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_1CH_INCHING monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-1ch-inching-ota] platform = ${common.platform} @@ -592,6 +638,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-motor] platform = ${common.platform} @@ -602,6 +649,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_MOTOR monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-motor-ota] platform = ${common.platform} @@ -615,6 +663,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} # ------------------------------------------------------------------------------ @@ -626,6 +675,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DELECTRODRAGON_WIFI_IOT -DDHT_SUPPORT=1 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:electrodragon-wifi-iot-ota] platform = ${common.platform} @@ -638,6 +688,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:workchoice-ecoplug] platform = ${common.platform} @@ -648,6 +699,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DWORKCHOICE_ECOPLUG monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:workchoice-ecoplug-ota] platform = ${common.platform} @@ -661,6 +713,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:jangoe-wifi-relay] platform = ${common.platform} @@ -670,6 +723,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DJANGOE_WIFI_RELAY_NC monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:jangoe-wifi-relay-ota] platform = ${common.platform} @@ -682,6 +736,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:openenergymonitor-mqtt-relay] platform = ${common.platform} @@ -691,6 +746,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DOPENENERGYMONITOR_MQTT_RELAY -DDALLAS_SUPPORT=1 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:openenergymonitor-mqtt-relay-ota] platform = ${common.platform} @@ -703,6 +759,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:jorgegarcia-wifi-relays] platform = ${common.platform} @@ -712,6 +769,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DJORGEGARCIA_WIFI_RELAYS monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:jorgegarcia-wifi-relays-ota] platform = ${common.platform} @@ -724,6 +782,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:aithinker-ai-light] platform = ${common.platform} @@ -734,6 +793,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DAITHINKER_AI_LIGHT monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:aithinker-ai-light-ota] platform = ${common.platform} @@ -747,6 +807,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:magichome-led-controller] platform = ${common.platform} @@ -757,6 +818,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:magichome-led-controller-ota] platform = ${common.platform} @@ -770,6 +832,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:magichome-led-controller-20] platform = ${common.platform} @@ -780,6 +843,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_20 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:magichome-led-controller-20-ota] platform = ${common.platform} @@ -792,6 +856,7 @@ build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER_20 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:huacanxing-h801] platform = ${common.platform} @@ -802,6 +867,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H801 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:huacanxing-h801-ota] platform = ${common.platform} @@ -815,6 +881,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:huacanxing-h802] platform = ${common.platform} @@ -825,6 +892,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H802 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:huacanxing-h802-ota] platform = ${common.platform} @@ -838,6 +906,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-al-lc01] platform = ${common.platform} @@ -848,6 +917,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC01 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-al-lc01-ota] platform = ${common.platform} @@ -861,6 +931,32 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:arilux-al-lc02] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC02 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:arilux-al-lc02-ota] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC02 +upload_speed = 115200 +upload_port = "192.168.4.1" +upload_flags = --auth=fibonacci --port 8266 +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-al-lc06] platform = ${common.platform} @@ -871,6 +967,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC06 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-al-lc06-ota] platform = ${common.platform} @@ -884,6 +981,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-al-lc11] platform = ${common.platform} @@ -894,6 +992,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_AL_LC11 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-al-lc11-ota] platform = ${common.platform} @@ -907,6 +1006,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-e27] platform = ${common.platform} @@ -917,6 +1017,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DARILUX_E27 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:arilux-e27-ota] platform = ${common.platform} @@ -930,6 +1031,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-bnsz01] platform = ${common.platform} @@ -940,6 +1042,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DITEAD_BNSZ01 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:itead-bnsz01-ota] platform = ${common.platform} @@ -953,6 +1056,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:wion-50055] platform = ${common.platform} @@ -963,6 +1067,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DWION_50055 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:wion-50055-ota] platform = ${common.platform} @@ -976,6 +1081,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:exs-wifi-relay-v31] platform = ${common.platform} @@ -986,6 +1092,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DEXS_WIFI_RELAY_V31 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:exs-wifi-relay-v31-ota] platform = ${common.platform} @@ -999,6 +1106,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:wemos-v9261f] platform = ${common.platform} @@ -1009,6 +1117,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DGENERIC_V9261F upload_speed = 460800 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:wemos-v9261f-ota] platform = ${common.platform} @@ -1021,6 +1130,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:esp01-v9261f] platform = ${common.platform} @@ -1031,6 +1141,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DGENERIC_V9261F monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:esp01-v9261f-ota] platform = ${common.platform} @@ -1044,6 +1155,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:wemos-ech1560] platform = ${common.platform} @@ -1054,6 +1166,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DGENERIC_ECH1560 upload_speed = 460800 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:wemos-ech1560-ota] platform = ${common.platform} @@ -1066,6 +1179,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:esp01-ech1560] platform = ${common.platform} @@ -1076,6 +1190,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DGENERIC_ECH1560 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:esp01-ech1560-ota] platform = ${common.platform} @@ -1089,6 +1204,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:mancavemade-esplive] platform = ${common.platform} @@ -1099,6 +1215,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DMANCAVEMADE_ESPLIVE upload_speed = 460800 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:mancavemade-esplive-ota] platform = ${common.platform} @@ -1111,6 +1228,7 @@ upload_speed = 460800 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:intermittech-quinled] platform = ${common.platform} @@ -1121,6 +1239,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DINTERMITTECH_QUINLED monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:intermittech-quinled-ota] platform = ${common.platform} @@ -1134,6 +1253,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:xenon-sm-pw702u] platform = ${common.platform} @@ -1144,6 +1264,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DXENON_SM_PW702U monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:xenon-sm-pw702u-ota] platform = ${common.platform} @@ -1157,6 +1278,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:authometion-lyt8266] platform = ${common.platform} @@ -1167,6 +1289,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DAUTHOMETION_LYT8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:authometion-lyt8266-ota] platform = ${common.platform} @@ -1180,6 +1303,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:yjzk-switch-2ch] platform = ${common.platform} @@ -1190,6 +1314,7 @@ lib_deps = ${common.lib_deps} lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags_1m} -DYJZK_SWITCH_2CH monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:yjzk-switch-2ch-ota] platform = ${common.platform} @@ -1203,6 +1328,7 @@ upload_speed = 115200 upload_port = "192.168.4.1" upload_flags = --auth=fibonacci --port 8266 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} [env:generic-8ch] platform = ${common.platform} @@ -1213,6 +1339,7 @@ lib_ignore = ${common.lib_ignore} build_flags = ${common.build_flags} -DGENERIC_8CH upload_speed = 460800 monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} # ------------------------------------------------------------------------------ # GENERIC OTA ENVIRONMENTS @@ -1229,6 +1356,7 @@ build_flags = ${common.build_flags_1m} -D${env.ESPURNA_BOARD} upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 +extra_scripts = ${common.extra_scripts} [env:esp8266-4m-ota] platform = ${common.platform} @@ -1241,3 +1369,4 @@ build_flags = ${common.build_flags} -D${env.ESPURNA_BOARD} upload_speed = 115200 upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 +extra_scripts = ${common.extra_scripts} diff --git a/code/requirements.txt b/code/requirements.txt new file mode 100644 index 00000000..f8acf8d1 --- /dev/null +++ b/code/requirements.txt @@ -0,0 +1,7 @@ +enum-compat==0.0.2 +enum34==1.1.6 +netifaces==0.10.6 +ordereddict==1.1 +six==1.11.0 +sortedcontainers==1.5.9 +zeroconf==0.19.1