Browse Source

Merge branch 'dev' into thermostat

# Conflicts:
#	code/espurna/config/webui.h
#	code/espurna/data/index.all.html.gz
#	code/espurna/data/index.light.html.gz
#	code/espurna/data/index.rfbridge.html.gz
#	code/espurna/data/index.rfm69.html.gz
#	code/espurna/data/index.sensor.html.gz
#	code/espurna/data/index.small.html.gz
#	code/espurna/espurna.ino
#	code/espurna/static/index.all.html.gz.h
#	code/espurna/static/index.light.html.gz.h
#	code/espurna/static/index.rfbridge.html.gz.h
#	code/espurna/static/index.rfm69.html.gz.h
#	code/espurna/static/index.sensor.html.gz.h
#	code/espurna/static/index.small.html.gz.h
#	code/espurna/web.ino
#	code/gulpfile.js
#	code/html/index.html
rules-rpn
Dmitry Blinov 5 years ago
parent
commit
376205c9bb
33 changed files with 21316 additions and 18176 deletions
  1. +2
    -0
      code/.gitignore
  2. +37
    -2
      code/espurna/button.ino
  3. +2
    -0
      code/espurna/config/arduino.h
  4. +90
    -0
      code/espurna/config/hardware.h
  5. +12
    -1
      code/espurna/config/webui.h
  6. BIN
      code/espurna/data/index.all.html.gz
  7. BIN
      code/espurna/data/index.light.html.gz
  8. BIN
      code/espurna/data/index.lightfox.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. +1
    -1
      code/espurna/domoticz.ino
  14. +3
    -0
      code/espurna/espurna.ino
  15. +20
    -5
      code/espurna/light.ino
  16. +107
    -0
      code/espurna/lightfox.ino
  17. +32
    -1
      code/espurna/migrate.ino
  18. +2
    -0
      code/espurna/relay.ino
  19. +1
    -1
      code/espurna/sensor.ino
  20. +3156
    -3193
      code/espurna/static/index.all.html.gz.h
  21. +3032
    -3011
      code/espurna/static/index.light.html.gz.h
  22. +2595
    -0
      code/espurna/static/index.lightfox.html.gz.h
  23. +2634
    -2618
      code/espurna/static/index.rfbridge.html.gz.h
  24. +4115
    -4094
      code/espurna/static/index.rfm69.html.gz.h
  25. +2698
    -2677
      code/espurna/static/index.sensor.html.gz.h
  26. +2592
    -2571
      code/espurna/static/index.small.html.gz.h
  27. +1
    -1
      code/espurna/system.ino
  28. +2
    -0
      code/espurna/web.ino
  29. +6
    -0
      code/gulpfile.js
  30. +2
    -0
      code/html/custom.css
  31. +55
    -0
      code/html/custom.js
  32. +46
    -0
      code/html/index.html
  33. +73
    -0
      code/platformio.ini

+ 2
- 0
code/.gitignore View File

@ -11,3 +11,5 @@ custom.h
.vscode/.browse.c_cpp.db* .vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json .vscode/c_cpp_properties.json
.vscode/launch.json .vscode/launch.json
.pioenvs
.piolibdeps

+ 37
- 2
code/espurna/button.ino View File

