Browse Source

Refactoring build flag names

fastled
Xose Pérez 7 years ago
parent
commit
1c5ebd3e08
24 changed files with 3037 additions and 3030 deletions
  1. +48
    -0
      code/espurna/alexa.ino
  2. +3
    -3
      code/espurna/analog.ino
  3. +15
    -15
      code/espurna/config/arduino.h
  4. +24
    -21
      code/espurna/config/general.h
  5. +7
    -7
      code/espurna/config/hardware.h
  6. +8
    -8
      code/espurna/config/sensors.h
  7. +5
    -5
      code/espurna/debug.ino
  8. +3
    -3
      code/espurna/dht.ino
  9. +1
    -1
      code/espurna/domoticz.ino
  10. +3
    -3
      code/espurna/ds18b20.ino
  11. +3
    -3
      code/espurna/emon.ino
  12. +28
    -28
      code/espurna/espurna.ino
  13. +0
    -44
      code/espurna/fauxmo.ino
  14. +3
    -3
      code/espurna/hlw8012.ino
  15. +1
    -1
      code/espurna/i2c.ino
  16. +1
    -1
      code/espurna/influxdb.ino
  17. +1
    -1
      code/espurna/nofuss.ino
  18. +1
    -1
      code/espurna/ota.ino
  19. +3
    -3
      code/espurna/relay.ino
  20. +1
    -1
      code/espurna/rf.ino
  21. +2845
    -2845
      code/espurna/static/index.html.gz.h
  22. +25
    -25
      code/espurna/web.ino
  23. +4
    -4
      code/espurna/wifi.ino
  24. +4
    -4
      code/html/index.html

+ 48
- 0
code/espurna/alexa.ino View File

