Browse Source

Merge branch 'dev' into mqttjson

fastled
Xose Pérez 7 years ago
parent
commit
af0cb7b64a
15 changed files with 3164 additions and 266 deletions
  1. +18
    -0
      code/esp8266.flash.1m0.ld
  2. +6
    -6
      code/espurna/button.ino
  3. +2
    -1
      code/espurna/config/arduino.h
  4. +4
    -2
      code/espurna/config/general.h
  5. +2
    -2
      code/espurna/config/hardware.h
  6. +25
    -25
      code/espurna/config/sensors.h
  7. +4
    -4
      code/espurna/espurna.ino
  8. +58
    -58
      code/espurna/hlw8012.ino
  9. +2999
    -61
      code/espurna/static/index.html.gz.h
  10. +7
    -7
      code/espurna/web.ino
  11. +5
    -5
      code/espurna/wifi.ino
  12. +2
    -10
      code/gulpfile.js
  13. +1
    -1
      code/html/index.html
  14. +0
    -11
      code/pio_hooks.py
  15. +31
    -73
      code/platformio.ini

+ 18
- 0
code/esp8266.flash.1m0.ld View File

@ -0,0 +1,18 @@
/* Flash Split for 1M chips */
/* sketch 999KB */
/* eeprom 20KB */
MEMORY
{
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40201010, len = 0xf9ff0
}
PROVIDE ( _SPIFFS_start = 0x402FB000 );
PROVIDE ( _SPIFFS_end = 0x402FB000 );
PROVIDE ( _SPIFFS_page = 0 );
PROVIDE ( _SPIFFS_block = 0 );
INCLUDE "esp8266.flash.common.ld"

+ 6
- 6
code/espurna/button.ino View File

