Browse Source

Merge branch 'dev' into softcfg

v2
Xose Pérez 6 years ago
parent
commit
2d12102672
23 changed files with 16078 additions and 16032 deletions
  1. +3
    -2
      code/espurna/api.ino
  2. +7
    -2
      code/espurna/config/arduino.h
  3. +5
    -0
      code/espurna/config/dependencies.h
  4. +4
    -0
      code/espurna/config/general.h
  5. +18
    -9
      code/espurna/config/progmem.h
  6. +1
    -1
      code/espurna/config/sensors.h
  7. BIN
      code/espurna/data/index.all.html.gz
  8. BIN
      code/espurna/data/index.light.html.gz
  9. BIN
      code/espurna/data/index.rfbridge.html.gz
  10. BIN
      code/espurna/data/index.rfm69.html.gz
  11. BIN
      code/espurna/data/index.sensor.html.gz
  12. BIN
      code/espurna/data/index.small.html.gz
  13. +3
    -1
      code/espurna/espurna.ino
  14. +10
    -3
      code/espurna/light.ino
  15. +5
    -3
      code/espurna/relay.ino
  16. +11
    -5
      code/espurna/sensor.ino
  17. +3047
    -3046
      code/espurna/static/index.all.html.gz.h
  18. +2387
    -2386
      code/espurna/static/index.light.html.gz.h
  19. +2052
    -2051
      code/espurna/static/index.rfbridge.html.gz.h
  20. +3413
    -3412
      code/espurna/static/index.rfm69.html.gz.h
  21. +2600
    -2599
      code/espurna/static/index.sensor.html.gz.h
  22. +2509
    -2509
      code/espurna/static/index.small.html.gz.h
  23. +3
    -3
      code/html/index.html

+ 3
- 2
code/espurna/api.ino View File