@ -0,0 +1,48 @@
/*
ALEXA MODULE
Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/
#if ALEXA_SUPPORT
#include <fauxmoESP.h>
fauxmoESP alexa;
// -----------------------------------------------------------------------------
// ALEXA
// -----------------------------------------------------------------------------
void alexaConfigure() {
alexa.enable(getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1);
}
void alexaSetup() {
// Backwards compatibility
moveSetting("fauxmoEnabled", "alexaEnabled");
alexaConfigure();
unsigned int relays = relayCount();
String hostname = getSetting("hostname");
if (relays == 1) {
alexa.addDevice(hostname.c_str());
} else {
for (unsigned int i=0; i<relays; i++) {
alexa.addDevice((hostname + "_" + i).c_str());
}
}
alexa.onMessage([relays](unsigned char device_id, const char * name, bool state) {
DEBUG_MSG_P(PSTR("[ALEXA] %s state: %s\n"), name, state ? "ON" : "OFF");
relayStatus(device_id, state);
});
}
void alexaLoop() {
alexa.handle();
}
#endif

+ 3
- 3
code/espurna/analog.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_ANALOG
#if ANALOG_SUPPORT
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ANALOG // ANALOG
@ -41,12 +41,12 @@ void analogLoop() {
mqttSend(getSetting("analogTopic", ANALOG_TOPIC).c_str(), String(analog).c_str()); mqttSend(getSetting("analogTopic", ANALOG_TOPIC).c_str(), String(analog).c_str());
// Send to Domoticz // Send to Domoticz
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
domoticzSend("dczAnaIdx", 0, String(analog).c_str()); domoticzSend("dczAnaIdx", 0, String(analog).c_str());
#endif #endif
// Send to InfluxDB // Send to InfluxDB
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSend(MQTT_TOPIC_ANALOG, analog); influxDBSend(MQTT_TOPIC_ANALOG, analog);
#endif #endif


+ 15
- 15
code/espurna/config/arduino.h View File

@ -44,18 +44,18 @@
// Features (values below are non-default values) // Features (values below are non-default values)
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//#define ENABLE_ANALOG 1
//#define ENABLE_DHT 1
//#define ENABLE_DOMOTICZ 0
//#define ENABLE_DS18B20 1
//#define ENABLE_EMON 1
//#define ENABLE_I2C 1
//#define ENABLE_INFLUXDB 0
//#define ENABLE_FAUXMO 0
//#define ENABLE_MDNS 0
//#define ENABLE_NOFUSS 1
//#define ENABLE_RF 1
//#define ENABLE_SERIAL_DEBUG 0
//#define ENABLE_SPIFFS 1
//#define ENABLE_TERMINAL 0
//#define ENABLE_UDP_DEBUG 1
//#define ALEXA_SUPPORT 0
//#define ANALOG_SUPPORT 1
//#define DHT_SUPPORT 1
//#define DOMOTICZ_SUPPORT 0
//#define DS18B20_SUPPORT 1
//#define EMON_SUPPORT 1
//#define I2C_SUPPORT 1
//#define INFLUXDB_SUPPORT 0
//#define MDNS_SUPPORT 0
//#define NOFUSS_SUPPORT 1
//#define RF_SUPPORT 1
//#define DEBUG_SERIAL_SUPPORT 0
//#define SPIFFS_SUPPORT 1
//#define TERMINAL_SUPPORT 0
//#define DEBUG_UDP_SUPPORT 1

+ 24
- 21
code/espurna/config/general.h View File

@ -9,8 +9,8 @@
// Serial debug log // Serial debug log
#ifndef ENABLE_SERIAL_DEBUG
#define ENABLE_SERIAL_DEBUG 1 // Enable serial debug log
#ifndef DEBUG_SERIAL_SUPPORT
#define DEBUG_SERIAL_SUPPORT 1 // Enable serial debug log
#endif #endif
#ifndef DEBUG_PORT #ifndef DEBUG_PORT
#define DEBUG_PORT Serial // Default debugging port #define DEBUG_PORT Serial // Default debugging port
@ -22,8 +22,8 @@
// To receive the message son the destination computer use nc: // To receive the message son the destination computer use nc:
// nc -ul 8111 // nc -ul 8111
#ifndef ENABLE_UDP_DEBUG
#define ENABLE_UDP_DEBUG 0 // Enable UDP debug log
#ifndef DEBUG_UDP_SUPPORT
#define DEBUG_UDP_SUPPORT 0 // Enable UDP debug log
#endif #endif
#define DEBUG_UDP_IP IPAddress(192, 168, 1, 100) #define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
#define DEBUG_UDP_PORT 8113 #define DEBUG_UDP_PORT 8113
@ -33,7 +33,7 @@
// General debug options and macros // General debug options and macros
#define DEBUG_MESSAGE_MAX_LENGTH 80 #define DEBUG_MESSAGE_MAX_LENGTH 80
#if (ENABLE_SERIAL_DEBUG==1) || (ENABLE_UDP_DEBUG==1)
#if (DEBUG_SERIAL_SUPPORT==1) || (DEBUG_UDP_SUPPORT==1)
#define DEBUG_MSG(...) debugSend(__VA_ARGS__) #define DEBUG_MSG(...) debugSend(__VA_ARGS__)
#define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__) #define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__)
#endif #endif
@ -47,8 +47,8 @@
// TERMINAL // TERMINAL
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef ENABLE_TERMINAL
#define ENABLE_TERMINAL 1 // Enable terminal commands
#ifndef TERMINAL_SUPPORT
#define TERMINAL_SUPPORT 1 // Enable terminal commands
#endif #endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -226,7 +226,7 @@ PROGMEM const char* const custom_reset_string[] = {
#define WS_TIMEOUT 1800000 // Timeout for secured websocket #define WS_TIMEOUT 1800000 // Timeout for secured websocket
#define WEBSERVER_PORT 80 // HTTP port #define WEBSERVER_PORT 80 // HTTP port
#define DNS_PORT 53 // MDNS port #define DNS_PORT 53 // MDNS port
#define ENABLE_MDNS 1 // Enable MDNS by default
#define MDNS_SUPPORT 1 // Enable MDNS by default
#define ENABLE_API 0 // Do not enable API by default #define ENABLE_API 0 // Do not enable API by default
#define API_BUFFER_SIZE 10 // Size of the buffer for HTTP GET API responses #define API_BUFFER_SIZE 10 // Size of the buffer for HTTP GET API responses
@ -245,8 +245,8 @@ PROGMEM const char* const custom_reset_string[] = {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Do not add support for SPIFFS by default // Do not add support for SPIFFS by default
#ifndef ENABLE_SPIFFS
#define ENABLE_SPIFFS 0
#ifndef SPIFFS_SUPPORT
#define SPIFFS_SUPPORT 0
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -329,9 +329,10 @@ PROGMEM const char* const custom_reset_string[] = {
// I2C // I2C
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef ENABLE_I2C
#define ENABLE_I2C 0 // I2C enabled
#ifndef I2C_SUPPORT
#define I2C_SUPPORT 0 // I2C enabled
#endif #endif
#define I2C_SDA_PIN 4 // SDA GPIO #define I2C_SDA_PIN 4 // SDA GPIO
#define I2C_SCL_PIN 14 // SCL GPIO #define I2C_SCL_PIN 14 // SCL GPIO
#define I2C_CLOCK_STRETCH_TIME 200 // BRZO clock stretch time #define I2C_CLOCK_STRETCH_TIME 200 // BRZO clock stretch time
@ -368,9 +369,10 @@ PROGMEM const char* const custom_reset_string[] = {
// DOMOTICZ // DOMOTICZ
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef ENABLE_DOMOTICZ
#define ENABLE_DOMOTICZ 1 // Build with domoticz support
#ifndef DOMOTICZ_SUPPORT
#define DOMOTICZ_SUPPORT 1 // Build with domoticz support
#endif #endif
#define DOMOTICZ_ENABLED 1 // Enable domoticz by default #define DOMOTICZ_ENABLED 1 // Enable domoticz by default
#define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic #define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic
#define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic
@ -379,9 +381,10 @@ PROGMEM const char* const custom_reset_string[] = {
// INFLUXDB // INFLUXDB
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef ENABLE_INFLUXDB
#define ENABLE_INFLUXDB 1 // Enable InfluxDB support by default
#ifndef INFLUXDB_SUPPORT
#define INFLUXDB_SUPPORT 1 // Enable InfluxDB support by default
#endif #endif
#define INFLUXDB_PORT 8086 // Default InfluxDB port #define INFLUXDB_PORT 8086 // Default InfluxDB port
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -398,14 +401,14 @@ PROGMEM const char* const custom_reset_string[] = {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// This setting defines whether Alexa support should be built into the firmware // This setting defines whether Alexa support should be built into the firmware
#ifndef ENABLE_FAUXMO
#define ENABLE_FAUXMO 1
#ifndef ALEXA_SUPPORT
#define ALEXA_SUPPORT 1
#endif #endif
// This is default value for the fauxmoEnabled setting that defines whether
// This is default value for the alexaEnabled setting that defines whether
// this device should be discoberable and respond to Alexa commands. // this device should be discoberable and respond to Alexa commands.
// Both ENABLE_FAUXMO and fauxmoEnabled should be 1 for Alexa support to work.
#define FAUXMO_ENABLED 1
// Both ALEXA_SUPPORT and alexaEnabled should be 1 for Alexa support to work.
#define ALEXA_ENABLED 1
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


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

@ -68,7 +68,7 @@
// Info // Info
#define MANUFACTURER "TINKERMAN" #define MANUFACTURER "TINKERMAN"
#define DEVICE "ESPURNA_H" #define DEVICE "ESPURNA_H"
#define ENABLE_HLW8012 1
#define HLW8012_SUPPORT 1
// Buttons // Buttons
#define BUTTON1_PIN 4 #define BUTTON1_PIN 4
@ -84,7 +84,7 @@
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
// HLW8012 // HLW8012
#define ENABLE_HLW8012 1
#define HLW8012_SUPPORT 1
#define HLW8012_SEL_PIN 2 #define HLW8012_SEL_PIN 2
#define HLW8012_CF1_PIN 13 #define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14 #define HLW8012_CF_PIN 14
@ -231,7 +231,7 @@
// Info // Info
#define MANUFACTURER "ITEAD_STUDIO" #define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_POW" #define DEVICE "SONOFF_POW"
#define ENABLE_HLW8012 1
#define HLW8012_SUPPORT 1
// Buttons // Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
@ -247,7 +247,7 @@
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
// HLW8012 // HLW8012
#define ENABLE_HLW8012 1
#define HLW8012_SUPPORT 1
#define HLW8012_SEL_PIN 5 #define HLW8012_SEL_PIN 5
#define HLW8012_CF1_PIN 13 #define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14 #define HLW8012_CF_PIN 14
@ -260,8 +260,8 @@
#define SERIAL_BAUDRATE 19230 #define SERIAL_BAUDRATE 19230
#define RELAY_PROVIDER RELAY_PROVIDER_DUAL #define RELAY_PROVIDER RELAY_PROVIDER_DUAL
#define DUMMY_RELAY_COUNT 2 #define DUMMY_RELAY_COUNT 2
#define ENABLE_SERIAL_DEBUG 0
#define ENABLE_TERMINAL 0
#define DEBUG_SERIAL_SUPPORT 0
#define TERMINAL_SUPPORT 0
// Buttons // Buttons
#define BUTTON3_RELAY 1 #define BUTTON3_RELAY 1
@ -417,7 +417,7 @@
#define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE #define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE
#define DUMMY_RELAY_COUNT 6 #define DUMMY_RELAY_COUNT 6
#define TRACK_RELAY_STATUS 0 #define TRACK_RELAY_STATUS 0
#define ENABLE_TERMINAL 0
#define TERMINAL_SUPPORT 0
// Buttons // Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0


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

@ -1,7 +1,7 @@
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// Custom RF module // Custom RF module
// Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/ // Check http://tinkerman.cat/adding-rf-to-a-non-rf-itead-sonoff/
// Enable support by passing ENABLE_RF=1 build flag
// Enable support by passing RF_SUPPORT=1 build flag
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#define RF_PIN 14 #define RF_PIN 14
@ -10,7 +10,7 @@
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// DHTXX temperature/humidity sensor // DHTXX temperature/humidity sensor
// Enable support by passing ENABLE_DHT=1 build flag
// Enable support by passing DHT_SUPPORT=1 build flag
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#define DHT_PIN 14 #define DHT_PIN 14
@ -27,21 +27,21 @@
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// Analog sensor // Analog sensor
// Enable support by passing ENABLE_ANALOG=1 build flag
// Enable support by passing ANALOG_SUPPORT=1 build flag
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#define ANALOG_PIN 0 #define ANALOG_PIN 0
#define ANALOG_UPDATE_INTERVAL 60000 #define ANALOG_UPDATE_INTERVAL 60000
#define ANALOG_TOPIC "analog" #define ANALOG_TOPIC "analog"
#if ENABLE_ANALOG
#if ANALOG_SUPPORT
#undef ENABLE_ADC_VCC #undef ENABLE_ADC_VCC
#define ENABLE_ADC_VCC 0 #define ENABLE_ADC_VCC 0
#endif #endif
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// DS18B20 temperature sensor // DS18B20 temperature sensor
// Enable support by passing ENABLE_DS18B20=1 build flag
// Enable support by passing DS18B20_SUPPORT=1 build flag
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#define DS_PIN 14 #define DS_PIN 14
@ -52,7 +52,7 @@
// Custom current sensor // Custom current sensor
// Check http://tinkerman.cat/your-laundry-is-done/ // Check http://tinkerman.cat/your-laundry-is-done/
// Check http://tinkerman.cat/power-monitoring-sonoff-th-adc121/ // Check http://tinkerman.cat/power-monitoring-sonoff-th-adc121/
// Enable support by passing ENABLE_EMON=1 build flag
// Enable support by passing EMON_SUPPORT=1 build flag
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
#define EMON_ANALOG_PROVIDER 0 #define EMON_ANALOG_PROVIDER 0
@ -67,7 +67,7 @@
#define EMON_REFERENCE_VOLTAGE 1.0 #define EMON_REFERENCE_VOLTAGE 1.0
#define EMON_CURRENT_PRECISION 1 #define EMON_CURRENT_PRECISION 1
#define EMON_CURRENT_OFFSET 0.25 #define EMON_CURRENT_OFFSET 0.25
#if ENABLE_EMON
#if EMON_SUPPORT
#undef ENABLE_ADC_VCC #undef ENABLE_ADC_VCC
#define ENABLE_ADC_VCC 0 #define ENABLE_ADC_VCC 0
#endif #endif
@ -92,7 +92,7 @@
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// HLW8012 power sensor (Sonoff POW, Espurna H) // HLW8012 power sensor (Sonoff POW, Espurna H)
// Enable support by passing ENABLE_HLW8012=1 build flag
// Enable support by passing HLW8012_SUPPORT=1 build flag
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// GPIOs defined in the hardware.h file // GPIOs defined in the hardware.h file


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

@ -9,7 +9,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef ENABLE_UDP_DEBUG
#ifdef DEBUG_UDP_SUPPORT
#include <WiFiUdp.h> #include <WiFiUdp.h>
WiFiUDP udpDebug; WiFiUDP udpDebug;
#endif #endif
@ -23,14 +23,14 @@ void debugSend(const char * format, ...) {
int len = ets_vsnprintf(buffer, DEBUG_MESSAGE_MAX_LENGTH, format, args); int len = ets_vsnprintf(buffer, DEBUG_MESSAGE_MAX_LENGTH, format, args);
va_end(args); va_end(args);
#ifdef ENABLE_SERIAL_DEBUG
#ifdef DEBUG_SERIAL_SUPPORT
DEBUG_PORT.printf(buffer); DEBUG_PORT.printf(buffer);
if (len > DEBUG_MESSAGE_MAX_LENGTH) { if (len > DEBUG_MESSAGE_MAX_LENGTH) {
DEBUG_PORT.printf(" (...)\n"); DEBUG_PORT.printf(" (...)\n");
} }
#endif #endif
#ifdef ENABLE_UDP_DEBUG
#ifdef DEBUG_UDP_SUPPORT
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT); udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT);
udpDebug.write(buffer); udpDebug.write(buffer);
if (len > DEBUG_MESSAGE_MAX_LENGTH) { if (len > DEBUG_MESSAGE_MAX_LENGTH) {
@ -54,14 +54,14 @@ void debugSend_P(PGM_P format, ...) {
int len = ets_vsnprintf(buffer, DEBUG_MESSAGE_MAX_LENGTH, f, args); int len = ets_vsnprintf(buffer, DEBUG_MESSAGE_MAX_LENGTH, f, args);
va_end(args); va_end(args);
#ifdef ENABLE_SERIAL_DEBUG
#ifdef DEBUG_SERIAL_SUPPORT
DEBUG_PORT.printf(buffer); DEBUG_PORT.printf(buffer);
if (len > DEBUG_MESSAGE_MAX_LENGTH) { if (len > DEBUG_MESSAGE_MAX_LENGTH) {
DEBUG_PORT.printf(" (...)\n"); DEBUG_PORT.printf(" (...)\n");
} }
#endif #endif
#ifdef ENABLE_UDP_DEBUG
#ifdef DEBUG_UDP_SUPPORT
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT); udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT);
udpDebug.write(buffer); udpDebug.write(buffer);
if (len > DEBUG_MESSAGE_MAX_LENGTH) { if (len > DEBUG_MESSAGE_MAX_LENGTH) {


+ 3
- 3
code/espurna/dht.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_DHT
#if DHT_SUPPORT
#include <DHT.h> #include <DHT.h>
#include <Adafruit_Sensor.h> #include <Adafruit_Sensor.h>
@ -74,7 +74,7 @@ void dhtLoop() {
mqttSend(getSetting("dhtHumTopic", DHT_HUMIDITY_TOPIC).c_str(), humidity); mqttSend(getSetting("dhtHumTopic", DHT_HUMIDITY_TOPIC).c_str(), humidity);
// Send to Domoticz // Send to Domoticz
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
{ {
domoticzSend("dczTmpIdx", 0, temperature); domoticzSend("dczTmpIdx", 0, temperature);
int status; int status;
@ -93,7 +93,7 @@ void dhtLoop() {
} }
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSend(getSetting("dhtTmpTopic", DHT_TEMPERATURE_TOPIC).c_str(), temperature); influxDBSend(getSetting("dhtTmpTopic", DHT_TEMPERATURE_TOPIC).c_str(), temperature);
influxDBSend(getSetting("dhtHumTopic", DHT_HUMIDITY_TOPIC).c_str(), humidity); influxDBSend(getSetting("dhtHumTopic", DHT_HUMIDITY_TOPIC).c_str(), humidity);
#endif #endif


+ 1
- 1
code/espurna/domoticz.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
#include <ArduinoJson.h> #include <ArduinoJson.h>


+ 3
- 3
code/espurna/ds18b20.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_DS18B20
#if DS18B20_SUPPORT
#include <OneWire.h> #include <OneWire.h>
#include <DallasTemperature.h> #include <DallasTemperature.h>
@ -95,11 +95,11 @@ void dsLoop() {
mqttSend(getSetting("dsTmpTopic", DS_TEMPERATURE_TOPIC).c_str(), _dsTemperatureStr); mqttSend(getSetting("dsTmpTopic", DS_TEMPERATURE_TOPIC).c_str(), _dsTemperatureStr);
// Send to Domoticz // Send to Domoticz
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
domoticzSend("dczTmpIdx", 0, _dsTemperatureStr); domoticzSend("dczTmpIdx", 0, _dsTemperatureStr);
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSend(getSetting("dsTmpTopic", DS_TEMPERATURE_TOPIC).c_str(), _dsTemperatureStr); influxDBSend(getSetting("dsTmpTopic", DS_TEMPERATURE_TOPIC).c_str(), _dsTemperatureStr);
#endif #endif


+ 3
- 3
code/espurna/emon.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_EMON
#if EMON_SUPPORT
#include <EmonLiteESP.h> #include <EmonLiteESP.h>
#include <EEPROM.h> #include <EEPROM.h>
@ -188,7 +188,7 @@ void powerMonitorLoop() {
mqttSend(getSetting("emonEnergyTopic", EMON_ENERGY_TOPIC).c_str(), String(energy_delta, 3).c_str()); mqttSend(getSetting("emonEnergyTopic", EMON_ENERGY_TOPIC).c_str(), String(energy_delta, 3).c_str());
// Report values to Domoticz // Report values to Domoticz
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
{ {
char buffer[20]; char buffer[20];
snprintf_P(buffer, strlen(buffer), PSTR("%d;%s"), _emonPower, String(energy_delta, 3).c_str()); snprintf_P(buffer, strlen(buffer), PSTR("%d;%s"), _emonPower, String(energy_delta, 3).c_str());
@ -200,7 +200,7 @@ void powerMonitorLoop() {
} }
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSend(getSetting("emonPowerTopic", EMON_APOWER_TOPIC).c_str(), _emonPower); influxDBSend(getSetting("emonPowerTopic", EMON_APOWER_TOPIC).c_str(), _emonPower);
influxDBSend(getSetting("emonCurrTopic", EMON_CURRENT_TOPIC).c_str(), String(_emonCurrent, 3).c_str()); influxDBSend(getSetting("emonCurrTopic", EMON_CURRENT_TOPIC).c_str(), String(_emonCurrent, 3).c_str());
influxDBSend(getSetting("emonEnergyTopic", EMON_ENERGY_TOPIC).c_str(), String(energy_delta, 3).c_str()); influxDBSend(getSetting("emonEnergyTopic", EMON_ENERGY_TOPIC).c_str(), String(energy_delta, 3).c_str());


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

@ -75,13 +75,13 @@ void heartbeat() {
#endif #endif
#if (HEARTBEAT_REPORT_UPTIME) #if (HEARTBEAT_REPORT_UPTIME)
mqttSend(MQTT_TOPIC_UPTIME, String(uptime_seconds).c_str()); mqttSend(MQTT_TOPIC_UPTIME, String(uptime_seconds).c_str());
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSend(MQTT_TOPIC_UPTIME, String(uptime_seconds).c_str()); influxDBSend(MQTT_TOPIC_UPTIME, String(uptime_seconds).c_str());
#endif #endif
#endif #endif
#if (HEARTBEAT_REPORT_FREEHEAP) #if (HEARTBEAT_REPORT_FREEHEAP)
mqttSend(MQTT_TOPIC_FREEHEAP, String(free_heap).c_str()); mqttSend(MQTT_TOPIC_FREEHEAP, String(free_heap).c_str());
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSend(MQTT_TOPIC_FREEHEAP, String(free_heap).c_str()); influxDBSend(MQTT_TOPIC_FREEHEAP, String(free_heap).c_str());
#endif #endif
#endif #endif
@ -121,7 +121,7 @@ void hardwareSetup() {
EEPROM.begin(EEPROM_SIZE); EEPROM.begin(EEPROM_SIZE);
#if ENABLE_SERIAL_DEBUG
#if DEBUG_SERIAL_SUPPORT
DEBUG_PORT.begin(SERIAL_BAUDRATE); DEBUG_PORT.begin(SERIAL_BAUDRATE);
if (customReset() == CUSTOM_RESET_HARDWARE) { if (customReset() == CUSTOM_RESET_HARDWARE) {
DEBUG_PORT.setDebugOutput(true); DEBUG_PORT.setDebugOutput(true);
@ -130,7 +130,7 @@ void hardwareSetup() {
Serial.begin(SERIAL_BAUDRATE); Serial.begin(SERIAL_BAUDRATE);
#endif #endif
#if ENABLE_SPIFFS
#if SPIFFS_SUPPORT
SPIFFS.begin(); SPIFFS.begin();
#endif #endif
@ -176,7 +176,7 @@ void welcome() {
DEBUG_MSG_P(PSTR("Flash size (CHIP): %8u bytes / %4d sectors\n"), ESP.getFlashChipRealSize(), sectors(ESP.getFlashChipRealSize())); DEBUG_MSG_P(PSTR("Flash size (CHIP): %8u bytes / %4d sectors\n"), ESP.getFlashChipRealSize(), sectors(ESP.getFlashChipRealSize()));
DEBUG_MSG_P(PSTR("Firmware size: %8u bytes / %4d sectors\n"), ESP.getSketchSize(), sectors(ESP.getSketchSize())); DEBUG_MSG_P(PSTR("Firmware size: %8u bytes / %4d sectors\n"), ESP.getSketchSize(), sectors(ESP.getSketchSize()));
DEBUG_MSG_P(PSTR("OTA size: %8u bytes / %4d sectors\n"), ESP.getFreeSketchSpace(), sectors(ESP.getFreeSketchSpace())); DEBUG_MSG_P(PSTR("OTA size: %8u bytes / %4d sectors\n"), ESP.getFreeSketchSpace(), sectors(ESP.getFreeSketchSpace()));
#if ENABLE_SPIFFS
#if SPIFFS_SUPPORT
FSInfo fs_info; FSInfo fs_info;
bool fs = SPIFFS.info(fs_info); bool fs = SPIFFS.info(fs_info);
if (fs) { if (fs) {
@ -188,7 +188,7 @@ void welcome() {
DEBUG_MSG_P(PSTR("EEPROM size: %8u bytes / %4d sectors\n"), settingsMaxSize(), sectors(settingsMaxSize())); DEBUG_MSG_P(PSTR("EEPROM size: %8u bytes / %4d sectors\n"), settingsMaxSize(), sectors(settingsMaxSize()));
DEBUG_MSG_P(PSTR("Empty space: %8u bytes / 4 sectors\n"), 4 * SPI_FLASH_SEC_SIZE); DEBUG_MSG_P(PSTR("Empty space: %8u bytes / 4 sectors\n"), 4 * SPI_FLASH_SEC_SIZE);
#if ENABLE_SPIFFS
#if SPIFFS_SUPPORT
if (fs) { if (fs) {
DEBUG_MSG_P(PSTR("\n")); DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("SPIFFS total size: %8u bytes\n"), fs_info.totalBytes); DEBUG_MSG_P(PSTR("SPIFFS total size: %8u bytes\n"), fs_info.totalBytes);
@ -245,37 +245,37 @@ void setup() {
rfbSetup(); rfbSetup();
#endif #endif
#if ENABLE_I2C
#if I2C_SUPPORT
i2cSetup(); i2cSetup();
#endif #endif
#if ENABLE_FAUXMO
fauxmoSetup();
#if ALEXA_SUPPORT
alexaSetup();
#endif #endif
#if ENABLE_NOFUSS
#if NOFUSS_SUPPORT
nofussSetup(); nofussSetup();
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSetup(); influxDBSetup();
#endif #endif
#if ENABLE_HLW8012
#if HLW8012_SUPPORT
hlw8012Setup(); hlw8012Setup();
#endif #endif
#if ENABLE_DS18B20
#if DS18B20_SUPPORT
dsSetup(); dsSetup();
#endif #endif
#if ENABLE_ANALOG
#if ANALOG_SUPPORT
analogSetup(); analogSetup();
#endif #endif
#if ENABLE_DHT
#if DHT_SUPPORT
dhtSetup(); dhtSetup();
#endif #endif
#if ENABLE_RF
#if RF_SUPPORT
rfSetup(); rfSetup();
#endif #endif
#if ENABLE_EMON
#if EMON_SUPPORT
powerMonitorSetup(); powerMonitorSetup();
#endif #endif
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
domoticzSetup(); domoticzSetup();
#endif #endif
@ -299,31 +299,31 @@ void loop() {
rfbLoop(); rfbLoop();
#endif #endif
#if ENABLE_TERMINAL
#if TERMINAL_SUPPORT
settingsLoop(); settingsLoop();
#endif #endif
#if ENABLE_FAUXMO
fauxmoLoop();
#if ALEXA_SUPPORT
alexaLoop();
#endif #endif
#if ENABLE_NOFUSS
#if NOFUSS_SUPPORT
nofussLoop(); nofussLoop();
#endif #endif
#if ENABLE_HLW8012
#if HLW8012_SUPPORT
hlw8012Loop(); hlw8012Loop();
#endif #endif
#if ENABLE_DS18B20
#if DS18B20_SUPPORT
dsLoop(); dsLoop();
#endif #endif
#if ENABLE_ANALOG
#if ANALOG_SUPPORT
analogLoop(); analogLoop();
#endif #endif
#if ENABLE_DHT
#if DHT_SUPPORT
dhtLoop(); dhtLoop();
#endif #endif
#if ENABLE_RF
#if RF_SUPPORT
rfLoop(); rfLoop();
#endif #endif
#if ENABLE_EMON
#if EMON_SUPPORT
powerMonitorLoop(); powerMonitorLoop();
#endif #endif


+ 0
- 44
code/espurna/fauxmo.ino View File

@ -1,44 +0,0 @@
/*
FAUXMO MODULE
Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/
#if ENABLE_FAUXMO
#include <fauxmoESP.h>
fauxmoESP fauxmo;
// -----------------------------------------------------------------------------
// FAUXMO
// -----------------------------------------------------------------------------
void fauxmoConfigure() {
fauxmo.enable(getSetting("fauxmoEnabled", FAUXMO_ENABLED).toInt() == 1);
}
void fauxmoSetup() {
fauxmoConfigure();
unsigned int relays = relayCount();
String hostname = getSetting("hostname");
if (relays == 1) {
fauxmo.addDevice(hostname.c_str());
} else {
for (unsigned int i=0; i<relays; i++) {
fauxmo.addDevice((hostname + "_" + i).c_str());
}
}
fauxmo.onMessage([relays](unsigned char device_id, const char * name, bool state) {
DEBUG_MSG_P(PSTR("[FAUXMO] %s state: %s\n"), name, state ? "ON" : "OFF");
relayStatus(device_id, state);
});
}
void fauxmoLoop() {
fauxmo.handle();
}
#endif

+ 3
- 3
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_HLW8012
#if HLW8012_SUPPORT
#include <HLW8012.h> #include <HLW8012.h>
#include <Hash.h> #include <Hash.h>
@ -292,7 +292,7 @@ void hlw8012Loop() {
mqttSend(getSetting("powPFactorTopic", HLW8012_PFACTOR_TOPIC).c_str(), String(factor, 2).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 DOMOTICZ_SUPPORT
{ {
char buffer[20]; char buffer[20];
snprintf_P(buffer, strlen(buffer), PSTR("%d;%s"), _hlwPower, String(energy_delta, 3).c_str()); snprintf_P(buffer, strlen(buffer), PSTR("%d;%s"), _hlwPower, String(energy_delta, 3).c_str());
@ -306,7 +306,7 @@ void hlw8012Loop() {
} }
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBSend(getSetting("powPowerTopic", HLW8012_POWER_TOPIC).c_str(), String(_hlwPower).c_str()); influxDBSend(getSetting("powPowerTopic", HLW8012_POWER_TOPIC).c_str(), String(_hlwPower).c_str());
influxDBSend(getSetting("powCurrentTopic", HLW8012_CURRENT_TOPIC).c_str(), String(_hlwCurrent, 3).c_str()); influxDBSend(getSetting("powCurrentTopic", HLW8012_CURRENT_TOPIC).c_str(), String(_hlwCurrent, 3).c_str());
influxDBSend(getSetting("powVoltageTopic", HLW8012_VOLTAGE_TOPIC).c_str(), String(_hlwVoltage).c_str()); influxDBSend(getSetting("powVoltageTopic", HLW8012_VOLTAGE_TOPIC).c_str(), String(_hlwVoltage).c_str());


+ 1
- 1
code/espurna/i2c.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_I2C
#if I2C_SUPPORT
#include "brzo_i2c.h" #include "brzo_i2c.h"


+ 1
- 1
code/espurna/influxdb.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
#include "ESPAsyncTCP.h" #include "ESPAsyncTCP.h"
#include "SyncClient.h" #include "SyncClient.h"


+ 1
- 1
code/espurna/nofuss.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_NOFUSS
#if NOFUSS_SUPPORT
#include "NoFUSSClient.h" #include "NoFUSSClient.h"


+ 1
- 1
code/espurna/ota.ino View File

@ -39,7 +39,7 @@ void otaSetup() {
}); });
ArduinoOTA.onError([](ota_error_t error) { ArduinoOTA.onError([](ota_error_t error) {
#if ENABLE_SERIAL_DEBUG || ENABLE_UDP_DEBUG
#if DEBUG_SERIAL_SUPPORT || DEBUG_UDP_SUPPORT
DEBUG_MSG_P(PSTR("\n[OTA] Error #%u: "), error); DEBUG_MSG_P(PSTR("\n[OTA] Error #%u: "), error);
if (error == OTA_AUTH_ERROR) DEBUG_MSG_P(PSTR("Auth Failed\n")); if (error == OTA_AUTH_ERROR) DEBUG_MSG_P(PSTR("Auth Failed\n"));
else if (error == OTA_BEGIN_ERROR) DEBUG_MSG_P(PSTR("Begin Failed\n")); else if (error == OTA_BEGIN_ERROR) DEBUG_MSG_P(PSTR("Begin Failed\n"));


+ 3
- 3
code/espurna/relay.ino View File

@ -429,7 +429,7 @@ void relaySetupMQTT() {
// InfluxDB // InfluxDB
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
void relayInfluxDB(unsigned char id) { void relayInfluxDB(unsigned char id) {
if (id >= _relays.size()) return; if (id >= _relays.size()) return;
char buffer[10]; char buffer[10];
@ -520,11 +520,11 @@ void relayLoop(void) {
relayWS(); relayWS();
} }
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
domoticzSendRelay(id); domoticzSendRelay(id);
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
relayInfluxDB(id); relayInfluxDB(id);
#endif #endif


+ 1
- 1
code/espurna/rf.ino View File

@ -6,7 +6,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
#if ENABLE_RF
#if RF_SUPPORT
#include <RemoteReceiver.h> #include <RemoteReceiver.h>


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


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

@ -211,7 +211,7 @@ 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_HLW8012
#if HLW8012_SUPPORT
if (key == "powExpectedPower") { if (key == "powExpectedPower") {
hlw8012SetExpectedActivePower(value.toInt()); hlw8012SetExpectedActivePower(value.toInt());
@ -237,7 +237,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
if (key.startsWith("pow")) continue; if (key.startsWith("pow")) continue;
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
if (key == "dczRelayIdx") { if (key == "dczRelayIdx") {
if (dczRelayIdx >= relayCount()) continue; if (dczRelayIdx >= relayCount()) continue;
@ -347,22 +347,22 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
saveSettings(); saveSettings();
wifiConfigure(); wifiConfigure();
otaConfigure(); otaConfigure();
#if ENABLE_FAUXMO
fauxmoConfigure();
#if ALEXA_SUPPORT
alexaConfigure();
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
influxDBConfigure(); influxDBConfigure();
#endif #endif
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
domoticzConfigure(); domoticzConfigure();
#endif #endif
mqttConfigure(); mqttConfigure();
#if ENABLE_RF
#if RF_SUPPORT
rfBuildCodes(); rfBuildCodes();
#endif #endif
#if ENABLE_EMON
#if EMON_SUPPORT
setCurrentRatio(getSetting("emonRatio").toFloat()); setCurrentRatio(getSetting("emonRatio").toFloat());
#endif #endif
@ -475,7 +475,7 @@ void _wsStart(uint32_t client_id) {
root["tmpUnits"] = getSetting("tmpUnits", TMP_UNITS).toInt(); root["tmpUnits"] = getSetting("tmpUnits", TMP_UNITS).toInt();
#if ENABLE_DOMOTICZ
#if DOMOTICZ_SUPPORT
root["dczVisible"] = 1; root["dczVisible"] = 1;
root["dczEnabled"] = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1; root["dczEnabled"] = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1;
@ -487,26 +487,26 @@ void _wsStart(uint32_t client_id) {
dczRelayIdx.add(domoticzIdx(i)); dczRelayIdx.add(domoticzIdx(i));
} }
#if ENABLE_DHT
#if DHT_SUPPORT
root["dczTmpIdx"] = getSetting("dczTmpIdx").toInt(); root["dczTmpIdx"] = getSetting("dczTmpIdx").toInt();
root["dczHumIdx"] = getSetting("dczHumIdx").toInt(); root["dczHumIdx"] = getSetting("dczHumIdx").toInt();
#endif #endif
#if ENABLE_DS18B20
#if DS18B20_SUPPORT
root["dczTmpIdx"] = getSetting("dczTmpIdx").toInt(); root["dczTmpIdx"] = getSetting("dczTmpIdx").toInt();
#endif #endif
#if ENABLE_EMON
#if EMON_SUPPORT
root["dczPowIdx"] = getSetting("dczPowIdx").toInt(); root["dczPowIdx"] = getSetting("dczPowIdx").toInt();
root["dczEnergyIdx"] = getSetting("dczEnergyIdx").toInt(); root["dczEnergyIdx"] = getSetting("dczEnergyIdx").toInt();
root["dczCurrentIdx"] = getSetting("dczCurrentIdx").toInt(); root["dczCurrentIdx"] = getSetting("dczCurrentIdx").toInt();
#endif #endif
#if ENABLE_ANALOG
#if ANALOG_SUPPORT
root["dczAnaIdx"] = getSetting("dczAnaIdx").toInt(); root["dczAnaIdx"] = getSetting("dczAnaIdx").toInt();
#endif #endif
#if ENABLE_HLW8012
#if HLW8012_SUPPORT
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();
@ -515,7 +515,7 @@ void _wsStart(uint32_t client_id) {
#endif #endif
#if ENABLE_INFLUXDB
#if INFLUXDB_SUPPORT
root["idbVisible"] = 1; root["idbVisible"] = 1;
root["idbHost"] = getSetting("idbHost"); root["idbHost"] = getSetting("idbHost");
root["idbPort"] = getSetting("idbPort", INFLUXDB_PORT).toInt(); root["idbPort"] = getSetting("idbPort", INFLUXDB_PORT).toInt();
@ -524,29 +524,29 @@ void _wsStart(uint32_t client_id) {
root["idbPassword"] = getSetting("idbPassword"); root["idbPassword"] = getSetting("idbPassword");
#endif #endif
#if ENABLE_FAUXMO
root["fauxmoVisible"] = 1;
root["fauxmoEnabled"] = getSetting("fauxmoEnabled", FAUXMO_ENABLED).toInt() == 1;
#if ALEXA_SUPPORT
root["alexaVisible"] = 1;
root["alexaEnabled"] = getSetting("alexaEnabled", ALEXA_ENABLED).toInt() == 1;
#endif #endif
#if ENABLE_DS18B20
#if DS18B20_SUPPORT
root["dsVisible"] = 1; root["dsVisible"] = 1;
root["dsTmp"] = getDSTemperatureStr(); root["dsTmp"] = getDSTemperatureStr();
#endif #endif
#if ENABLE_DHT
#if DHT_SUPPORT
root["dhtVisible"] = 1; root["dhtVisible"] = 1;
root["dhtTmp"] = getDHTTemperature(); root["dhtTmp"] = getDHTTemperature();
root["dhtHum"] = getDHTHumidity(); root["dhtHum"] = getDHTHumidity();
#endif #endif
#if ENABLE_RF
#if RF_SUPPORT
root["rfVisible"] = 1; root["rfVisible"] = 1;
root["rfChannel"] = getSetting("rfChannel", RF_CHANNEL); root["rfChannel"] = getSetting("rfChannel", RF_CHANNEL);
root["rfDevice"] = getSetting("rfDevice", RF_DEVICE); root["rfDevice"] = getSetting("rfDevice", RF_DEVICE);
#endif #endif
#if ENABLE_EMON
#if EMON_SUPPORT
root["emonVisible"] = 1; root["emonVisible"] = 1;
root["emonApparentPower"] = getApparentPower(); root["emonApparentPower"] = getApparentPower();
root["emonCurrent"] = getCurrent(); root["emonCurrent"] = getCurrent();
@ -554,12 +554,12 @@ void _wsStart(uint32_t client_id) {
root["emonRatio"] = getSetting("emonRatio", EMON_CURRENT_RATIO); root["emonRatio"] = getSetting("emonRatio", EMON_CURRENT_RATIO);
#endif #endif
#if ENABLE_ANALOG
#if ANALOG_SUPPORT
root["analogVisible"] = 1; root["analogVisible"] = 1;
root["analogValue"] = getAnalog(); root["analogValue"] = getAnalog();
#endif #endif
#if ENABLE_HLW8012
#if HLW8012_SUPPORT
root["powVisible"] = 1; root["powVisible"] = 1;
root["powActivePower"] = getActivePower(); root["powActivePower"] = getActivePower();
root["powApparentPower"] = getApparentPower(); root["powApparentPower"] = getApparentPower();
@ -973,7 +973,7 @@ void webSetup() {
_server->on("/upgrade", HTTP_POST, _onUpgrade, _onUpgradeData); _server->on("/upgrade", HTTP_POST, _onUpgrade, _onUpgradeData);
// Serve static files // Serve static files
#if ENABLE_SPIFFS
#if SPIFFS_SUPPORT
_server->serveStatic("/", SPIFFS, "/") _server->serveStatic("/", SPIFFS, "/")
.setLastModified(_last_modified) .setLastModified(_last_modified)
.setFilter([](AsyncWebServerRequest *request) -> bool { .setFilter([](AsyncWebServerRequest *request) -> bool {


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

@ -27,7 +27,7 @@ String getNetwork() {
} }
void wifiDisconnect() { void wifiDisconnect() {
#if ENABLE_HLW8012
#if HLW8012_SUPPORT
hlw8012Enable(false); hlw8012Enable(false);
#endif #endif
jw.disconnect(); jw.disconnect();
@ -122,7 +122,7 @@ void wifiSetup() {
// Message callbacks // Message callbacks
jw.onMessage([](justwifi_messages_t code, char * parameter) { jw.onMessage([](justwifi_messages_t code, char * parameter) {
#if ENABLE_SERIAL_DEBUG || ENABLE_UDP_DEBUG
#if DEBUG_SERIAL_SUPPORT || DEBUG_UDP_SUPPORT
if (code == MESSAGE_SCANNING) { if (code == MESSAGE_SCANNING) {
DEBUG_MSG_P(PSTR("[WIFI] Scanning\n")); DEBUG_MSG_P(PSTR("[WIFI] Scanning\n"));
@ -179,7 +179,7 @@ void wifiSetup() {
#endif #endif
// Configure mDNS // Configure mDNS
#if ENABLE_MDNS
#if MDNS_SUPPORT
if (code == MESSAGE_CONNECTED || code == MESSAGE_ACCESSPOINT_CREATED) { if (code == MESSAGE_CONNECTED || code == MESSAGE_ACCESSPOINT_CREATED) {
if (MDNS.begin(WiFi.getMode() == WIFI_AP ? APP_NAME : (char *) WiFi.hostname().c_str())) { if (MDNS.begin(WiFi.getMode() == WIFI_AP ? APP_NAME : (char *) WiFi.hostname().c_str())) {
MDNS.addService("http", "tcp", getSetting("webPort", WEBSERVER_PORT).toInt()); MDNS.addService("http", "tcp", getSetting("webPort", WEBSERVER_PORT).toInt());
@ -196,7 +196,7 @@ void wifiSetup() {
} }
// Manage POW // Manage POW
#if ENABLE_HLW8012
#if HLW8012_SUPPORT
if (code == MESSAGE_CONNECTED) { if (code == MESSAGE_CONNECTED) {
hlw8012Enable(true); hlw8012Enable(true);
} }


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

@ -372,9 +372,9 @@
<div class="pure-u-1 pure-u-md-3-4 hint">Use gamma correction for RGB channels.<br />Will only work if "use colorpicker" above is also ON.</div> <div class="pure-u-1 pure-u-md-3-4 hint">Use gamma correction for RGB channels.<br />Will only work if "use colorpicker" above is also ON.</div>
</div> </div>
<div class="pure-g module module-fauxmo">
<div class="pure-u-1 pure-u-sm-1-4"><label for="fauxmoEnabled">Alexa integration</label></div>
<div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="fauxmoEnabled" tabindex="11" /></div>
<div class="pure-g module module-alexa">
<div class="pure-u-1 pure-u-sm-1-4"><label for="alexaEnabled">Alexa integration</label></div>
<div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="alexaEnabled" tabindex="11" /></div>
</div> </div>
<div class="pure-g module module-ds module-dht"> <div class="pure-g module module-ds module-dht">
@ -525,7 +525,7 @@
</div> </div>
</div> </div>
<div class="pure-g module module-fauxmo">
<div class="pure-g">
<div class="pure-u-1 pure-u-sm-1-4"><label for="mqttUseJson">Use JSON payload</label></div> <div class="pure-u-1 pure-u-sm-1-4"><label for="mqttUseJson">Use JSON payload</label></div>
<div class="pure-u-1 pure-u-sm-3-4"><input type="checkbox" name="mqttUseJson" tabindex="26" /></div> <div class="pure-u-1 pure-u-sm-3-4"><input type="checkbox" name="mqttUseJson" tabindex="26" /></div>
<div class="pure-u-1 pure-u-md-1-4">&nbsp;</div> <div class="pure-u-1 pure-u-md-1-4">&nbsp;</div>


Loading…
Cancel
Save