@ -68,8 +68,8 @@ uint8_t mapEvent(uint8_t event, uint8_t count, uint16_t length) {
if (event == EVENT_CHANGED) return BUTTON_EVENT_CLICK; if (event == EVENT_CHANGED) return BUTTON_EVENT_CLICK;
if (event == EVENT_RELEASED) { if (event == EVENT_RELEASED) {
if (count == 1) { if (count == 1) {
if (length > BUTTON_LNGLNGCLICK_LENGTH) return BUTTON_EVENT_LNGLNGCLICK;
if (length > BUTTON_LNGCLICK_LENGTH) return BUTTON_EVENT_LNGCLICK;
if (length > BUTTON_LNGLNGCLICK_DELAY) return BUTTON_EVENT_LNGLNGCLICK;
if (length > BUTTON_LNGCLICK_DELAY) return BUTTON_EVENT_LNGCLICK;
return BUTTON_EVENT_CLICK; return BUTTON_EVENT_CLICK;
} }
if (count == 2) return BUTTON_EVENT_DBLCLICK; if (count == 2) return BUTTON_EVENT_DBLCLICK;
@ -121,25 +121,25 @@ void buttonSetup() {
#ifdef BUTTON1_PIN #ifdef BUTTON1_PIN
{ {
unsigned int actions = buttonStore(BUTTON1_PRESS, BUTTON1_CLICK, BUTTON1_DBLCLICK, BUTTON1_LNGCLICK, BUTTON1_LNGLNGCLICK); unsigned int actions = buttonStore(BUTTON1_PRESS, BUTTON1_CLICK, BUTTON1_DBLCLICK, BUTTON1_LNGCLICK, BUTTON1_LNGLNGCLICK);
_buttons.push_back({new DebounceEvent(BUTTON1_PIN, BUTTON1_MODE), actions, BUTTON1_RELAY});
_buttons.push_back({new DebounceEvent(BUTTON1_PIN, BUTTON1_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON1_RELAY});
} }
#endif #endif
#ifdef BUTTON2_PIN #ifdef BUTTON2_PIN
{ {
unsigned int actions = buttonStore(BUTTON2_PRESS, BUTTON2_CLICK, BUTTON2_DBLCLICK, BUTTON2_LNGCLICK, BUTTON2_LNGLNGCLICK); unsigned int actions = buttonStore(BUTTON2_PRESS, BUTTON2_CLICK, BUTTON2_DBLCLICK, BUTTON2_LNGCLICK, BUTTON2_LNGLNGCLICK);
_buttons.push_back({new DebounceEvent(BUTTON2_PIN, BUTTON2_MODE), actions, BUTTON2_RELAY});
_buttons.push_back({new DebounceEvent(BUTTON2_PIN, BUTTON2_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON2_RELAY});
} }
#endif #endif
#ifdef BUTTON3_PIN #ifdef BUTTON3_PIN
{ {
unsigned int actions = buttonStore(BUTTON3_PRESS, BUTTON3_CLICK, BUTTON3_DBLCLICK, BUTTON3_LNGCLICK, BUTTON3_LNGLNGCLICK); unsigned int actions = buttonStore(BUTTON3_PRESS, BUTTON3_CLICK, BUTTON3_DBLCLICK, BUTTON3_LNGCLICK, BUTTON3_LNGLNGCLICK);
_buttons.push_back({new DebounceEvent(BUTTON3_PIN, BUTTON3_MODE), actions, BUTTON3_RELAY});
_buttons.push_back({new DebounceEvent(BUTTON3_PIN, BUTTON3_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON3_RELAY});
} }
#endif #endif
#ifdef BUTTON4_PIN #ifdef BUTTON4_PIN
{ {
unsigned int actions = buttonStore(BUTTON4_PRESS, BUTTON4_CLICK, BUTTON4_DBLCLICK, BUTTON4_LNGCLICK, BUTTON4_LNGLNGCLICK); unsigned int actions = buttonStore(BUTTON4_PRESS, BUTTON4_CLICK, BUTTON4_DBLCLICK, BUTTON4_LNGCLICK, BUTTON4_LNGLNGCLICK);
_buttons.push_back({new DebounceEvent(BUTTON4_PIN, BUTTON4_MODE), actions, BUTTON4_RELAY});
_buttons.push_back({new DebounceEvent(BUTTON4_PIN, BUTTON4_MODE, BUTTON_DEBOUNCE_DELAY, BUTTON_DBLCLICK_DELAY), actions, BUTTON4_RELAY});
} }
#endif #endif


+ 2
- 1
code/espurna/config/arduino.h View File

@ -28,6 +28,7 @@
//#define WIFI_RELAYS_BOARD_KIT //#define WIFI_RELAYS_BOARD_KIT
//#define AI_LIGHT //#define AI_LIGHT
//#define LED_CONTROLLER //#define LED_CONTROLLER
//#define H801_LED_CONTROLLER
//#define ESPURNA_H //#define ESPURNA_H
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
@ -37,7 +38,7 @@
//#define ENABLE_DHT 1 //#define ENABLE_DHT 1
//#define ENABLE_DS18B20 1 //#define ENABLE_DS18B20 1
//#define ENABLE_EMON 1 //#define ENABLE_EMON 1
//#define ENABLE_HLW8018 1
//#define ENABLE_HLW8012 1
//#define ENABLE_RF 1 //#define ENABLE_RF 1
//#define ENABLE_FAUXMO 0 //#define ENABLE_FAUXMO 0
//#define ENABLE_NOFUSS 1 //#define ENABLE_NOFUSS 1


+ 4
- 2
code/espurna/config/general.h View File

@ -69,8 +69,10 @@ PROGMEM const char* const custom_reset_string[] = {
// BUTTON // BUTTON
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#define BUTTON_LNGCLICK_LENGTH 1000
#define BUTTON_LNGLNGCLICK_LENGTH 10000
#define BUTTON_DEBOUNCE_DELAY 50
#define BUTTON_DBLCLICK_DELAY 500
#define BUTTON_LNGCLICK_DELAY 1000
#define BUTTON_LNGLNGCLICK_DELAY 10000
#define BUTTON_EVENT_NONE 0 #define BUTTON_EVENT_NONE 0
#define BUTTON_EVENT_PRESSED 1 #define BUTTON_EVENT_PRESSED 1


+ 2
- 2
code/espurna/config/hardware.h View File

@ -59,7 +59,7 @@
#define BUTTON1_PIN 4 #define BUTTON1_PIN 4
#define BUTTON1_RELAY 1 #define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define ENABLE_POW 1
#define ENABLE_HLW8012 1
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Itead Studio boards // Itead Studio boards
@ -148,7 +148,7 @@
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
#define LED1_PIN 15 #define LED1_PIN 15
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
#define ENABLE_POW 1
#define ENABLE_HLW8012 1
#elif defined(SONOFF_DUAL) #elif defined(SONOFF_DUAL)


+ 25
- 25
code/espurna/config/sensors.h View File

@ -91,37 +91,37 @@
#define EMON_CURRENT_TOPIC "current" #define EMON_CURRENT_TOPIC "current"
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// HLW8012 power sensor (Sonoff POW)
// Enable support by passing ENABLE_POW=1 build flag
// HLW8012 power sensor (Sonoff POW, Espurna H)
// Enable support by passing ENABLE_HLW8012=1 build flag
// Enabled by default when selecting SONOFF_POW hardware // Enabled by default when selecting SONOFF_POW hardware
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#ifdef ESPURNA_H #ifdef ESPURNA_H
#define POW_SEL_PIN 2
#define HLW8012_SEL_PIN 2
#else #else
#define POW_SEL_PIN 5
#define HLW8012_SEL_PIN 5
#endif #endif
#define POW_CF1_PIN 13
#define POW_CF_PIN 14
#define POW_USE_INTERRUPTS 1
#define POW_SEL_CURRENT HIGH
#define POW_CURRENT_R 0.001
#define POW_VOLTAGE_R_UP ( 5 * 470000 ) // Real: 2280k
#define POW_VOLTAGE_R_DOWN ( 1000 ) // Real 1.009k
#define POW_POWER_TOPIC "power"
#define POW_CURRENT_TOPIC "current"
#define POW_VOLTAGE_TOPIC "voltage"
#define POW_APOWER_TOPIC "apower"
#define POW_RPOWER_TOPIC "rpower"
#define POW_PFACTOR_TOPIC "pfactor"
#define POW_ENERGY_TOPIC "energy"
#define POW_UPDATE_INTERVAL 5000
#define POW_REPORT_EVERY 12
#define POW_MIN_POWER 5
#define POW_MAX_POWER 2500
#define POW_MIN_CURRENT 0.05
#define POW_MAX_CURRENT 10
#define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14
#define HLW8012_USE_INTERRUPTS 1
#define HLW8012_SEL_CURRENT HIGH
#define HLW8012_CURRENT_R 0.001
#define HLW8012_VOLTAGE_R_UP ( 5 * 470000 ) // Real: 2280k
#define HLW8012_VOLTAGE_R_DOWN ( 1000 ) // Real 1.009k
#define HLW8012_POWER_TOPIC "power"
#define HLW8012_CURRENT_TOPIC "current"
#define HLW8012_VOLTAGE_TOPIC "voltage"
#define HLW8012_APOWER_TOPIC "apower"
#define HLW8012_RPOWER_TOPIC "rpower"
#define HLW8012_PFACTOR_TOPIC "pfactor"
#define HLW8012_ENERGY_TOPIC "energy"
#define HLW8012_UPDATE_INTERVAL 5000
#define HLW8012_REPORT_EVERY 12
#define HLW8012_MIN_POWER 5
#define HLW8012_MAX_POWER 2500
#define HLW8012_MIN_CURRENT 0.05
#define HLW8012_MAX_CURRENT 10
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// Internal power montior // Internal power montior


+ 4
- 4
code/espurna/espurna.ino View File

@ -228,8 +228,8 @@ void setup() {
#if ENABLE_INFLUXDB #if ENABLE_INFLUXDB
influxDBSetup(); influxDBSetup();
#endif #endif
#if ENABLE_POW
powSetup();
#if ENABLE_HLW8012
hlw8012Setup();
#endif #endif
#if ENABLE_DS18B20 #if ENABLE_DS18B20
dsSetup(); dsSetup();
@ -272,8 +272,8 @@ void loop() {
#if ENABLE_NOFUSS #if ENABLE_NOFUSS
nofussLoop(); nofussLoop();
#endif #endif
#if ENABLE_POW
powLoop();
#if ENABLE_HLW8012
hlw8012Loop();
#endif #endif
#if ENABLE_DS18B20 #if ENABLE_DS18B20
dsLoop(); dsLoop();


code/espurna/pow.ino → code/espurna/hlw8012.ino View File

@ -7,7 +7,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_POW
#if ENABLE_HLW8012
#include <HLW8012.h> #include <HLW8012.h>
#include <Hash.h> #include <Hash.h>
@ -15,7 +15,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
#include <EEPROM.h> #include <EEPROM.h>
HLW8012 hlw8012; HLW8012 hlw8012;
bool _powEnabled = false;
bool _hlw8012Enabled = false;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// POW // POW
@ -31,18 +31,18 @@ void ICACHE_RAM_ATTR hlw8012_cf_interrupt() {
hlw8012.cf_interrupt(); hlw8012.cf_interrupt();
} }
void powEnable(bool status) {
_powEnabled = status;
if (_powEnabled) {
#if POW_USE_INTERRUPTS == 1
attachInterrupt(POW_CF1_PIN, hlw8012_cf1_interrupt, CHANGE);
attachInterrupt(POW_CF_PIN, hlw8012_cf_interrupt, CHANGE);
void hlw8012Enable(bool status) {
_hlw8012Enabled = status;
if (_hlw8012Enabled) {
#if HLW8012_USE_INTERRUPTS == 1
attachInterrupt(HLW8012_CF1_PIN, hlw8012_cf1_interrupt, CHANGE);
attachInterrupt(HLW8012_CF_PIN, hlw8012_cf_interrupt, CHANGE);
#endif #endif
DEBUG_MSG_P(PSTR("[POW] Enabled\n")); DEBUG_MSG_P(PSTR("[POW] Enabled\n"));
} else { } else {
#if POW_USE_INTERRUPTS == 1
detachInterrupt(POW_CF1_PIN);
detachInterrupt(POW_CF_PIN);
#if HLW8012_USE_INTERRUPTS == 1
detachInterrupt(HLW8012_CF1_PIN);
detachInterrupt(HLW8012_CF_PIN);
#endif #endif
DEBUG_MSG_P(PSTR("[POW] Disabled\n")); DEBUG_MSG_P(PSTR("[POW] Disabled\n"));
} }
@ -50,13 +50,13 @@ void powEnable(bool status) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void powSaveCalibration() {
void hlw8012SaveCalibration() {
setSetting("powPowerMult", hlw8012.getPowerMultiplier()); setSetting("powPowerMult", hlw8012.getPowerMultiplier());
setSetting("powCurrentMult", hlw8012.getCurrentMultiplier()); setSetting("powCurrentMult", hlw8012.getCurrentMultiplier());
setSetting("powVoltageMult", hlw8012.getVoltageMultiplier()); setSetting("powVoltageMult", hlw8012.getVoltageMultiplier());
} }
void powRetrieveCalibration() {
void hlw8012RetrieveCalibration() {
double value; double value;
value = getSetting("powPowerMult", 0).toFloat(); value = getSetting("powPowerMult", 0).toFloat();
if (value > 0) hlw8012.setPowerMultiplier((int) value); if (value > 0) hlw8012.setPowerMultiplier((int) value);
@ -66,55 +66,55 @@ void powRetrieveCalibration() {
if (value > 0) hlw8012.setVoltageMultiplier((int) value); if (value > 0) hlw8012.setVoltageMultiplier((int) value);
} }
void powSetExpectedActivePower(unsigned int power) {
void hlw8012SetExpectedActivePower(unsigned int power) {
if (power > 0) { if (power > 0) {
hlw8012.expectedActivePower(power); hlw8012.expectedActivePower(power);
powSaveCalibration();
hlw8012SaveCalibration();
} }
} }
void powSetExpectedCurrent(double current) {
void hlw8012SetExpectedCurrent(double current) {
if (current > 0) { if (current > 0) {
hlw8012.expectedCurrent(current); hlw8012.expectedCurrent(current);
powSaveCalibration();
hlw8012SaveCalibration();
} }
} }
void powSetExpectedVoltage(unsigned int voltage) {
void hlw8012SetExpectedVoltage(unsigned int voltage) {
if (voltage > 0) { if (voltage > 0) {
hlw8012.expectedVoltage(voltage); hlw8012.expectedVoltage(voltage);
powSaveCalibration();
hlw8012SaveCalibration();
} }
} }
void powReset() {
void hlw8012Reset() {
hlw8012.resetMultipliers(); hlw8012.resetMultipliers();
powSaveCalibration();
hlw8012SaveCalibration();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
unsigned int getActivePower() { unsigned int getActivePower() {
unsigned int power = hlw8012.getActivePower(); unsigned int power = hlw8012.getActivePower();
if (POW_MIN_POWER > power || power > POW_MAX_POWER) power = 0;
if (HLW8012_MIN_POWER > power || power > HLW8012_MAX_POWER) power = 0;
return power; return power;
} }
unsigned int getApparentPower() { unsigned int getApparentPower() {
unsigned int power = hlw8012.getApparentPower(); unsigned int power = hlw8012.getApparentPower();
if (POW_MIN_POWER > power || power > POW_MAX_POWER) power = 0;
if (HLW8012_MIN_POWER > power || power > HLW8012_MAX_POWER) power = 0;
return power; return power;
} }
unsigned int getReactivePower() { unsigned int getReactivePower() {
unsigned int power = hlw8012.getReactivePower(); unsigned int power = hlw8012.getReactivePower();
if (POW_MIN_POWER > power || power > POW_MAX_POWER) power = 0;
if (HLW8012_MIN_POWER > power || power > HLW8012_MAX_POWER) power = 0;
return power; return power;
} }
double getCurrent() { double getCurrent() {
double current = hlw8012.getCurrent(); double current = hlw8012.getCurrent();
if (POW_MIN_CURRENT > current || current > POW_MAX_CURRENT) current = 0;
if (HLW8012_MIN_CURRENT > current || current > HLW8012_MAX_CURRENT) current = 0;
return current; return current;
} }
@ -128,7 +128,7 @@ double getPowerFactor() {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void powSetup() {
void hlw8012Setup() {
// Initialize HLW8012 // Initialize HLW8012
// void begin(unsigned char cf_pin, unsigned char cf1_pin, unsigned char sel_pin, unsigned char currentWhen = HIGH, bool use_interrupts = false, unsigned long pulse_timeout = PULSE_TIMEOUT); // void begin(unsigned char cf_pin, unsigned char cf1_pin, unsigned char sel_pin, unsigned char currentWhen = HIGH, bool use_interrupts = false, unsigned long pulse_timeout = PULSE_TIMEOUT);
@ -136,10 +136,10 @@ void powSetup() {
// * currentWhen is the value in sel_pin to select current sampling // * currentWhen is the value in sel_pin to select current sampling
// * set use_interrupts to true to use interrupts to monitor pulse widths // * set use_interrupts to true to use interrupts to monitor pulse widths
// * leave pulse_timeout to the default value, recommended when using interrupts // * leave pulse_timeout to the default value, recommended when using interrupts
#if POW_USE_INTERRUPTS
hlw8012.begin(POW_CF_PIN, POW_CF1_PIN, POW_SEL_PIN, POW_SEL_CURRENT, true);
#if HLW8012_USE_INTERRUPTS
hlw8012.begin(HLW8012_CF_PIN, HLW8012_CF1_PIN, HLW8012_SEL_PIN, HLW8012_SEL_CURRENT, true);
#else #else
hlw8012.begin(POW_CF_PIN, POW_CF1_PIN, POW_SEL_PIN, POW_SEL_CURRENT, false, 1000000);
hlw8012.begin(HLW8012_CF_PIN, HLW8012_CF1_PIN, HLW8012_SEL_PIN, HLW8012_SEL_CURRENT, false, 1000000);
#endif #endif
// These values are used to calculate current, voltage and power factors as per datasheet formula // These values are used to calculate current, voltage and power factors as per datasheet formula
@ -147,28 +147,28 @@ void powSetup() {
// * The CURRENT_RESISTOR is the 1milliOhm copper-manganese resistor in series with the main line // * The CURRENT_RESISTOR is the 1milliOhm copper-manganese resistor in series with the main line
// * The VOLTAGE_RESISTOR_UPSTREAM are the 5 470kOhm resistors in the voltage divider that feeds the V2P pin in the HLW8012 // * The VOLTAGE_RESISTOR_UPSTREAM are the 5 470kOhm resistors in the voltage divider that feeds the V2P pin in the HLW8012
// * The VOLTAGE_RESISTOR_DOWNSTREAM is the 1kOhm resistor in the voltage divider that feeds the V2P pin in the HLW8012 // * The VOLTAGE_RESISTOR_DOWNSTREAM is the 1kOhm resistor in the voltage divider that feeds the V2P pin in the HLW8012
hlw8012.setResistors(POW_CURRENT_R, POW_VOLTAGE_R_UP, POW_VOLTAGE_R_DOWN);
hlw8012.setResistors(HLW8012_CURRENT_R, HLW8012_VOLTAGE_R_UP, HLW8012_VOLTAGE_R_DOWN);
// Retrieve calibration values // Retrieve calibration values
powRetrieveCalibration();
hlw8012RetrieveCalibration();
// API definitions // API definitions
apiRegister(POW_POWER_TOPIC, POW_POWER_TOPIC, [](char * buffer, size_t len) {
apiRegister(HLW8012_POWER_TOPIC, HLW8012_POWER_TOPIC, [](char * buffer, size_t len) {
snprintf(buffer, len, "%d", getActivePower()); snprintf(buffer, len, "%d", getActivePower());
}); });
apiRegister(POW_CURRENT_TOPIC, POW_CURRENT_TOPIC, [](char * buffer, size_t len) {
apiRegister(HLW8012_CURRENT_TOPIC, HLW8012_CURRENT_TOPIC, [](char * buffer, size_t len) {
dtostrf(getCurrent(), len-1, 3, buffer); dtostrf(getCurrent(), len-1, 3, buffer);
}); });
apiRegister(POW_VOLTAGE_TOPIC, POW_VOLTAGE_TOPIC, [](char * buffer, size_t len) {
apiRegister(HLW8012_VOLTAGE_TOPIC, HLW8012_VOLTAGE_TOPIC, [](char * buffer, size_t len) {
snprintf(buffer, len, "%d", getVoltage()); snprintf(buffer, len, "%d", getVoltage());
}); });
} }
void powLoop() {
void hlw8012Loop() {
static unsigned long last_update = 0; static unsigned long last_update = 0;
static unsigned char report_count = POW_REPORT_EVERY;
static unsigned char report_count = HLW8012_REPORT_EVERY;
static bool power_spike = false; static bool power_spike = false;
static unsigned long power_sum = 0; static unsigned long power_sum = 0;
@ -186,7 +186,7 @@ void powLoop() {
// POW is disabled while there is no internet connection // POW is disabled while there is no internet connection
// When the HLW8012 measurements are enabled back we reset the timer // When the HLW8012 measurements are enabled back we reset the timer
if (!_powEnabled) {
if (!_hlw8012Enabled) {
powWasEnabled = false; powWasEnabled = false;
return; return;
} }
@ -195,7 +195,7 @@ void powLoop() {
powWasEnabled = true; powWasEnabled = true;
} }
if (millis() - last_update > POW_UPDATE_INTERVAL) {
if (millis() - last_update > HLW8012_UPDATE_INTERVAL) {
last_update = millis(); last_update = millis();
@ -247,29 +247,29 @@ void powLoop() {
if (--report_count == 0) { if (--report_count == 0) {
power = power_sum / POW_REPORT_EVERY;
current = current_sum / POW_REPORT_EVERY;
voltage = voltage_sum / POW_REPORT_EVERY;
power = power_sum / HLW8012_REPORT_EVERY;
current = current_sum / HLW8012_REPORT_EVERY;
voltage = voltage_sum / HLW8012_REPORT_EVERY;
apparent = current * voltage; apparent = current * voltage;
reactive = (apparent > power) ? sqrt(apparent * apparent - power * power) : 0; reactive = (apparent > power) ? sqrt(apparent * apparent - power * power) : 0;
factor = (apparent > 0) ? (double) power / apparent : 1; factor = (apparent > 0) ? (double) power / apparent : 1;
if (factor > 1) factor = 1; if (factor > 1) factor = 1;
// Calculate energy increment (ppower times time) and create C-string // Calculate energy increment (ppower times time) and create C-string
double energy_inc = (double) power * POW_REPORT_EVERY * POW_UPDATE_INTERVAL / 1000.0 / 3600.0;
double energy_inc = (double) power * HLW8012_REPORT_EVERY * HLW8012_UPDATE_INTERVAL / 1000.0 / 3600.0;
char energy_buf[11]; char energy_buf[11];
dtostrf(energy_inc, 11, 3, energy_buf); dtostrf(energy_inc, 11, 3, energy_buf);
char *e = energy_buf; char *e = energy_buf;
while ((unsigned char) *e == ' ') ++e; while ((unsigned char) *e == ' ') ++e;
// Report values to MQTT broker // Report values to MQTT broker
mqttSend(getSetting("powPowerTopic", POW_POWER_TOPIC).c_str(), String(power).c_str());
mqttSend(getSetting("powEnergyTopic", POW_ENERGY_TOPIC).c_str(), e);
mqttSend(getSetting("powCurrentTopic", POW_CURRENT_TOPIC).c_str(), String(current, 3).c_str());
mqttSend(getSetting("powVoltageTopic", POW_VOLTAGE_TOPIC).c_str(), String(voltage).c_str());
mqttSend(getSetting("powAPowerTopic", POW_APOWER_TOPIC).c_str(), String(apparent).c_str());
mqttSend(getSetting("powRPowerTopic", POW_RPOWER_TOPIC).c_str(), String(reactive).c_str());
mqttSend(getSetting("powPFactorTopic", POW_PFACTOR_TOPIC).c_str(), String(factor, 2).c_str());
mqttSend(getSetting("powPowerTopic", HLW8012_POWER_TOPIC).c_str(), String(power).c_str());
mqttSend(getSetting("powEnergyTopic", HLW8012_ENERGY_TOPIC).c_str(), e);
mqttSend(getSetting("powCurrentTopic", HLW8012_CURRENT_TOPIC).c_str(), String(current, 3).c_str());
mqttSend(getSetting("powVoltageTopic", HLW8012_VOLTAGE_TOPIC).c_str(), String(voltage).c_str());
mqttSend(getSetting("powAPowerTopic", HLW8012_APOWER_TOPIC).c_str(), String(apparent).c_str());
mqttSend(getSetting("powRPowerTopic", HLW8012_RPOWER_TOPIC).c_str(), String(reactive).c_str());
mqttSend(getSetting("powPFactorTopic", HLW8012_PFACTOR_TOPIC).c_str(), String(factor, 2).c_str());
// Report values to Domoticz // Report values to Domoticz
#if ENABLE_DOMOTICZ #if ENABLE_DOMOTICZ
@ -287,18 +287,18 @@ void powLoop() {
#endif #endif
#if ENABLE_INFLUXDB #if ENABLE_INFLUXDB
influxDBSend(getSetting("powPowerTopic", POW_POWER_TOPIC).c_str(), String(power).c_str());
//influxDBSend(getSetting("powEnergyTopic", POW_ENERGY_TOPIC).c_str(), e);
//influxDBSend(getSetting("powCurrentTopic", POW_CURRENT_TOPIC).c_str(), String(current, 3).c_str());
//influxDBSend(getSetting("powVoltageTopic", POW_VOLTAGE_TOPIC).c_str(), String(voltage).c_str());
//influxDBSend(getSetting("powAPowerTopic", POW_APOWER_TOPIC).c_str(), String(apparent).c_str());
//influxDBSend(getSetting("powRPowerTopic", POW_RPOWER_TOPIC).c_str(), String(reactive).c_str());
//influxDBSend(getSetting("powPFactorTopic", POW_PFACTOR_TOPIC).c_str(), String(factor, 2).c_str());
influxDBSend(getSetting("powPowerTopic", HLW8012_POWER_TOPIC).c_str(), String(power).c_str());
//influxDBSend(getSetting("powEnergyTopic", HLW8012_ENERGY_TOPIC).c_str(), e);
//influxDBSend(getSetting("powCurrentTopic", HLW8012_CURRENT_TOPIC).c_str(), String(current, 3).c_str());
//influxDBSend(getSetting("powVoltageTopic", HLW8012_VOLTAGE_TOPIC).c_str(), String(voltage).c_str());
//influxDBSend(getSetting("powAPowerTopic", HLW8012_APOWER_TOPIC).c_str(), String(apparent).c_str());
//influxDBSend(getSetting("powRPowerTopic", HLW8012_RPOWER_TOPIC).c_str(), String(reactive).c_str());
//influxDBSend(getSetting("powPFactorTopic", HLW8012_PFACTOR_TOPIC).c_str(), String(factor, 2).c_str());
#endif #endif
// Reset counters // Reset counters
power_sum = current_sum = voltage_sum = 0; power_sum = current_sum = voltage_sum = 0;
report_count = POW_REPORT_EVERY;
report_count = HLW8012_REPORT_EVERY;
} }
@ -308,7 +308,7 @@ void powLoop() {
voltage_sum += voltage_previous; voltage_sum += voltage_previous;
// Toggle between current and voltage monitoring // Toggle between current and voltage monitoring
#if POW_USE_INTERRUPTS == 0
#if HLW8012_USE_INTERRUPTS == 0
hlw8012.toggleMode(); hlw8012.toggleMode();
#endif #endif

+ 2999
- 61
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 7
- 7
code/espurna/web.ino View File

@ -178,25 +178,25 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
// Skip firmware filename // Skip firmware filename
if (key.equals("filename")) continue; if (key.equals("filename")) continue;
#if ENABLE_POW
#if ENABLE_HLW8012
if (key == "powExpectedPower") { if (key == "powExpectedPower") {
powSetExpectedActivePower(value.toInt());
hlw8012SetExpectedActivePower(value.toInt());
changed = true; changed = true;
} }
if (key == "powExpectedVoltage") { if (key == "powExpectedVoltage") {
powSetExpectedVoltage(value.toInt());
hlw8012SetExpectedVoltage(value.toInt());
changed = true; changed = true;
} }
if (key == "powExpectedCurrent") { if (key == "powExpectedCurrent") {
powSetExpectedCurrent(value.toFloat());
hlw8012SetExpectedCurrent(value.toFloat());
changed = true; changed = true;
} }
if (key == "powExpectedReset") { if (key == "powExpectedReset") {
powReset();
hlw8012Reset();
changed = true; changed = true;
} }
@ -488,7 +488,7 @@ void _wsStart(uint32_t client_id) {
root["dczAnaIdx"] = getSetting("dczAnaIdx").toInt(); root["dczAnaIdx"] = getSetting("dczAnaIdx").toInt();
#endif #endif
#if ENABLE_POW
#if ENABLE_HLW8012
root["dczPowIdx"] = getSetting("dczPowIdx").toInt(); root["dczPowIdx"] = getSetting("dczPowIdx").toInt();
root["dczEnergyIdx"] = getSetting("dczEnergyIdx").toInt(); root["dczEnergyIdx"] = getSetting("dczEnergyIdx").toInt();
root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt(); root["dczVoltIdx"] = getSetting("dczVoltIdx").toInt();
@ -540,7 +540,7 @@ void _wsStart(uint32_t client_id) {
root["analogValue"] = getAnalog(); root["analogValue"] = getAnalog();
#endif #endif
#if ENABLE_POW
#if ENABLE_HLW8012
root["powVisible"] = 1; root["powVisible"] = 1;
root["powActivePower"] = getActivePower(); root["powActivePower"] = getActivePower();
root["powApparentPower"] = getApparentPower(); root["powApparentPower"] = getApparentPower();


+ 5
- 5
code/espurna/wifi.ino View File

@ -27,8 +27,8 @@ String getNetwork() {
} }
void wifiDisconnect() { void wifiDisconnect() {
#if ENABLE_POW
powEnable(false);
#if ENABLE_HLW8012
hlw8012Enable(false);
#endif #endif
jw.disconnect(); jw.disconnect();
} }
@ -196,12 +196,12 @@ void wifiSetup() {
} }
// Manage POW // Manage POW
#if ENABLE_POW
#if ENABLE_HLW8012
if (code == MESSAGE_CONNECTED) { if (code == MESSAGE_CONNECTED) {
powEnable(true);
hlw8012Enable(true);
} }
if (code == MESSAGE_DISCONNECTED) { if (code == MESSAGE_DISCONNECTED) {
powEnable(false);
hlw8012Enable(false);
} }
#endif #endif


+ 2
- 10
code/gulpfile.js View File

@ -2,7 +2,7 @@
ESP8266 file system builder ESP8266 file system builder
Copyright (C) 2016 by Xose Pérez <xose dot perez at gmail dot com>
Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -41,14 +41,6 @@ gulp.task('clean', function() {
return true; return true;
}); });
gulp.task('files', ['clean'], function() {
return gulp.src([
'html/**/*.{jpg,jpeg,png,ico,gif}',
'html/fsversion'
])
.pipe(gulp.dest(dataFolder));
});
gulp.task('buildfs_embeded', ['buildfs_inline'], function() { gulp.task('buildfs_embeded', ['buildfs_inline'], function() {
var source = dataFolder + 'index.html.gz'; var source = dataFolder + 'index.html.gz';
@ -65,7 +57,7 @@ gulp.task('buildfs_embeded', ['buildfs_inline'], function() {
wstream.write('const uint8_t index_html_gz[] PROGMEM = {') wstream.write('const uint8_t index_html_gz[] PROGMEM = {')
for (i=0; i<data.length; i++) { for (i=0; i<data.length; i++) {
if (i % 1000 == 0) wstream.write("\n");
if (i % 20 == 0) wstream.write("\n");
wstream.write('0x' + ('00' + data[i].toString(16)).slice(-2)); wstream.write('0x' + ('00' + data[i].toString(16)).slice(-2));
if (i<data.length-1) wstream.write(','); if (i<data.length-1) wstream.write(',');
} }


+ 1
- 1
code/html/index.html View File

@ -292,7 +292,7 @@
<select name="relaySync" class="pure-u-3-4" tabindex="3"> <select name="relaySync" class="pure-u-3-4" tabindex="3">
<option value="0">No synchonisation</a> <option value="0">No synchonisation</a>
<option value="1">Zero or one switches active</a> <option value="1">Zero or one switches active</a>
<option value="2">One and just one switches active</a>
<option value="2">One and just one switch active</a>
<option value="3">All synchonised</a> <option value="3">All synchonised</a>
</select> </select>
</div> </div>


+ 0
- 11
code/pio_hooks.py View File

@ -1,11 +0,0 @@
#!/bin/python
import subprocess
import socket
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
def before_build_spiffs(source, target, env):
env.Execute("node node_modules/gulp/bin/gulp.js")
env.AddPreAction(".pioenvs/%s/spiffs.bin" % env['PIOENV'], before_build_spiffs)

+ 31
- 73
code/platformio.ini View File

@ -5,7 +5,8 @@ data_dir = espurna/data
[common] [common]
build_flags = -g -DDEBUG_PORT=Serial -DMQTT_MAX_PACKET_SIZE=400 build_flags = -g -DDEBUG_PORT=Serial -DMQTT_MAX_PACKET_SIZE=400
build_flags_1m128 = ${common.build_flags} -Wl,-Tesp8266.flash.1m128.ld
build_flags_512k = ${common.build_flags} -Wl,-Tesp8266.flash.512k0.ld
build_flags_1m = ${common.build_flags} -Wl,-Tesp8266.flash.1m0.ld
lib_deps = lib_deps =
DHT sensor library DHT sensor library
Adafruit Unified Sensor Adafruit Unified Sensor
@ -25,7 +26,7 @@ lib_deps =
https://bitbucket.org/xoseperez/fauxmoesp.git#2.1.0 https://bitbucket.org/xoseperez/fauxmoesp.git#2.1.0
https://bitbucket.org/xoseperez/nofuss.git#0.2.2 https://bitbucket.org/xoseperez/nofuss.git#0.2.2
https://bitbucket.org/xoseperez/emonliteesp.git#0.1.2 https://bitbucket.org/xoseperez/emonliteesp.git#0.1.2
https://bitbucket.org/xoseperez/debounceevent.git#2.0.0
https://bitbucket.org/xoseperez/debounceevent.git#2.0.1
https://github.com/xoseperez/my9291#1.0.0 https://github.com/xoseperez/my9291#1.0.0
https://github.com/xoseperez/RemoteSwitch-arduino-library.git https://github.com/xoseperez/RemoteSwitch-arduino-library.git
lib_ignore = lib_ignore =
@ -37,7 +38,6 @@ framework = arduino
board = d1_mini board = d1_mini
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DD1_MINI -DENABLE_DS18B20=1 -DDS_PIN=14 -DENABLE_ADC_VCC=0 -DMQTT_USE_ASYNC=0 -DENABLE_ANALOG=1 -DNOWSAUTH build_flags = ${common.build_flags} -DD1_MINI -DENABLE_DS18B20=1 -DDS_PIN=14 -DENABLE_ADC_VCC=0 -DMQTT_USE_ASYNC=0 -DENABLE_ANALOG=1 -DNOWSAUTH
[env:d1-debug] [env:d1-debug]
@ -46,7 +46,6 @@ framework = arduino
board = d1_mini board = d1_mini
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DD1_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH build_flags = ${common.build_flags} -DD1_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH
[env:d1-debug-ota] [env:d1-debug-ota]
@ -55,7 +54,6 @@ framework = arduino
board = d1_mini board = d1_mini
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DD1_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH build_flags = ${common.build_flags} -DD1_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
@ -67,7 +65,6 @@ framework = arduino
board = nodemcuv2 board = nodemcuv2
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DNODEMCUV2 -DDEBUG_FAUXMO=Serial -DNOWSAUTH build_flags = ${common.build_flags} -DNODEMCUV2 -DDEBUG_FAUXMO=Serial -DNOWSAUTH
[env:node-debug-ota] [env:node-debug-ota]
@ -76,7 +73,6 @@ framework = arduino
board = nodemcuv2 board = nodemcuv2
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DNODEMCUV2 -DDEBUG_FAUXMO=Serial -DNOWSAUTH build_flags = ${common.build_flags} -DNODEMCUV2 -DDEBUG_FAUXMO=Serial -DNOWSAUTH
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
@ -88,7 +84,6 @@ framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DESPURNA_H build_flags = ${common.build_flags} -DESPURNA_H
[env:espurna-debug-ota] [env:espurna-debug-ota]
@ -97,7 +92,6 @@ framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DESPURNA_H build_flags = ${common.build_flags} -DESPURNA_H
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
@ -109,8 +103,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF
build_flags = ${common.build_flags_1m} -DSONOFF
[env:sonoff-debug-ota] [env:sonoff-debug-ota]
platform = espressif8266 platform = espressif8266
@ -118,8 +111,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF
build_flags = ${common.build_flags_1m} -DSONOFF
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -130,8 +122,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF -DENABLE_DHT=1
build_flags = ${common.build_flags_1m} -DSONOFF -DENABLE_DHT=1
[env:sonoff-ds18b20-debug] [env:sonoff-ds18b20-debug]
platform = espressif8266 platform = espressif8266
@ -139,8 +130,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF -DENABLE_DS18B20=1
build_flags = ${common.build_flags_1m} -DSONOFF -DENABLE_DS18B20=1
[env:sonoff-pow-debug] [env:sonoff-pow-debug]
platform = espressif8266 platform = espressif8266
@ -148,8 +138,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_POW
build_flags = ${common.build_flags_1m} -DSONOFF_POW
[env:sonoff-pow-debug-ota] [env:sonoff-pow-debug-ota]
platform = espressif8266 platform = espressif8266
@ -157,8 +146,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_POW
build_flags = ${common.build_flags_1m} -DSONOFF_POW
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -169,8 +157,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_DUAL
build_flags = ${common.build_flags_1m} -DSONOFF_DUAL
[env:sonoff-dual-debug-ota] [env:sonoff-dual-debug-ota]
platform = espressif8266 platform = espressif8266
@ -178,8 +165,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_DUAL
build_flags = ${common.build_flags_1m} -DSONOFF_DUAL
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -190,8 +176,7 @@ framework = arduino
board = esp8285 board = esp8285
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_4CH
build_flags = ${common.build_flags_1m} -DSONOFF_4CH
[env:sonoff-4ch-debug-ota] [env:sonoff-4ch-debug-ota]
platform = espressif8266 platform = espressif8266
@ -199,8 +184,7 @@ framework = arduino
board = esp8285 board = esp8285
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_4CH
build_flags = ${common.build_flags_1m} -DSONOFF_4CH
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -211,8 +195,7 @@ framework = arduino
board = esp8285 board = esp8285
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_TOUCH
build_flags = ${common.build_flags_1m} -DSONOFF_TOUCH
[env:sonoff-touch-debug-ota] [env:sonoff-touch-debug-ota]
platform = espressif8266 platform = espressif8266
@ -220,8 +203,7 @@ framework = arduino
board = esp8285 board = esp8285
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSONOFF_TOUCH
build_flags = ${common.build_flags_1m} -DSONOFF_TOUCH
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -232,8 +214,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSLAMPHER
build_flags = ${common.build_flags_1m} -DSLAMPHER
[env:slampher-debug-ota] [env:slampher-debug-ota]
platform = espressif8266 platform = espressif8266
@ -241,8 +222,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DSLAMPHER
build_flags = ${common.build_flags_1m} -DSLAMPHER
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -253,8 +233,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DS20
build_flags = ${common.build_flags_1m} -DS20
[env:s20-debug-ota] [env:s20-debug-ota]
platform = espressif8266 platform = espressif8266
@ -262,8 +241,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DS20
build_flags = ${common.build_flags_1m} -DS20
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -274,8 +252,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DITEAD_1CH_INCHING
build_flags = ${common.build_flags_1m} -DITEAD_1CH_INCHING
[env:1ch-inching-debug-ota] [env:1ch-inching-debug-ota]
platform = espressif8266 platform = espressif8266
@ -283,8 +260,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DITEAD_1CH_INCHING
build_flags = ${common.build_flags_1m} -DITEAD_1CH_INCHING
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -295,8 +271,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DITEAD_MOTOR
build_flags = ${common.build_flags_1m} -DITEAD_MOTOR
[env:motor-debug-ota] [env:motor-debug-ota]
platform = espressif8266 platform = espressif8266
@ -304,8 +279,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DITEAD_MOTOR
build_flags = ${common.build_flags_1m} -DITEAD_MOTOR
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -316,7 +290,6 @@ framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DESP_RELAY_BOARD -DENABLE_DHT=1 build_flags = ${common.build_flags} -DESP_RELAY_BOARD -DENABLE_DHT=1
[env:electrodragon-debug-ota] [env:electrodragon-debug-ota]
@ -325,7 +298,6 @@ framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DESP_RELAY_BOARD -DENABLE_DHT=1 build_flags = ${common.build_flags} -DESP_RELAY_BOARD -DENABLE_DHT=1
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
@ -337,8 +309,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DECOPLUG
build_flags = ${common.build_flags_1m} -DECOPLUG
[env:ecoplug-debug-ota] [env:ecoplug-debug-ota]
platform = espressif8266 platform = espressif8266
@ -346,8 +317,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DECOPLUG
build_flags = ${common.build_flags_1m} -DECOPLUG
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -358,7 +328,6 @@ framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DWIFI_RELAY_NC build_flags = ${common.build_flags} -DWIFI_RELAY_NC
[env:jangoe-debug-ota] [env:jangoe-debug-ota]
@ -367,7 +336,6 @@ framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DWIFI_RELAY_NC build_flags = ${common.build_flags} -DWIFI_RELAY_NC
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
@ -379,7 +347,6 @@ framework = arduino
board = esp_wroom_02 board = esp_wroom_02
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DMQTT_RELAY -DENABLE_DS18B20=1 build_flags = ${common.build_flags} -DMQTT_RELAY -DENABLE_DS18B20=1
[env:mqtt-relay-debug-ota] [env:mqtt-relay-debug-ota]
@ -388,7 +355,6 @@ framework = arduino
board = esp_wroom_02 board = esp_wroom_02
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags} -DMQTT_RELAY -DENABLE_DS18B20=1 build_flags = ${common.build_flags} -DMQTT_RELAY -DENABLE_DS18B20=1
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
@ -400,8 +366,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DWIFI_RELAYS_BOARD_KIT
build_flags = ${common.build_flags_1m} -DWIFI_RELAYS_BOARD_KIT
[env:wifi-relays-debug-ota] [env:wifi-relays-debug-ota]
platform = espressif8266 platform = espressif8266
@ -409,8 +374,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DWIFI_RELAYS_BOARD_KIT
build_flags = ${common.build_flags_1m} -DWIFI_RELAYS_BOARD_KIT
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -421,8 +385,7 @@ framework = arduino
board = esp8285 board = esp8285
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DAI_LIGHT
build_flags = ${common.build_flags_1m} -DAI_LIGHT
[env:ai-light-debug-ota] [env:ai-light-debug-ota]
platform = espressif8266 platform = espressif8266
@ -430,8 +393,7 @@ framework = arduino
board = esp8285 board = esp8285
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DAI_LIGHT
build_flags = ${common.build_flags_1m} -DAI_LIGHT
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -442,8 +404,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DLED_CONTROLLER
build_flags = ${common.build_flags_1m} -DLED_CONTROLLER
[env:led-controller-debug-ota] [env:led-controller-debug-ota]
platform = espressif8266 platform = espressif8266
@ -451,8 +412,7 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = ${common.build_flags_1m128} -DLED_CONTROLLER
build_flags = ${common.build_flags_1m} -DLED_CONTROLLER
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
@ -463,7 +423,6 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = -g -Wl,-Tesp8266.flash.1m128.ld -DH801_LED_CONTROLLER -DDEBUG_PORT=Serial1 build_flags = -g -Wl,-Tesp8266.flash.1m128.ld -DH801_LED_CONTROLLER -DDEBUG_PORT=Serial1
[env:h801-debug-ota] [env:h801-debug-ota]
@ -472,7 +431,6 @@ framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
extra_script = pio_hooks.py
build_flags = -g -Wl,-Tesp8266.flash.1m128.ld -DH801_LED_CONTROLLER -DDEBUG_PORT=Serial1 build_flags = -g -Wl,-Tesp8266.flash.1m128.ld -DH801_LED_CONTROLLER -DDEBUG_PORT=Serial1
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"


Loading…
Cancel
Save