@ -8,7 +8,7 @@ Module key prefix: api
*/ */
#if WEB_SUPPORT
#if API_SUPPORT
#include <ESPAsyncTCP.h> #include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
@ -29,6 +29,7 @@ bool _apiKeyCheck(const char * key) {
} }
void _apiWebSocketOnSend(JsonObject& root) { void _apiWebSocketOnSend(JsonObject& root) {
root["apiVisible"] = 1;
root["apiEnabled"] = getSetting("apiEnabled", API_ENABLED).toInt() == 1; root["apiEnabled"] = getSetting("apiEnabled", API_ENABLED).toInt() == 1;
root["apiKey"] = getSetting("apiKey"); root["apiKey"] = getSetting("apiKey");
root["apiRealTime"] = apiRealTime(); root["apiRealTime"] = apiRealTime();
@ -222,4 +223,4 @@ void apiSetup() {
wsOnSendRegister(_apiWebSocketOnSend); wsOnSendRegister(_apiWebSocketOnSend);
} }
#endif // WEB_SUPPORT
#endif // API_SUPPORT

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

@ -96,7 +96,9 @@
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//#define ALEXA_SUPPORT 0 //#define ALEXA_SUPPORT 0
//#define API_SUPPORT 0
//#define BROKER_SUPPORT 0 //#define BROKER_SUPPORT 0
//#define BUTTON_SUPPORT 0
//#define DEBUG_SERIAL_SUPPORT 0 //#define DEBUG_SERIAL_SUPPORT 0
//#define DEBUG_TELNET_SUPPORT 0 //#define DEBUG_TELNET_SUPPORT 0
//#define DEBUG_UDP_SUPPORT 1 //#define DEBUG_UDP_SUPPORT 1
@ -106,15 +108,18 @@
//#define I2C_SUPPORT 1 //#define I2C_SUPPORT 1
//#define INFLUXDB_SUPPORT 1 //#define INFLUXDB_SUPPORT 1
//#define IR_SUPPORT 1 //#define IR_SUPPORT 1
//#define LED_SUPPORT 0
//#define LLMNR_SUPPORT 1 // Only with Arduino Core 2.4.0 //#define LLMNR_SUPPORT 1 // Only with Arduino Core 2.4.0
//#define MDNS_SERVER_SUPPORT 0
//#define MDNS_CLIENT_SUPPORT 1 //#define MDNS_CLIENT_SUPPORT 1
//#define MDNS_SERVER_SUPPORT 0
//#define MQTT_SUPPORT 0 //#define MQTT_SUPPORT 0
//#define NETBIOS_SUPPORT 1 // Only with Arduino Core 2.4.0 //#define NETBIOS_SUPPORT 1 // Only with Arduino Core 2.4.0
//#define NOFUSS_SUPPORT 1 //#define NOFUSS_SUPPORT 1
//#define NTP_SUPPORT 0 //#define NTP_SUPPORT 0
//#define RFM69_SUPPORT 1
//#define RF_SUPPORT 1 //#define RF_SUPPORT 1
//#define SCHEDULER_SUPPORT 0 //#define SCHEDULER_SUPPORT 0
//#define SENSOR_SUPPORT 1
//#define SPIFFS_SUPPORT 1 //#define SPIFFS_SUPPORT 1
//#define SSDP_SUPPORT 1 //#define SSDP_SUPPORT 1
//#define TELNET_SUPPORT 0 //#define TELNET_SUPPORT 0
@ -140,6 +145,7 @@
//#define EMON_ADS1X15_SUPPORT 1 //#define EMON_ADS1X15_SUPPORT 1
//#define EMON_ANALOG_SUPPORT 1 //#define EMON_ANALOG_SUPPORT 1
//#define EVENTS_SUPPORT 1 //#define EVENTS_SUPPORT 1
//#define GEIGER_SUPPORT 1
//#define GUVAS12SD_SUPPORT 1 //#define GUVAS12SD_SUPPORT 1
//#define HLW8012_SUPPORT 1 //#define HLW8012_SUPPORT 1
//#define MHZ19_SUPPORT 1 //#define MHZ19_SUPPORT 1
@ -151,4 +157,3 @@
//#define SONAR_SUPPORT 1 //#define SONAR_SUPPORT 1
//#define TMP3X_SUPPORT 1 //#define TMP3X_SUPPORT 1
//#define V9261F_SUPPORT 1 //#define V9261F_SUPPORT 1
//#define GEIGER_SUPPORT 1

+ 5
- 0
code/espurna/config/dependencies.h View File

@ -15,6 +15,11 @@
#define DEBUG_WEB_SUPPORT 0 #define DEBUG_WEB_SUPPORT 0
#endif #endif
#if not WEB_SUPPORT
#undef API_SUPPORT
#define API_SUPPORT 0 // API support requires web support
#endif
#if not WEB_SUPPORT #if not WEB_SUPPORT
#undef SSDP_SUPPORT #undef SSDP_SUPPORT
#define SSDP_SUPPORT 0 // SSDP support requires web support #define SSDP_SUPPORT 0 // SSDP support requires web support


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

@ -417,6 +417,10 @@
// API // API
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef API_SUPPORT
#define API_SUPPORT 1 // API (REST & RPC) support built in
#endif
// This will only be enabled if WEB_SUPPORT is 1 (this is the default value) // This will only be enabled if WEB_SUPPORT is 1 (this is the default value)
#ifndef API_ENABLED #ifndef API_ENABLED
#define API_ENABLED 0 // Do not enable API by default #define API_ENABLED 0 // Do not enable API by default


+ 18
- 9
code/espurna/config/progmem.h View File

@ -31,9 +31,15 @@ PROGMEM const char espurna_modules[] =
#if ALEXA_SUPPORT #if ALEXA_SUPPORT
"ALEXA " "ALEXA "
#endif #endif
#if API_SUPPORT
"API "
#endif
#if BROKER_SUPPORT #if BROKER_SUPPORT
"BROKER " "BROKER "
#endif #endif
#if BUTTON_SUPPORT
"BUTTON "
#endif
#if DEBUG_SERIAL_SUPPORT #if DEBUG_SERIAL_SUPPORT
"DEBUG_SERIAL " "DEBUG_SERIAL "
#endif #endif
@ -61,15 +67,18 @@ PROGMEM const char espurna_modules[] =
#if IR_SUPPORT #if IR_SUPPORT
"IR " "IR "
#endif #endif
#if LED_SUPPORT
"LED "
#endif
#if LLMNR_SUPPORT #if LLMNR_SUPPORT
"LLMNR " "LLMNR "
#endif #endif
#if MDNS_SERVER_SUPPORT
"MDNS_SERVER "
#endif
#if MDNS_CLIENT_SUPPORT #if MDNS_CLIENT_SUPPORT
"MDNS_CLIENT " "MDNS_CLIENT "
#endif #endif
#if MDNS_SERVER_SUPPORT
"MDNS_SERVER "
#endif
#if MQTT_SUPPORT #if MQTT_SUPPORT
"MQTT " "MQTT "
#endif #endif
@ -82,12 +91,12 @@ PROGMEM const char espurna_modules[] =
#if NTP_SUPPORT #if NTP_SUPPORT
"NTP " "NTP "
#endif #endif
#if RF_SUPPORT
"RF "
#endif
#if RFM69_SUPPORT #if RFM69_SUPPORT
"RFM69 " "RFM69 "
#endif #endif
#if RF_SUPPORT
"RF "
#endif
#if SCHEDULER_SUPPORT #if SCHEDULER_SUPPORT
"SCHEDULER " "SCHEDULER "
#endif #endif
@ -169,9 +178,6 @@ PROGMEM const char espurna_sensors[] =
#if GUVAS12SD_SUPPORT #if GUVAS12SD_SUPPORT
"GUVAS12SD " "GUVAS12SD "
#endif #endif
#if SONAR_SUPPORT
"SONAR "
#endif
#if HLW8012_SUPPORT #if HLW8012_SUPPORT
"HLW8012 " "HLW8012 "
#endif #endif
@ -196,6 +202,9 @@ PROGMEM const char espurna_sensors[] =
#if SI7021_SUPPORT #if SI7021_SUPPORT
"SI7021 " "SI7021 "
#endif #endif
#if SONAR_SUPPORT
"SONAR "
#endif
#if TMP3X_SUPPORT #if TMP3X_SUPPORT
"TMP3X " "TMP3X "
#endif #endif


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

@ -534,7 +534,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// SHT3X I2C (Wemos) temperature & humidity sensor // SHT3X I2C (Wemos) temperature & humidity sensor
// Enable support by passing SHT3X_SUPPORT=1 build flag
// Enable support by passing SHT3X_I2C_SUPPORT=1 build flag
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef SHT3X_I2C_SUPPORT #ifndef SHT3X_I2C_SUPPORT


BIN
code/espurna/data/index.all.html.gz View File


BIN
code/espurna/data/index.light.html.gz View File


BIN
code/espurna/data/index.rfbridge.html.gz View File


BIN
code/espurna/data/index.rfm69.html.gz View File


BIN
code/espurna/data/index.sensor.html.gz View File


BIN
code/espurna/data/index.small.html.gz View File


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

@ -89,11 +89,13 @@ void setup() {
#if WEB_SUPPORT #if WEB_SUPPORT
webSetup(); webSetup();
wsSetup(); wsSetup();
apiSetup();
#if DEBUG_WEB_SUPPORT #if DEBUG_WEB_SUPPORT
debugWebSetup(); debugWebSetup();
#endif #endif
#endif #endif
#if API_SUPPORT
apiSetup();
#endif
// lightSetup must be called before relaySetup // lightSetup must be called before relaySetup
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE


+ 10
- 3
code/espurna/light.ino View File

@ -284,7 +284,7 @@ void _fromHSV(const char * hsv) {
void _fromKelvin(unsigned long kelvin) { void _fromKelvin(unsigned long kelvin) {
if (!_light_has_color) return; if (!_light_has_color) return;
_light_mireds = constrain(round(1000000UL / kelvin), LIGHT_MIN_MIREDS, LIGHT_MAX_MIREDS); _light_mireds = constrain(round(1000000UL / kelvin), LIGHT_MIN_MIREDS, LIGHT_MAX_MIREDS);
if (_light_use_cct) { if (_light_use_cct) {
@ -822,6 +822,10 @@ void _lightWebSocketOnAction(uint32_t client_id, const char * action, JsonObject
} }
} }
#endif
#if API_SUPPORT
void _lightAPISetup() { void _lightAPISetup() {
// API entry points (protected with apikey) // API entry points (protected with apikey)
if (_light_has_color) { if (_light_has_color) {
@ -892,7 +896,7 @@ void _lightAPISetup() {
} }
} }
#endif // WEB_SUPPORT
#endif // API_SUPPORT
#if TERMINAL_SUPPORT #if TERMINAL_SUPPORT
@ -1087,7 +1091,6 @@ void lightSetup() {
_lightColorRestore(); _lightColorRestore();
#if WEB_SUPPORT #if WEB_SUPPORT
_lightAPISetup();
wsOnSendRegister(_lightWebSocketOnSend); wsOnSendRegister(_lightWebSocketOnSend);
wsOnActionRegister(_lightWebSocketOnAction); wsOnActionRegister(_lightWebSocketOnAction);
wsOnAfterParseRegister([]() { wsOnAfterParseRegister([]() {
@ -1098,6 +1101,10 @@ void lightSetup() {
}); });
#endif #endif
#if API_SUPPORT
_lightAPISetup();
#endif
#if MQTT_SUPPORT #if MQTT_SUPPORT
mqttRegister(_lightMQTTCallback); mqttRegister(_lightMQTTCallback);
#endif #endif


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

@ -676,7 +676,7 @@ void relaySetupWS() {
// REST API // REST API
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if WEB_SUPPORT
#if API_SUPPORT
void relaySetupAPI() { void relaySetupAPI() {
@ -748,7 +748,7 @@ void relaySetupAPI() {
} }
#endif // WEB_SUPPORT
#endif // API_SUPPORT
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// MQTT // MQTT
@ -1017,9 +1017,11 @@ void relaySetup() {
espurnaRegisterLoop(_relayLoop); espurnaRegisterLoop(_relayLoop);
#if WEB_SUPPORT #if WEB_SUPPORT
relaySetupAPI();
relaySetupWS(); relaySetupWS();
#endif #endif
#if API_SUPPORT
relaySetupAPI();
#endif
#if MQTT_SUPPORT #if MQTT_SUPPORT
relaySetupMQTT(); relaySetupMQTT();
#endif #endif


+ 11
- 5
code/espurna/sensor.ino View File

@ -217,6 +217,10 @@ void _sensorWebSocketStart(JsonObject& root) {
} }
#endif // WEB_SUPPORT
#if API_SUPPORT
void _sensorAPISetup() { void _sensorAPISetup() {
for (unsigned char magnitude_id=0; magnitude_id<_magnitudes.size(); magnitude_id++) { for (unsigned char magnitude_id=0; magnitude_id<_magnitudes.size(); magnitude_id++) {
@ -236,7 +240,8 @@ void _sensorAPISetup() {
} }
} }
#endif
#endif // API_SUPPORT
#if TERMINAL_SUPPORT #if TERMINAL_SUPPORT
@ -1062,18 +1067,19 @@ void sensorSetup() {
// Configure stored values // Configure stored values
_sensorConfigure(); _sensorConfigure();
// Websockets
#if WEB_SUPPORT #if WEB_SUPPORT
// Websockets
wsOnSendRegister(_sensorWebSocketStart); wsOnSendRegister(_sensorWebSocketStart);
wsOnSendRegister(_sensorWebSocketSendData); wsOnSendRegister(_sensorWebSocketSendData);
wsOnAfterParseRegister(_sensorConfigure); wsOnAfterParseRegister(_sensorConfigure);
#endif
// API
// API
#if API_SUPPORT
_sensorAPISetup(); _sensorAPISetup();
#endif #endif
// Terminal
#if TERMINAL_SUPPORT #if TERMINAL_SUPPORT
_sensorInitCommands(); _sensorInitCommands();
#endif #endif


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


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


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


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


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


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


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

@ -550,12 +550,12 @@
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="wsAuth" /></div> <div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="wsAuth" /></div>
</div> </div>
<div class="pure-g">
<div class="pure-g module module-api">
<label class="pure-u-1 pure-u-lg-1-4">Enable HTTP API</label> <label class="pure-u-1 pure-u-lg-1-4">Enable HTTP API</label>
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="apiEnabled" /></div> <div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="apiEnabled" /></div>
</div> </div>
<div class="pure-g">
<div class="pure-g module module-api">
<label class="pure-u-1 pure-u-lg-1-4">Real time API</label> <label class="pure-u-1 pure-u-lg-1-4">Real time API</label>
<div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="apiRealTime" /></div> <div class="pure-u-1 pure-u-lg-1-4"><input type="checkbox" name="apiRealTime" /></div>
<div class="pure-u-0 pure-u-lg-1-2"></div> <div class="pure-u-0 pure-u-lg-1-2"></div>
@ -566,7 +566,7 @@
</div> </div>
</div> </div>
<div class="pure-g">
<div class="pure-g module module-api">
<label class="pure-u-1 pure-u-lg-1-4">HTTP API Key</label> <label class="pure-u-1 pure-u-lg-1-4">HTTP API Key</label>
<input name="apiKey" class="pure-u-3-4 pure-u-lg-1-2" type="text" tabindex="14" /> <input name="apiKey" class="pure-u-3-4 pure-u-lg-1-2" type="text" tabindex="14" />
<div class=" pure-u-1-4 pure-u-lg-1-4"><button class="pure-button button-apikey pure-u-23-24">Auto</button></div> <div class=" pure-u-1-4 pure-u-lg-1-4"><button class="pure-button button-apikey pure-u-23-24">Auto</button></div>


Loading…
Cancel
Save