Browse Source

Integrating fauxmoESP library

fastled
Xose Pérez 8 years ago
parent
commit
52521e6942
9 changed files with 41 additions and 6 deletions
  1. +3
    -0
      .gitmodules
  2. +0
    -1
      code/lib/Embedis
  3. +1
    -0
      code/lib/fauxmoESP
  4. +1
    -1
      code/platformio.custom.ini
  5. +3
    -3
      code/platformio.ini
  6. +1
    -1
      code/platformio.official.ini
  7. +2
    -0
      code/src/defaults.h
  8. +29
    -0
      code/src/fauxmo.ino
  9. +1
    -0
      code/src/main.ino

+ 3
- 0
.gitmodules View File

@ -13,3 +13,6 @@
[submodule "code/lib/HLW8012"] [submodule "code/lib/HLW8012"]
path = code/lib/HLW8012 path = code/lib/HLW8012
url = https://bitbucket.org/xoseperez/hlw8012.git url = https://bitbucket.org/xoseperez/hlw8012.git
[submodule "code/lib/fauxmoESP"]
path = code/lib/fauxmoESP
url = https://bitbucket.org/xoseperez/fauxmoesp.git

+ 0
- 1
code/lib/Embedis View File

@ -1 +0,0 @@
../vendor/embedis/src

+ 1
- 0
code/lib/fauxmoESP

@ -0,0 +1 @@
Subproject commit a04b0f77b59e19698fdeb087aeb60e18a5adf858

+ 1
- 1
code/platformio.custom.ini View File

@ -12,7 +12,7 @@ env_default = node-debug
[common] [common]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
lib_install = 19,31,44,64,305,306,346,408,727
lib_install = 19,31,44,64,305,306,346,359,408,727
extra_script = pio_hooks.py extra_script = pio_hooks.py
[ota] [ota]


+ 3
- 3
code/platformio.ini View File

@ -2,7 +2,7 @@
env_default = node-debug env_default = node-debug
[common] [common]
lib_install = 19,31,44,64,305,306,346,408,727
lib_install = 19,31,44,64,305,306,346,359,408,727
[env:sonoff-debug] [env:sonoff-debug]
platform = espressif8266 platform = espressif8266
@ -81,12 +81,12 @@ upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:node-debug] [env:node-debug]
platform = espressif8266
platform = espressif8266_stage
framework = arduino framework = arduino
lib_install = ${common.lib_install} lib_install = ${common.lib_install}
extra_script = pio_hooks.py extra_script = pio_hooks.py
board = nodemcuv2 board = nodemcuv2
build_flags = -DNODEMCUV2 -DDEBUG_PORT=Serial
build_flags = -DNODEMCUV2 -DDEBUG_PORT=Serial -DDEBUG_FAUXMO=Serial
[env:node-debug-ota] [env:node-debug-ota]
platform = espressif8266 platform = espressif8266


+ 1
- 1
code/platformio.official.ini View File

@ -2,7 +2,7 @@
env_default = node-debug env_default = node-debug
[common] [common]
lib_install = 19,31,44,64,305,306,346,408,727
lib_install = 19,31,44,64,305,306,346,359,408,727
[env:sonoff-debug] [env:sonoff-debug]
platform = espressif8266 platform = espressif8266


+ 2
- 0
code/src/defaults.h View File

@ -151,3 +151,5 @@
#define POW_POWER_TOPIC "/power" #define POW_POWER_TOPIC "/power"
#define POW_UPDATE_INTERVAL 10000 #define POW_UPDATE_INTERVAL 10000
#define POW_REPORT_EVERY 6 #define POW_REPORT_EVERY 6
#define FAUXMO_ENABLED 1

+ 29
- 0
code/src/fauxmo.ino View File

@ -0,0 +1,29 @@
/*
ESPurna
DHT MODULE
Copyright (C) 2016 by Xose Pérez <xose dot perez at gmail dot com>
*/
#include <fauxmoESP.h>
fauxmoESP fauxmo;
// -----------------------------------------------------------------------------
// FAUXMO
// -----------------------------------------------------------------------------
void fauxmoConfigure() {
fauxmo.setDeviceName(getSetting("hostname", HOSTNAME).c_str());
fauxmo.enable(getSetting('fauxmoEnabled', String(FAUXMO_ENABLED)).toInt() == 1);
}
void fauxmoSetup() {
fauxmoConfigure();
fauxmo.onMessage([](const char * state) {
DEBUG_MSG("[FAUXMO] State: %s\n", state);
(state[0] == '1') ? switchRelayOn() : switchRelayOff();
});
}

+ 1
- 0
code/src/main.ino View File

@ -147,6 +147,7 @@ void setup() {
mqttSetup(); mqttSetup();
webSetup(); webSetup();
ntpSetup(); ntpSetup();
fauxmoSetup();
#if ENABLE_NOFUSS #if ENABLE_NOFUSS
nofussSetup(); nofussSetup();


Loading…
Cancel
Save