@ -164,13 +164,25 @@ void buttonEvent(unsigned int id, unsigned char event) {
void buttonSetup() { void buttonSetup() {
#ifdef ITEAD_SONOFF_DUAL
#if defined(ITEAD_SONOFF_DUAL)
unsigned int actions = buttonStore(BUTTON_MODE_NONE, BUTTON_MODE_TOGGLE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE); unsigned int actions = buttonStore(BUTTON_MODE_NONE, BUTTON_MODE_TOGGLE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE);
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, 1}); _buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, 1});
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, 2}); _buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, 2});
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, BUTTON3_RELAY}); _buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, BUTTON3_RELAY});
#elif defined(FOXEL_LIGHTFOX_DUAL)
unsigned int actions = buttonStore(BUTTON_MODE_NONE, BUTTON_MODE_TOGGLE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE);
unsigned int btn1Relay = getSetting("btnRelay", 0, BUTTON1_RELAY - 1).toInt() + 1;
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, btn1Relay});
unsigned int btn2Relay = getSetting("btnRelay", 1, BUTTON2_RELAY - 1).toInt() + 1;
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, btn2Relay});
unsigned int btn3Relay = getSetting("btnRelay", 2, BUTTON3_RELAY - 1).toInt() + 1;
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, btn3Relay});
unsigned int btn4Relay = getSetting("btnRelay", 3, BUTTON4_RELAY - 1).toInt() + 1;
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, btn4Relay});
#else #else
unsigned long btnDelay = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY).toInt(); unsigned long btnDelay = getSetting("btnDelay", BUTTON_DBLCLICK_DELAY).toInt();
@ -240,7 +252,7 @@ void buttonSetup() {
void buttonLoop() { void buttonLoop() {
#ifdef ITEAD_SONOFF_DUAL
#if defined(ITEAD_SONOFF_DUAL)
if (Serial.available() >= 4) { if (Serial.available() >= 4) {
if (Serial.read() == 0xA0) { if (Serial.read() == 0xA0) {
@ -280,6 +292,29 @@ void buttonLoop() {
} }
} }
#elif defined(FOXEL_LIGHTFOX_DUAL)
if (Serial.available() >= 4) {
if (Serial.read() == 0xA0) {
if (Serial.read() == 0x04) {
unsigned char value = Serial.read();
if (Serial.read() == 0xA1) {
DEBUG_MSG_P(PSTR("[BUTTON] [LIGHTFOX] Received buttons mask: %d\n"), value);
for (unsigned int i=0; i<_buttons.size(); i++) {
bool clicked = (value & (1 << i)) > 0;
if (clicked) {
buttonEvent(i, BUTTON_EVENT_CLICK);
}
}
}
}
}
}
#else #else
for (unsigned int i=0; i < _buttons.size(); i++) { for (unsigned int i=0; i < _buttons.size(); i++) {


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

@ -116,6 +116,8 @@
//#define GOSUND_WS1 //#define GOSUND_WS1
//#define ARILUX_AL_LC02_V14 //#define ARILUX_AL_LC02_V14
//#define BLITZWOLF_BWSHPX_V23 //#define BLITZWOLF_BWSHPX_V23
//#define DIGOO_NX_SP202
//#define FOXEL_LIGHTFOX_DUAL
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// Features (values below are non-default values) // Features (values below are non-default values)


+ 90
- 0
code/espurna/config/hardware.h View File

@ -3369,6 +3369,96 @@
#define HLW8012_POWER_RATIO 3414290 #define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING #define HLW8012_INTERRUPT_ON FALLING
// ----------------------------------------------------------------------------------------
// Hama WiFi Steckdose (00176533)
// https://at.hama.com/00176533/hama-wifi-steckdose-3500w-16a
// ----------------------------------------------------------------------------------------
#elif defined(HAMA_WIFI_STECKDOSE_00176533)
// Info
#define MANUFACTURER "HAMA"
#define DEVICE "WIFI_STECKDOSE_00176533"
// Buttons
#define BUTTON1_PIN 13
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_TYPE RELAY_TYPE_NORMAL
// LEDs
#define LED1_PIN 4
#define LED1_PIN_INVERSE 1
// -----------------------------------------------------------------------------
// Oxaoxe NX-SP202
// Digoo NX-SP202 (not tested)
// Digoo DG-SP202 (not tested)
// https://github.com/xoseperez/espurna/issues/1502
// -----------------------------------------------------------------------------
#elif defined(DIGOO_NX_SP202)
// Info
#define MANUFACTURER "DIGOO"
#define DEVICE "NX_SP202"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_PIN 16
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 15
#define RELAY1_TYPE RELAY_TYPE_NORMAL
#define RELAY2_PIN 14
#define RELAY2_TYPE RELAY_TYPE_NORMAL
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
// HJL01 / BL0937
#ifndef HLW8012_SUPPORT
#define HLW8012_SUPPORT 1
#endif
#define HLW8012_SEL_PIN 12
#define HLW8012_CF1_PIN 5
#define HLW8012_CF_PIN 4
#define HLW8012_SEL_CURRENT LOW
#define HLW8012_CURRENT_RATIO 23296
#define HLW8012_VOLTAGE_RATIO 310085
#define HLW8012_POWER_RATIO 3368471
#define HLW8012_INTERRUPT_ON FALLING
// -----------------------------------------------------------------------------
// Foxel's LightFox dual
// https://github.com/foxel/esp-dual-rf-switch
// -----------------------------------------------------------------------------
#elif defined(FOXEL_LIGHTFOX_DUAL)
// Info
#define MANUFACTURER "FOXEL"
#define DEVICE "LIGHTFOX_DUAL"
#define SERIAL_BAUDRATE 19200
#define RELAY_PROVIDER RELAY_PROVIDER_DUAL
#define DUMMY_RELAY_COUNT 2
#define DEBUG_SERIAL_SUPPORT 0
// Buttons
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
#define BUTTON3_RELAY 2
#define BUTTON4_RELAY 1
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// TEST boards (do not use!!) // TEST boards (do not use!!)
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 12
- 1
code/espurna/config/webui.h View File

@ -7,7 +7,8 @@
#define WEBUI_IMAGE_SENSOR 2 #define WEBUI_IMAGE_SENSOR 2
#define WEBUI_IMAGE_RFBRIDGE 4 #define WEBUI_IMAGE_RFBRIDGE 4
#define WEBUI_IMAGE_RFM69 8 #define WEBUI_IMAGE_RFM69 8
#define WEBUI_IMAGE_THERMOSTAT 9
#define WEBUI_IMAGE_LIGHTFOX 16
#define WEBUI_IMAGE_THERMOSTAT 32
#define WEBUI_IMAGE_FULL 15 #define WEBUI_IMAGE_FULL 15
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE #if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
@ -46,6 +47,13 @@
#endif #endif
#endif #endif
#if defined(FOXEL_LIGHTFOX_DUAL)
#ifdef WEBUI_IMAGE
#undef WEBUI_IMAGE
#endif
#define WEBUI_IMAGE WEBUI_IMAGE_LIGHTFOX
#endif
#if THERMOSTAT_SUPPORT == 1 #if THERMOSTAT_SUPPORT == 1
#ifndef WEBUI_IMAGE #ifndef WEBUI_IMAGE
#define WEBUI_IMAGE WEBUI_IMAGE_THERMOSTAT #define WEBUI_IMAGE WEBUI_IMAGE_THERMOSTAT
@ -77,6 +85,9 @@ PROGMEM const char espurna_webui[] =
#if WEBUI_IMAGE == WEBUI_IMAGE_RFM69 #if WEBUI_IMAGE == WEBUI_IMAGE_RFM69
"RFM69" "RFM69"
#endif #endif
#if WEBUI_IMAGE == WEBUI_IMAGE_LIGHTFOX
"LIGHTFOX"
#endif
#if WEBUI_IMAGE == WEBUI_IMAGE_THERMOSTAT #if WEBUI_IMAGE == WEBUI_IMAGE_THERMOSTAT
"THERMOSTAT" "THERMOSTAT"
#endif #endif


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.lightfox.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


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

@ -139,7 +139,7 @@ void _domoticzMqtt(unsigned int type, const char * topic, const char * payload)
if (relayID >= 0) { if (relayID >= 0) {
unsigned char value = root["nvalue"]; unsigned char value = root["nvalue"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %u for IDX %u\n"), value, idx); DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %u for IDX %u\n"), value, idx);
_domoticzStatus(relayID, value > 1);
_domoticzStatus(relayID, value >= 1);
} }
} }


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

@ -189,6 +189,9 @@ void setup() {
#if UART_MQTT_SUPPORT #if UART_MQTT_SUPPORT
uartmqttSetup(); uartmqttSetup();
#endif #endif
#ifdef FOXEL_LIGHTFOX_DUAL
lightfoxSetup();
#endif
#if THERMOSTAT_SUPPORT #if THERMOSTAT_SUPPORT
thermostatSetup(); thermostatSetup();
#endif #endif


+ 20
- 5
code/espurna/light.ino View File

@ -989,8 +989,15 @@ void _lightInitCommands() {
terminalRegisterCommand(F("BRIGHTNESS"), [](Embedis* e) { terminalRegisterCommand(F("BRIGHTNESS"), [](Embedis* e) {
if (e->argc > 1) { if (e->argc > 1) {
lightBrightness(String(e->argv[1]).toInt());
lightUpdate(true, true);
const String value(e->argv[1]);
if( value.length() > 0 ) {
if( value[0] == '+' || value[0] == '-' ) {
lightBrightness(lightBrightness()+String(e->argv[1]).toInt());
} else {
lightBrightness(String(e->argv[1]).toInt());
}
lightUpdate(true, true);
}
} }
DEBUG_MSG_P(PSTR("Brightness: %d\n"), lightBrightness()); DEBUG_MSG_P(PSTR("Brightness: %d\n"), lightBrightness());
terminalOK(); terminalOK();
@ -1032,9 +1039,17 @@ void _lightInitCommands() {
terminalRegisterCommand(F("MIRED"), [](Embedis* e) { terminalRegisterCommand(F("MIRED"), [](Embedis* e) {
if (e->argc > 1) { if (e->argc > 1) {
String color = String("M") + String(e->argv[1]);
lightColor(color.c_str());
lightUpdate(true, true);
const String value(e->argv[1]);
String color = String("M");
if( value.length() > 0 ) {
if( value[0] == '+' || value[0] == '-' ) {
color += String(_light_mireds + String(e->argv[1]).toInt());
} else {
color += String(e->argv[1]);
}
lightColor(color.c_str());
lightUpdate(true, true);
}
} }
DEBUG_MSG_P(PSTR("Color: %s\n"), lightColor().c_str()); DEBUG_MSG_P(PSTR("Color: %s\n"), lightColor().c_str());
terminalOK(); terminalOK();


+ 107
- 0
code/espurna/lightfox.ino View File

@ -0,0 +1,107 @@
/*
LightFox module
Copyright (C) 2019 by Andrey F. Kupreychik <foxle@quickfox.ru>
*/
#ifdef FOXEL_LIGHTFOX_DUAL
// -----------------------------------------------------------------------------
// DEFINITIONS
// -----------------------------------------------------------------------------
#define LIGHTFOX_CODE_START 0xA0
#define LIGHTFOX_CODE_LEARN 0xF1
#define LIGHTFOX_CODE_CLEAR 0xF2
#define LIGHTFOX_CODE_STOP 0xA1
// -----------------------------------------------------------------------------
// PUBLIC
// -----------------------------------------------------------------------------
void lightfoxLearn() {
Serial.write(LIGHTFOX_CODE_START);
Serial.write(LIGHTFOX_CODE_LEARN);
Serial.write(0x00);
Serial.write(LIGHTFOX_CODE_STOP);
Serial.println();
Serial.flush();
DEBUG_MSG_P(PSTR("[LIGHTFOX] Learn comman sent\n"));
}
void lightfoxClear() {
Serial.write(LIGHTFOX_CODE_START);
Serial.write(LIGHTFOX_CODE_CLEAR);
Serial.write(0x00);
Serial.write(LIGHTFOX_CODE_STOP);
Serial.println();
Serial.flush();
DEBUG_MSG_P(PSTR("[LIGHTFOX] Clear comman sent\n"));
}
// -----------------------------------------------------------------------------
// WEB
// -----------------------------------------------------------------------------
#if WEB_SUPPORT
void _lightfoxWebSocketOnSend(JsonObject& root) {
root["lightfoxVisible"] = 1;
uint8_t buttonsCount = _buttons.size();
root["lightfoxRelayCount"] = relayCount();
JsonArray& rfb = root.createNestedArray("lightfoxButtons");
for (byte id=0; id<buttonsCount; id++) {
JsonObject& node = rfb.createNestedObject();
node["id"] = id;
node["relay"] = getSetting("btnRelay", id, "0");
}
}
void _lightfoxWebSocketOnAction(uint32_t client_id, const char * action, JsonObject& data) {
if (strcmp(action, "lightfoxLearn") == 0) lightfoxLearn();
if (strcmp(action, "lightfoxClear") == 0) lightfoxClear();
}
#endif
// -----------------------------------------------------------------------------
// TERMINAL
// -----------------------------------------------------------------------------
#if TERMINAL_SUPPORT
void _lightfoxInitCommands() {
terminalRegisterCommand(F("LIGHTFOX.LEARN"), [](Embedis* e) {
lightfoxLearn();
DEBUG_MSG_P(PSTR("+OK\n"));
});
terminalRegisterCommand(F("LIGHTFOX.CLEAR"), [](Embedis* e) {
lightfoxClear();
DEBUG_MSG_P(PSTR("+OK\n"));
});
}
#endif
// -----------------------------------------------------------------------------
// SETUP & LOOP
// -----------------------------------------------------------------------------
void lightfoxSetup() {
#if WEB_SUPPORT
wsOnSendRegister(_lightfoxWebSocketOnSend);
wsOnActionRegister(_lightfoxWebSocketOnAction);
#endif
#if TERMINAL_SUPPORT
_lightfoxInitCommands();
#endif
}
#endif

+ 32
- 1
code/espurna/migrate.ino View File

@ -1267,7 +1267,38 @@ void migrate() {
setSetting("relayType", 0, RELAY_TYPE_NORMAL); setSetting("relayType", 0, RELAY_TYPE_NORMAL);
setSetting("relayGPIO", 1, 15); // Left outlet setSetting("relayGPIO", 1, 15); // Left outlet
setSetting("relayType", 1, RELAY_TYPE_NORMAL); setSetting("relayType", 1, RELAY_TYPE_NORMAL);
#elif defined(DIGOO_NX_SP202)
setSetting("board", 95);
setSetting("ledGPIO", 0, 13);
setSetting("ledLogic", 0, 1);
setSetting("btnGPIO", 0, 0);
setSetting("btnRelay", 0, 0);
setSetting("btnGPIO", 1, 16);
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 0, 15);
setSetting("relayType", 0, RELAY_TYPE_NORMAL);
setSetting("relayGPIO", 1, 14);
setSetting("relayType", 1, RELAY_TYPE_NORMAL);
setSetting("selGPIO", 12);
setSetting("cf1GPIO", 5);
setSetting("cfGPIO", 4);
setSetting("pwrRatioC", 23296);
setSetting("pwrRatioV", 310085);
setSetting("pwrRatioP", 3368471);
setSetting("hlwSelC", LOW);
setSetting("hlwIntM", FALLING);
#elif defined(FOXEL_LIGHTFOX_DUAL)
setSetting("board", 96);
setSetting("btnRelay", 0, 0);
setSetting("btnRelay", 1, 1);
setSetting("btnRelay", 2, 1);
setSetting("btnRelay", 3, 0);
setSetting("relayProvider", RELAY_PROVIDER_DUAL);
setSetting("relays", 2);
#else #else


+ 2
- 0
code/espurna/relay.ino View File

@ -67,6 +67,8 @@ void _relayProviderStatus(unsigned char id, bool status) {
if (_relays[i].current_status) mask = mask + (1 << i); if (_relays[i].current_status) mask = mask + (1 << i);
} }
DEBUG_MSG_P(PSTR("[RELAY] [DUAL] Sending relay mask: %d\n"), mask);
// Send it to F330 // Send it to F330
Serial.flush(); Serial.flush();
Serial.write(0xA0); Serial.write(0xA0);


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

@ -1413,7 +1413,7 @@ void sensorLoop() {
// Get the first relay state // Get the first relay state
#if SENSOR_POWER_CHECK_STATUS #if SENSOR_POWER_CHECK_STATUS
bool relay_off = (relayCount() > 0) && (relayStatus(0) == 0);
bool relay_off = (relayCount() == 1) && (relayStatus(0) == 0);
#endif #endif
// Get readings // Get readings


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


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


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


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


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


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


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


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

@ -170,7 +170,7 @@ void _systemSetupSpecificHardware() {
// These devices use the hardware UART // These devices use the hardware UART
// to communicate to secondary microcontrollers // to communicate to secondary microcontrollers
#if defined(ITEAD_SONOFF_RFBRIDGE) || defined(ITEAD_SONOFF_DUAL) || (RELAY_PROVIDER == RELAY_PROVIDER_STM)
#if defined(ITEAD_SONOFF_RFBRIDGE) || (RELAY_PROVIDER == RELAY_PROVIDER_DUAL) || (RELAY_PROVIDER == RELAY_PROVIDER_STM)
Serial.begin(SERIAL_BAUDRATE); Serial.begin(SERIAL_BAUDRATE);
#endif #endif


+ 2
- 0
code/espurna/web.ino View File

@ -27,6 +27,8 @@ Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
#include "static/index.rfbridge.html.gz.h" #include "static/index.rfbridge.html.gz.h"
#elif WEBUI_IMAGE == WEBUI_IMAGE_RFM69 #elif WEBUI_IMAGE == WEBUI_IMAGE_RFM69
#include "static/index.rfm69.html.gz.h" #include "static/index.rfm69.html.gz.h"
#elif WEBUI_IMAGE == WEBUI_IMAGE_LIGHTFOX
#include "static/index.lightfox.html.gz.h"
#elif WEBUI_IMAGE == WEBUI_IMAGE_THERMOSTAT #elif WEBUI_IMAGE == WEBUI_IMAGE_THERMOSTAT
#include "static/index.thermostat.html.gz.h" #include "static/index.thermostat.html.gz.h"
#elif WEBUI_IMAGE == WEBUI_IMAGE_FULL #elif WEBUI_IMAGE == WEBUI_IMAGE_FULL


+ 6
- 0
code/gulpfile.js View File

@ -115,6 +115,7 @@ var buildWebUI = function(module) {
modules['sensor'] = true; modules['sensor'] = true;
modules['rfbridge'] = true; modules['rfbridge'] = true;
modules['rfm69'] = false; // we will never be adding this except when building RFM69GW modules['rfm69'] = false; // we will never be adding this except when building RFM69GW
modules['lightfox'] = false; // we will never be adding this except when building lightfox
modules['thermostat'] = true; modules['thermostat'] = true;
} else if ('small' !== module) { } else if ('small' !== module) {
modules[module] = true; modules[module] = true;
@ -187,6 +188,10 @@ gulp.task('webui_rfm69', function() {
return buildWebUI('rfm69'); return buildWebUI('rfm69');
}); });
gulp.task('webui_lightfox', function() {
return buildWebUI('lightfox');
});
gulp.task('webui_thermostat', function() { gulp.task('webui_thermostat', function() {
return buildWebUI('thermostat'); return buildWebUI('thermostat');
}); });
@ -202,6 +207,7 @@ gulp.task('webui',
'webui_light', 'webui_light',
'webui_rfbridge', 'webui_rfbridge',
'webui_rfm69', 'webui_rfm69',
'webui_lightfox',
'webui_thermostat', 'webui_thermostat',
'webui_all' 'webui_all'
) )


+ 2
- 0
code/html/custom.css View File

@ -158,6 +158,7 @@ div.state {
.button-reconnect, .button-reconnect,
.button-ha-del, .button-ha-del,
.button-rfb-forget, .button-rfb-forget,
.button-lightfox-clear,
.button-del-network, .button-del-network,
.button-del-mapping, .button-del-mapping,
.button-del-schedule, .button-del-schedule,
@ -176,6 +177,7 @@ div.state {
.button-add-mapping, .button-add-mapping,
.button-upgrade-browse, .button-upgrade-browse,
.button-rfb-learn, .button-rfb-learn,
.button-lightfox-learn,
.button-ha-add, .button-ha-add,
.button-ha-config, .button-ha-config,
.button-settings-backup, .button-settings-backup,


+ 55
- 0
code/html/custom.js View File

@ -1184,6 +1184,48 @@ function addRfbNode() {
} }
<!-- endRemoveIf(!rfbridge)--> <!-- endRemoveIf(!rfbridge)-->
// -----------------------------------------------------------------------------
// LightFox
// -----------------------------------------------------------------------------
<!-- removeIf(!lightfox)-->
function lightfoxLearn() {
sendAction("lightfoxLearn", {});
}
function lightfoxClear() {
sendAction("lightfoxClear", {});
}
function initLightfox(data, relayCount) {
var numNodes = data.length;
var template = $("#lightfoxNodeTemplate").children();
var i, j;
for (i=0; i<numNodes; i++) {
var $line = $(template).clone();
$line.find("label > span").text(data[i]["id"]);
$line.find("select").each(function() {
$(this).attr("name", "btnRelay" + data[i]["id"]);
for (j=0; j < relayCount; j++) {
$(this).append($("<option >").attr("value", j).text("Switch #" + j));
}
$(this).val(data[i]["relay"]);
status = !status;
});
$line.appendTo("#lightfoxNodes");
}
var $panel = $("#panel-lightfox")
$(".button-lightfox-learn").off("click").click(lightfoxLearn);
$(".button-lightfox-clear").off("click").click(lightfoxClear);
}
<!-- endRemoveIf(!lightfox)-->
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Processing // Processing
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -1261,6 +1303,19 @@ function processData(data) {
<!-- endRemoveIf(!rfbridge)--> <!-- endRemoveIf(!rfbridge)-->
// ---------------------------------------------------------------------
// LightFox
// ---------------------------------------------------------------------
<!-- removeIf(!lightfox)-->
if ("lightfoxButtons" === key) {
initLightfox(data["lightfoxButtons"], data["lightfoxRelayCount"]);
return;
}
<!-- endRemoveIf(!rfbridge)-->
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// RFM69 // RFM69
// --------------------------------------------------------------------- // ---------------------------------------------------------------------


+ 46
- 0
code/html/index.html View File

@ -102,6 +102,12 @@
</li> </li>
<!-- endRemoveIf(!thermostat) --> <!-- endRemoveIf(!thermostat) -->
<!-- removeIf(!lightfox) -->
<li class="pure-menu-item module module-lightfox">
<a href="#" class="pure-menu-link" data="panel-lightfox">LIGHTFOX RF</a>
</li>
<!-- endRemoveIf(!lightfox) -->
<li class="pure-menu-item module module-dcz"> <li class="pure-menu-item module module-dcz">
<a href="#" class="pure-menu-link" data="panel-domoticz">DOMOTICZ</a> <a href="#" class="pure-menu-link" data="panel-domoticz">DOMOTICZ</a>
</li> </li>
@ -1601,6 +1607,35 @@
</form> </form>
<!-- endRemoveIf(!rfbridge) --> <!-- endRemoveIf(!rfbridge) -->
<!-- removeIf(!lightfox) -->
<form id="form-lightfox" class="pure-form form-settings">
<div class="panel" id="panel-lightfox">
<div class="header">
<h1>LIGHTFOX RF</h1>
<h2>
LightFox RF configuration<br /><br />
This page allows you to control LightFox RF receiver options.<br /><br />
To learn a new code click <strong>LEARN</strong>, wait for 3 seconds then press a button on the remote, one of the relays will toggle. If no device relay toggles the code has not been properly learnt. Keep trying.<br /><br />
Delete all the codes by clicking the <strong>CLEAR</strong> button and wait for 10 seconds.<br /><br />
You can also specify which RF button controls which relay using controls below.
</h2>
</div>
<div class="page">
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">RF Actions</label>
<div class="pure-u-1-2 pure-u-lg-3-8"><button type="button" class="pure-button button-lightfox-learn pure-u-23-24">Learn</button></div>
<div class="pure-u-1-2 pure-u-lg-3-8"><button type="button" class="pure-button button-lightfox-clear pure-u-1">Clear</button></div>
</div>
<fieldset id="lightfoxNodes"></fieldset>
</div>
</div>
</form>
<!-- endRemoveIf(!lightfox) -->
</div> <!-- content --> </div> <!-- content -->
</div> <!-- layout --> </div> <!-- layout -->
@ -1631,6 +1666,17 @@
</div> </div>
<!-- endRemoveIf(!rfbridge) --> <!-- endRemoveIf(!rfbridge) -->
<!-- removeIf(!lightfox) -->
<div id="lightfoxNodeTemplate" class="template">
<div class="pure-g">
<label class="pure-u-1 pure-u-lg-1-4">Button #<span></span></label>
<select class="pure-u-1 pure-u-lg-3-4" name="btnRelay" action="reboot"></select>
</div>
</div>
<!-- endRemoveIf(!lightfox) -->
<div id="networkTemplate" class="template"> <div id="networkTemplate" class="template">
<div class="pure-g"> <div class="pure-g">


+ 73
- 0
code/platformio.ini View File

@ -400,6 +400,29 @@ extra_scripts = ${common.extra_scripts}
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
[env:foxel-lightfox-dual]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DFOXEL_LIGHTFOX_DUAL
extra_scripts = ${common.extra_scripts}
[env:foxel-lightfox-dual-ota]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DFOXEL_LIGHTFOX_DUAL
upload_speed = ${common.upload_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
extra_scripts = ${common.extra_scripts}
[env:itead-sonoff-basic] [env:itead-sonoff-basic]
platform = ${common.platform} platform = ${common.platform}
framework = ${common.framework} framework = ${common.framework}
@ -2903,6 +2926,32 @@ upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags} upload_flags = ${common.upload_flags}
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
[env:digoo-nx-sp202]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DDIGOO_NX_SP202
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:digoo-nx-sp202-ota]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DDIGOO_NX_SP202
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
extra_scripts = ${common.extra_scripts}
[env:homecube-16a] [env:homecube-16a]
platform = ${common.platform} platform = ${common.platform}
framework = ${common.framework} framework = ${common.framework}
@ -3179,3 +3228,27 @@ upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags} upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed} monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts} extra_scripts = ${common.extra_scripts}
[env:hama-wifi-steckdose-00176533]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DHAMA_WIFI_STECKDOSE_00176533
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:hama-wifi-steckdose-00176533-ota]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DHAMA_WIFI_STECKDOSE_00176533
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

Loading…
Cancel
Save