Browse Source

Major refactor of device flags

fastled
Xose Pérez 7 years ago
parent
commit
eb79642f2e
21 changed files with 793 additions and 468 deletions
  1. +34
    -3
      code/build.sh
  2. +1
    -1
      code/debug.sh
  3. +2
    -2
      code/espurna/button.ino
  4. +1
    -2
      code/espurna/config/all.h
  5. +30
    -22
      code/espurna/config/arduino.h
  6. +0
    -15
      code/espurna/config/debug.h
  7. +57
    -26
      code/espurna/config/general.h
  8. +373
    -141
      code/espurna/config/hardware.h
  9. +1
    -8
      code/espurna/config/sensors.h
  10. +1
    -1
      code/espurna/config/version.h
  11. +5
    -5
      code/espurna/debug.ino
  12. +8
    -6
      code/espurna/espurna.ino
  13. +1
    -1
      code/espurna/fauxmo.ino
  14. +118
    -96
      code/espurna/hardware.ino
  15. +1
    -1
      code/espurna/influxdb.ino
  16. +1
    -1
      code/espurna/mqtt.ino
  17. +1
    -1
      code/espurna/ota.ino
  18. +1
    -1
      code/espurna/rfbridge.ino
  19. +3
    -3
      code/espurna/web.ino
  20. +2
    -2
      code/espurna/wifi.ino
  21. +152
    -130
      code/platformio.ini

+ 34
- 3
code/build.sh View File

@ -1,16 +1,47 @@
#!/bin/bash
environments=$@
# Environments to build
ENVIRONMENTS="espurna-debug sonoff-debug sonoff-dht22-debug sonoff-ds18b20-debug sonoff-pow-debug sonoff-dual-debug sonoff-4ch-debug 1ch-inching-debug electrodragon-debug ecoplug-debug jangoe-debug ai-light-debug led-controller-debug h801-debug sonoff-touch-debug"
ALL_ENVIRONMENTS="
tinkerman-espurna-h
itead-sonoff-basic itead-sonoff-rf itead-sonoff-basic-dht22 itead-sonoff-basic-ds18b20
itead-sonoff-pow itead-sonoff-dual itead-sonoff-4ch itead-sonoff-4ch-pro
itead-sonoff-touch itead-sonoff-b1 itead-sonoff-led itead-sonoff-rfbridge
itead-sonoff-t1-1ch itead-sonoff-t1-2ch itead-sonoff-t1-3ch
itead-slampher itead-s20 itead-1ch-inching itead-motor itead-bnsz01
electrodragon-wifi-iot
workchoice-ecoplug
jangoe-wifi-relay
openenergymonitor-mqtt-relay
jorgegarcia-wifi-relays
aithinker-ai-light
magichome-led-controller
huacanxing-h801
"
if [ $# -eq 0 ]; then
environments=$ALL_ENVIRONMENTS
fi
# Get current version
version=`cat espurna/config/version.h | grep APP_VERSION | awk '{print $3}' | sed 's/"//g'`
echo "--------------------------------------------------------------"
echo "ESPURNA FIRMWARE BUILDER"
echo "Building for version $version"
# Create output folder
mkdir -p firmware
# Recreate web interface
echo "--------------------------------------------------------------"
echo "Building web interface..."
node -S node_modules/gulp/bin/gulp.js || exit
# Build all the required firmwares
for environment in $ENVIRONMENTS; do
platformio run -e $environment
for environment in $environments; do
echo "--------------------------------------------------------------"
echo "Building espurna-$version-$environment.bin..."
platformio run -s -e $environment || exit
mv .pioenvs/$environment/firmware.bin firmware/espurna-$version-$environment.bin
done
echo "--------------------------------------------------------------"

+ 1
- 1
code/debug.sh View File

@ -4,7 +4,7 @@
# CONFIGURATION
# ------------------------------------------------------------------------------
ENVIRONMENT="d1-debug"
ENVIRONMENT="nodemcu-lolin"
ADDR2LINE=$HOME/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-addr2line
DECODER=utils/EspStackTraceDecoder.jar
DECODER_ORIGIN=https://github.com/littleyoda/EspStackTraceDecoder/releases/download/untagged-83b6db3208da17a0f1fd/EspStackTraceDecoder.jar


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

@ -119,7 +119,7 @@ void buttonEvent(unsigned int id, unsigned char event) {
void buttonSetup() {
#ifdef SONOFF_DUAL
#ifdef ITEAD_SONOFF_DUAL
unsigned int actions = buttonStore(BUTTON_MODE_NONE, BUTTON_MODE_TOGGLE, BUTTON_MODE_NONE, BUTTON_MODE_NONE, BUTTON_MODE_NONE);
_buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, 1});
@ -163,7 +163,7 @@ void buttonSetup() {
void buttonLoop() {
#ifdef SONOFF_DUAL
#ifdef ITEAD_SONOFF_DUAL
if (Serial.available() >= 4) {


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

@ -1,10 +1,9 @@
#include "version.h"
#include "arduino.h"
#include "prototypes.h"
#include "general.h"
#include "hardware.h"
#include "general.h"
#include "sensors.h"
#include "debug.h"
/*
If you want to modify the stock configuration but you don't want to touch


+ 30
- 22
code/espurna/config/arduino.h View File

@ -7,30 +7,38 @@
// Hardware
//--------------------------------------------------------------------------------
//#define D1_RELAYSHIELD
//#define NODEMCUV2
//#define SONOFF
//#define SONOFF_TH
//#define SLAMPHER
//#define S20
//#define SONOFF_TOUCH
//#define SONOFF_SV
//#define SONOFF_POW
//#define SONOFF_DUAL
//#define NODEMCU_LOLIN
//#define WEMOS_D1_MINI_RELAYSHIELD
//#define TINKERMAN_ESPURNA_H
//#define ITEAD_SONOFF_BASIC
//#define ITEAD_SONOFF_RF
//#define ITEAD_SONOFF_TH
//#define ITEAD_SONOFF_SV
//#define ITEAD_SLAMPHER
//#define ITEAD_S20
//#define ITEAD_SONOFF_TOUCH
//#define ITEAD_SONOFF_POW
//#define ITEAD_SONOFF_DUAL
//#define ITEAD_SONOFF_4CH
//#define ITEAD_SONOFF_4CH_PRO
//#define ITEAD_1CH_INCHING
//#define ITEAD_MOTOR
//#define SONOFF_4CH
//#define ESP_RELAY_BOARD
//#define ECOPLUG
//#define WIFI_RELAY_NC
//#define WIFI_RELAY_NO
//#define MQTT_RELAY
//#define WIFI_RELAYS_BOARD_KIT
//#define AI_LIGHT
//#define LED_CONTROLLER
//#define H801_LED_CONTROLLER
//#define ESPURNA_H
//#define SONOFF_RFBRIDGE
//#define ITEAD_SONOFF_BNSZ01
//#define ITEAD_SONOFF_RFBRIDGE
//#define ITEAD_SONOFF_B1
//#define ITEAD_SONOFF_LED
//#define ITEAD_SONOFF_T1_1CH
//#define ITEAD_SONOFF_T1_2CH
//#define ITEAD_SONOFF_T1_3CH
//#define ELECTRODRAGON_WIFI_IOT
//#define WORKCHOICE_ECOPLUG
//#define AITHINKER_AI_LIGHT
//#define MAGICHOME_LED_CONTROLLER
//#define HUACANXING_H801
//#define JANGOE_WIFI_RELAY_NC
//#define JANGOE_WIFI_RELAY_NO
//#define JORGEGARCIA_WIFI_RELAYS
//#define OPENENERGYMONITOR_MQTT_RELAY
//--------------------------------------------------------------------------------
// Features (values below are non-default values)


+ 0
- 15
code/espurna/config/debug.h View File

@ -1,15 +0,0 @@
#define DEBUG_MESSAGE_MAX_LENGTH 80
#if defined(SONOFF_DUAL)
#undef DEBUG_PORT
#endif
#if defined(DEBUG_PORT) | defined(DEBUG_UDP_IP)
#define DEBUG_MSG(...) debugSend(__VA_ARGS__)
#define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__)
#endif
#ifndef DEBUG_MSG
#define DEBUG_MSG(...)
#define DEBUG_MSG_P(...)
#endif

+ 57
- 26
code/espurna/config/general.h View File

@ -4,42 +4,68 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// GENERAL
// DEBUG
//------------------------------------------------------------------------------
#define SERIAL_BAUDRATE 115200 // Debugging console boud rate
#define HOSTNAME DEVICE // Hostname
#define UPTIME_OVERFLOW 4294967295 // Uptime overflow value
//--------------------------------------------------------------------------------
// DEBUG
//--------------------------------------------------------------------------------
// Serial debug log
#ifndef ENABLE_SERIAL_DEBUG
#define ENABLE_SERIAL_DEBUG 1 // Enable serial debug log
#endif
#ifndef DEBUG_PORT
#define DEBUG_PORT Serial // Default debugging port
#endif
// Uncomment and configure these lines to enable remote debug via udpDebug
//------------------------------------------------------------------------------
// UDP debug log
// To receive the message son the destination computer use nc:
// nc -ul 8111
//#define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
//#define DEBUG_UDP_PORT 8113
#ifndef ENABLE_UDP_DEBUG
#define ENABLE_UDP_DEBUG 0 // Enable UDP debug log
#endif
#define DEBUG_UDP_IP IPAddress(192, 168, 1, 100)
#define DEBUG_UDP_PORT 8113
//------------------------------------------------------------------------------
// General debug options and macros
#define DEBUG_MESSAGE_MAX_LENGTH 80
#if ENABLE_SERIAL_DEBUG | ENABLE_UDP_DEBUG
#define DEBUG_MSG(...) debugSend(__VA_ARGS__)
#define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__)
#endif
#ifndef DEBUG_MSG
#define DEBUG_MSG(...)
#define DEBUG_MSG_P(...)
#endif
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// TERMINAL
//------------------------------------------------------------------------------
#ifndef ENABLE_TERMINAL
#define ENABLE_TERMINAL 1 // Enable terminal commands
#endif
//------------------------------------------------------------------------------
// EEPROM
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte)
#define EEPROM_ENERGY_COUNT 1 // Address for the energy counter (4 bytes)
#define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte)
#define EEPROM_DATA_END 6 // End of custom EEPROM data block
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// HEARTBEAT
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define HEARTBEAT_INTERVAL 300000 // Interval between heartbeat messages (in ms)
#define UPTIME_OVERFLOW 4294967295 // Uptime overflow value
// Topics that will be reported in heartbeat
#define HEARTBEAT_REPORT_STATUS 1
@ -56,9 +82,9 @@
#define HEARTBEAT_REPORT_VERSION 1
#define HEARTBEAT_REPORT_INTERVAL 0
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// RESET
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define CUSTOM_RESET_HARDWARE 1 // Reset from hardware button
#define CUSTOM_RESET_WEB 2 // Reset from web interface
@ -89,9 +115,9 @@ PROGMEM const char* const custom_reset_string[] = {
custom_reset_nofuss, custom_reset_upgrade, custom_reset_factory
};
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// BUTTON
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms)
#define BUTTON_DBLCLICK_DELAY 500 // Time in ms to wait for a second (or third...) click
@ -115,9 +141,9 @@ PROGMEM const char* const custom_reset_string[] = {
#define BUTTON_MODE_PULSE 6
#define BUTTON_MODE_FACTORY 7
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// RELAY
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define RELAY_MODE_OFF 0
#define RELAY_MODE_ON 1
@ -156,23 +182,28 @@ PROGMEM const char* const custom_reset_string[] = {
// Allowed actual relay changes inside requests flood protection window
#define RELAY_FLOOD_CHANGES 5
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// I18N
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define TMP_CELSIUS 0
#define TMP_FAHRENHEIT 1
#define TMP_UNITS TMP_CELSIUS // Temperature units (TMP_CELSIUS | TMP_FAHRENHEIT)
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// LED
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// All defined LEDs in the board can be managed through MQTT
// except the first one when LED_AUTO is set to 1.
// If LED_AUTO is set to 1 the board will use first defined LED to show wifi status.
// If LED_AUTO is set to 1 the board will a defined LED to show wifi status.
#define LED_AUTO 1
// LED # to use as WIFI status indicator
#ifndef WIFI_LED
#define WIFI_LED 1
#endif
// -----------------------------------------------------------------------------
// WIFI & WEB
// -----------------------------------------------------------------------------


+ 373
- 141
code/espurna/config/hardware.h View File

@ -16,204 +16,329 @@
// RELAY#_LED: LED number that will be bind to the n-th relay (1-based)
// LED#_PIN: GPIO for the n-th LED (1-based, up to 4 LEDs)
// LED#_PIN_INVERSE: LED has inversed logic (lit when pulled down)
// WIFI_LED: LED number that will used for WIFI notifications (1-based, defaults to 1)
//
// Besides, other hardware specific information should be stated here
// -----------------------------------------------------------------------------
// Development boards
// -----------------------------------------------------------------------------
#if defined(NODEMCUV2)
#if defined(NODEMCU_LOLIN)
// Info
#define MANUFACTURER "NODEMCU"
#define DEVICE "LOLIN"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_LNGCLICK BUTTON_MODE_PULSE
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
#define LED1_PIN 2
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
#elif defined(D1_RELAYSHIELD)
#elif defined(WEMOS_D1_MINI_RELAYSHIELD)
// Info
#define MANUFACTURER "WEMOS"
#define DEVICE "D1_MINI"
#define DEVICE "D1_MINI_RELAYSHIELD"
// Buttons
// No buttons on the D1 MINI
// Relays
#define RELAY1_PIN 5
#define RELAY1_PIN_INVERSE 0
#define LED1_PIN 2
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
// -----------------------------------------------------------------------------
// ESPurna
// -----------------------------------------------------------------------------
#elif defined(ESPURNA_H)
#elif defined(TINKERMAN_ESPURNA_H)
// Info
#define MANUFACTURER "TINKERMAN"
#define DEVICE "ESPURNA_H"
#define ENABLE_HLW8012 1
// Buttons
#define BUTTON1_PIN 4
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 1
// LEDs
#define LED1_PIN 5
#define LED1_PIN_INVERSE 0
#define BUTTON1_PIN 4
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define ENABLE_HLW8012 1
// HLW8012
#define HLW8012_SEL_PIN 2
#define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14
// -----------------------------------------------------------------------------
// Itead Studio boards
// -----------------------------------------------------------------------------
#elif defined(SONOFF)
#elif defined(ITEAD_SONOFF_BASIC)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_BASIC"
#define MANUFACTURER "ITEAD"
#define DEVICE "SONOFF"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(ITEAD_SONOFF_RF)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_RF"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_TH)
#elif defined(ITEAD_SONOFF_TH)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_TH"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_SV)
#elif defined(ITEAD_SONOFF_SV)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_SV"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SLAMPHER)
#elif defined(ITEAD_SLAMPHER)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SLAMPHER"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(S20)
#elif defined(ITEAD_S20)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "S20"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_TOUCH)
#elif defined(ITEAD_SONOFF_TOUCH)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_TOUCH"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_POW)
#elif defined(ITEAD_SONOFF_POW)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_POW"
#define ENABLE_HLW8012 1
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 15
#define LED1_PIN_INVERSE 0
#define ENABLE_HLW8012 1
#elif defined(SONOFF_DUAL)
// HLW8012
#define HLW8012_SEL_PIN 5
#define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14
#define MANUFACTURER "ITEAD"
#elif defined(ITEAD_SONOFF_DUAL)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_DUAL"
#define BUTTON3_RELAY 1
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#undef SERIAL_BAUDRATE
#define SERIAL_BAUDRATE 19230
#undef RELAY_PROVIDER
#define RELAY_PROVIDER RELAY_PROVIDER_DUAL
#define DUMMY_RELAY_COUNT 2
#define ENABLE_SERIAL_DEBUG 0
#define ENABLE_TERMINAL 0
#elif defined(SONOFF_4CH)
// Buttons
#define BUTTON3_RELAY 1
#define MANUFACTURER "ITEAD"
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(ITEAD_SONOFF_4CH)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_4CH"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 9
#define BUTTON2_RELAY 2
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_PIN 10
#define BUTTON3_RELAY 3
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON4_PIN 14
#define BUTTON4_RELAY 4
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
#define BUTTON3_RELAY 3
#define BUTTON4_RELAY 4
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 5
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN 4
#define RELAY3_PIN_INVERSE 0
#define RELAY4_PIN 15
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN_INVERSE 0
#define RELAY4_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_4CH_PRO)
#elif defined(ITEAD_SONOFF_4CH_PRO)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_4CH_PRO"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 9
#define BUTTON2_RELAY 2
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_PIN 10
#define BUTTON3_RELAY 3
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON4_PIN 14
#define BUTTON4_RELAY 4
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON4_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
#define BUTTON3_RELAY 3
#define BUTTON4_RELAY 4
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 5
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN 4
#define RELAY3_PIN_INVERSE 0
#define RELAY4_PIN 15
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN_INVERSE 0
#define RELAY4_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
@ -228,131 +353,185 @@
// You can still use the pulse options from the web interface
// without problem.
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "1CH_INCHING"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(ITEAD_MOTOR)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "MOTOR"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(ITEAD_BNSZ01)
#elif defined(ITEAD_BN_SZ01)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "BN-SZ01"
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
// Channels
#define LIGHT_CH1_PIN 12
#define LIGHT_CH1_INVERSE 0
#elif defined(SONOFF_RFBRIDGE)
#elif defined(ITEAD_SONOFF_RFBRIDGE)
#define MANUFACTURER "ITEAD"
#define DEVICE "RFBRIDGE"
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#undef SERIAL_BAUDRATE
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_RFBRIDGE"
#define SERIAL_BAUDRATE 19200
#undef RELAY_PROVIDER
#define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE
#define DUMMY_RELAY_COUNT 6
#define TRACK_RELAY_STATUS 0
#define ENABLE_TERMINAL 0
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#elif defined(SONOFF_B1)
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#define MANUFACTURER "ITEAD"
#elif defined(ITEAD_SONOFF_B1)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_B1"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
#define DUMMY_RELAY_COUNT 1
#define MY9291_DI_PIN 13
#define MY9291_DCKI_PIN 15
#define MY9291_COMMAND MY9291_COMMAND_DEFAULT
#elif defined(SONOFF_LED)
#elif defined(ITEAD_SONOFF_LED)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_LED"
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
// Channels
#define LIGHT_CH1_PIN 12 // Cold white
#define LIGHT_CH2_PIN 14 // Warm white
#define LIGHT_CH1_INVERSE 0
#define LIGHT_CH2_INVERSE 0
#elif defined(SONOFF_T1_1CH)
#elif defined(ITEAD_SONOFF_T1_1CH)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_T1_1CH"
// Buttons
#define BUTTON1_PIN 9
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 5
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_T1_2CH)
#elif defined(ITEAD_SONOFF_T1_2CH)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_T1_2CH"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 10
#define BUTTON2_RELAY 2
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 4
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#elif defined(SONOFF_T1_3CH)
#elif defined(ITEAD_SONOFF_T1_3CH)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_T1_3CH"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 9
#define BUTTON2_RELAY 2
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_PIN 10
#define BUTTON3_RELAY 3
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
#define BUTTON3_RELAY 3
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 5
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN 4
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
@ -360,20 +539,30 @@
// Electrodragon boards
// -----------------------------------------------------------------------------
#elif defined(ESP_RELAY_BOARD)
#elif defined(ELECTRODRAGON_WIFI_IOT)
// Info
#define MANUFACTURER "ELECTRODRAGON"
#define DEVICE "ESP_RELAY_BOARD"
#define DEVICE "WIFI_IOT"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 2
#define BUTTON2_RELAY 2
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 13
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
// LEDs
#define LED1_PIN 16
#define LED1_PIN_INVERSE 0
@ -381,15 +570,22 @@
// WorkChoice ecoPlug
// -----------------------------------------------------------------------------
#elif defined(ECOPLUG)
#elif defined(WORKCHOICE_ECOPLUG)
// Info
#define MANUFACTURER "WORKCHOICE"
#define DEVICE "ECOPLUG"
// Buttons
#define BUTTON1_PIN 13
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 15
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 0
@ -397,14 +593,14 @@
// AI Thinker
// -----------------------------------------------------------------------------
#elif defined(AI_LIGHT)
#elif defined(AITHINKER_AI_LIGHT)
// Info
#define MANUFACTURER "AI_THINKER"
#define DEVICE "AI_LIGHT"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
#define DUMMY_RELAY_COUNT 1
#define MY9291_DI_PIN 13
#define MY9291_DCKI_PIN 15
#define MY9291_COMMAND MY9291_COMMAND_DEFAULT
@ -413,16 +609,20 @@
// LED Controller
// -----------------------------------------------------------------------------
#elif defined(LED_CONTROLLER)
#elif defined(MAGICHOME_LED_CONTROLLER)
// Info
#define MANUFACTURER "MAGIC_HOME"
#define DEVICE "LED_CONTROLLER"
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
// Channels
#define LIGHT_CH1_PIN 14 // RED
#define LIGHT_CH2_PIN 5 // GREEN
#define LIGHT_CH3_PIN 12 // BLUE
@ -437,16 +637,20 @@
// HUACANXING H801
// -----------------------------------------------------------------------------
#elif defined(H801_LED_CONTROLLER)
#elif defined(HUACANXING_H801)
// Info
#define MANUFACTURER "HUACANXING"
#define DEVICE "H801"
#define LED1_PIN 5
#define LED1_PIN_INVERSE 1
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
// LEDs
#define LED1_PIN 5
#define LED1_PIN_INVERSE 1
// Channels
#define LIGHT_CH1_PIN 15 // RED
#define LIGHT_CH2_PIN 13 // GREEN
#define LIGHT_CH3_PIN 12 // BLUE
@ -464,34 +668,50 @@
// https://github.com/JanGoe/esp8266-wifi-relay
// -----------------------------------------------------------------------------
#elif defined(WIFI_RELAY_NC)
#elif defined(JANGOE_WIFI_RELAY_NC)
// Info
#define MANUFACTURER "JAN_GOEDEKE"
#define DEVICE "WIFI_RELAY_NC"
// Buttons
#define BUTTON1_PIN 12
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 13
#define BUTTON2_RELAY 2
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 2
#define RELAY1_PIN_INVERSE 1
#define RELAY2_PIN 14
#define RELAY1_PIN_INVERSE 1
#define RELAY2_PIN_INVERSE 1
#elif defined(WIFI_RELAY_NO)
#elif defined(JANGOE_WIFI_RELAY_NO)
// Info
#define MANUFACTURER "JAN_GOEDEKE"
#define DEVICE "WIFI_RELAY_NO"
// Buttons
#define BUTTON1_PIN 12
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 13
#define BUTTON2_RELAY 2
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 2
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 14
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
// -----------------------------------------------------------------------------
@ -500,28 +720,39 @@
// https://github.com/jorgegarciadev/wifikit
// -----------------------------------------------------------------------------
#elif defined(WIFI_RELAYS_BOARD_KIT)
#elif defined(JORGEGARCIA_WIFI_RELAYS)
// Info
#define MANUFACTURER "JORGE_GARCIA"
#define DEVICE "WIFI_RELAYS_BOARD_KIT"
#define DEVICE "WIFI_RELAYS"
// Relays
#define RELAY1_PIN 0
#define RELAY1_PIN_INVERSE 1
#define RELAY2_PIN 2
#define RELAY1_PIN_INVERSE 1
#define RELAY2_PIN_INVERSE 1
// -----------------------------------------------------------------------------
// WiFi MQTT Relay / Thermostat
// -----------------------------------------------------------------------------
#elif defined(MQTT_RELAY)
#elif defined(OPENENERGYMONITOR_MQTT_RELAY)
// Info
#define MANUFACTURER "OPENENERGYMONITOR"
#define DEVICE "MQTT_RELAY"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
// Relays
#define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 16
#define LED1_PIN_INVERSE 0
@ -654,10 +885,6 @@
#define RELAY4_LED 0
#endif
#ifndef WIFI_LED
#define WIFI_LED 1
#endif
// Needed for ESP8285 boards under Windows using PlatformIO (?)
#ifndef BUTTON_PUSHBUTTON
#define BUTTON_PUSHBUTTON 0
@ -671,6 +898,11 @@
#define TRACK_RELAY_STATUS 1
#endif
// Serial baudrate
#ifndef SERIAL_BAUDRATE
#define SERIAL_BAUDRATE 115200
#endif
// Relay providers
#ifndef RELAY_PROVIDER
#define RELAY_PROVIDER RELAY_PROVIDER_RELAY


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

@ -93,16 +93,9 @@
//--------------------------------------------------------------------------------
// HLW8012 power sensor (Sonoff POW, Espurna H)
// Enable support by passing ENABLE_HLW8012=1 build flag
// Enabled by default when selecting SONOFF_POW hardware
//--------------------------------------------------------------------------------
#ifdef ESPURNA_H
#define HLW8012_SEL_PIN 2
#else
#define HLW8012_SEL_PIN 5
#endif
#define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14
// GPIOs defined in the hardware.h file
#define HLW8012_USE_INTERRUPTS 1
#define HLW8012_SEL_CURRENT HIGH


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

@ -1,4 +1,4 @@
#define APP_NAME "ESPurna"
#define APP_VERSION "1.8.3"
#define APP_VERSION "1.8.4"
#define APP_AUTHOR "xose.perez@gmail.com"
#define APP_WEBSITE "http://tinkerman.cat"

+ 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 <stdarg.h>
#ifdef DEBUG_UDP_IP
#ifdef ENABLE_UDP_DEBUG
#include <WiFiUdp.h>
WiFiUDP udpDebug;
#endif
@ -23,14 +23,14 @@ void debugSend(const char * format, ...) {
int len = ets_vsnprintf(buffer, DEBUG_MESSAGE_MAX_LENGTH, format, args);
va_end(args);
#ifdef DEBUG_PORT
#ifdef ENABLE_SERIAL_DEBUG
DEBUG_PORT.printf(buffer);
if (len > DEBUG_MESSAGE_MAX_LENGTH) {
DEBUG_PORT.printf(" (...)\n");
}
#endif
#ifdef DEBUG_UDP_IP
#ifdef ENABLE_UDP_DEBUG
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT);
udpDebug.write(buffer);
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);
va_end(args);
#ifdef DEBUG_PORT
#ifdef ENABLE_SERIAL_DEBUG
DEBUG_PORT.printf(buffer);
if (len > DEBUG_MESSAGE_MAX_LENGTH) {
DEBUG_PORT.printf(" (...)\n");
}
#endif
#ifdef DEBUG_UDP_IP
#ifdef ENABLE_UDP_DEBUG
udpDebug.beginPacket(DEBUG_UDP_IP, DEBUG_UDP_PORT);
udpDebug.write(buffer);
if (len > DEBUG_MESSAGE_MAX_LENGTH) {


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

@ -215,9 +215,10 @@ void setup() {
mqttSetup();
ntpSetup();
#ifdef SONOFF_RFBRIDGE
#ifdef ITEAD_SONOFF_RFBRIDGE
rfbSetup();
#endif
#if ENABLE_I2C
i2cSetup();
#endif
@ -268,14 +269,15 @@ void loop() {
mqttLoop();
ntpLoop();
#if ENABLE_FAUXMO
fauxmoLoop();
#ifdef ITEAD_SONOFF_RFBRIDGE
rfbLoop();
#endif
#if !defined(SONOFF_DUAL) & !defined(SONOFF_RFBRIDGE)
#if ENABLE_TERMINAL
settingsLoop();
#endif
#ifdef SONOFF_RFBRIDGE
rfbLoop();
#if ENABLE_FAUXMO
fauxmoLoop();
#endif
#if ENABLE_NOFUSS
nofussLoop();


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

@ -23,7 +23,7 @@ void fauxmoConfigure() {
void fauxmoSetup() {
fauxmoConfigure();
unsigned int relays = relayCount();
String hostname = getSetting("hostname", HOSTNAME);
String hostname = getSetting("hostname");
if (relays == 1) {
fauxmo.addDevice(hostname.c_str());
} else {


+ 118
- 96
code/espurna/hardware.ino View File

@ -18,7 +18,8 @@ void hwUpwardsCompatibility() {
unsigned int board = getSetting("board", 0).toInt();
if (board > 0) return;
#ifdef NODEMCUV2
#if defined(NODEMCU_LOLIN)
setSetting("board", 2);
setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 1);
@ -26,17 +27,17 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef D1_RELAYSHIELD
#elif defined(WEMOS_D1_MINI_RELAYSHIELD)
setSetting("board", 3);
setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 1);
setSetting("relayGPIO", 1, 5);
setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF
#elif defined(ITEAD_SONOFF_BASIC)
setSetting("board", 4);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -44,9 +45,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_TH
#elif defined(ITEAD_SONOFF_TH)
setSetting("board", 5);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -54,9 +55,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_SV
#elif defined(ITEAD_SONOFF_SV)
setSetting("board", 6);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -64,9 +65,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_TOUCH
#elif defined(ITEAD_SONOFF_TOUCH)
setSetting("board", 7);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -74,9 +75,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_POW
#elif defined(ITEAD_SONOFF_POW)
setSetting("board", 8);
setSetting("ledGPIO", 1, 15);
setSetting("ledLogic", 1, 1);
@ -84,18 +85,21 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
setSetting("selGPIO", 5);
setSetting("cf1GPIO", 13);
setSetting("cfGPIO", 14);
#elif defined(ITEAD_SONOFF_DUAL)
#ifdef SONOFF_DUAL
setSetting("board", 9);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnRelay", 3, 1);
setSetting("relayProvider", RELAY_PROVIDER_DUAL);
setSetting("relays", 2);
#endif
#ifdef ITEAD_1CH_INCHING
#elif defined(ITEAD_1CH_INCHING)
setSetting("board", 10);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -103,9 +107,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_4CH
#elif defined(ITEAD_SONOFF_4CH)
setSetting("board", 11);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -113,10 +117,10 @@ void hwUpwardsCompatibility() {
setSetting("btnGPIO", 2, 9);
setSetting("btnGPIO", 3, 10);
setSetting("btnGPIO", 4, 14);
setSetting("btnRelay", 1, 2);
setSetting("btnRelay", 2, 3);
setSetting("btnRelay", 3, 4);
setSetting("btnRelay", 4, 0);
setSetting("btnRelay", 1, 1);
setSetting("btnRelay", 2, 2);
setSetting("btnRelay", 3, 3);
setSetting("btnRelay", 4, 4);
setSetting("relayGPIO", 1, 12);
setSetting("relayGPIO", 2, 5);
setSetting("relayGPIO", 3, 4);
@ -125,9 +129,9 @@ void hwUpwardsCompatibility() {
setSetting("relayLogic", 2, 0);
setSetting("relayLogic", 3, 0);
setSetting("relayLogic", 4, 0);
#endif
#ifdef SLAMPHER
#elif defined(ITEAD_SLAMPHER)
setSetting("board", 12);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -135,9 +139,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef S20
#elif defined(ITEAD_S20)
setSetting("board", 13);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -145,9 +149,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef ESP_RELAY_BOARD
#elif defined(ELECTRODRAGON_WIFI_IOT)
setSetting("board", 14);
setSetting("ledGPIO", 1, 16);
setSetting("ledLogic", 1, 0);
@ -159,9 +163,9 @@ void hwUpwardsCompatibility() {
setSetting("relayGPIO", 2, 13);
setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0);
#endif
#ifdef ECOPLUG
#elif defined(WORKCHOICE_ECOPLUG)
setSetting("board", 15);
setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 0);
@ -169,9 +173,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 15);
setSetting("relayLogic", 1, 0);
#endif
#ifdef WIFI_RELAY_NC
#elif defined(JANGOE_WIFI_RELAY_NC)
setSetting("board", 16);
setSetting("btnGPIO", 1, 12);
setSetting("btnGPIO", 2, 13);
@ -181,9 +185,9 @@ void hwUpwardsCompatibility() {
setSetting("relayGPIO", 2, 14);
setSetting("relayLogic", 1, 1);
setSetting("relayLogic", 2, 1);
#endif
#ifdef WIFI_RELAY_NO
#elif defined(JANGOE_WIFI_RELAY_NO)
setSetting("board", 17);
setSetting("btnGPIO", 1, 12);
setSetting("btnGPIO", 2, 13);
@ -193,9 +197,9 @@ void hwUpwardsCompatibility() {
setSetting("relayGPIO", 2, 14);
setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0);
#endif
#ifdef MQTT_RELAY
#elif defined(OPENENERGYMONITOR_MQTT_RELAY)
setSetting("board", 18);
setSetting("ledGPIO", 1, 16);
setSetting("ledLogic", 1, 1);
@ -203,43 +207,43 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef WIFI_RELAYS_BOARD_KIT
#elif defined(JORGEGARCIA_WIFI_RELAYS)
setSetting("board", 19);
setSetting("relayGPIO", 1, 0);
setSetting("relayLogic", 1, 1);
setSetting("relayGPIO", 2, 2);
setSetting("relayLogic", 2, 1);
#endif
#ifdef AI_LIGHT
#elif defined(AITHINKER_AI_LIGHT)
setSetting("board", 20);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_MY9192);
setSetting("myDIGPIO", 13);
setSetting("myDCKIGPIO", 15);
setSetting("relays", 1);
#endif
#ifdef LED_CONTROLLER
#elif defined(MAGICHOME_LED_CONTROLLER)
setSetting("board", 21);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 1);
setSetting("ch1GPIO", 14);
setSetting("ch2GPIO", 5);
setSetting("ch3GPIO", 12);
setSetting("ch4GPIO", 13);
setSetting("ch1Logic", 0);
setSetting("ch2Logic", 0);
setSetting("ch3Logic", 0);
setSetting("ch4Logic", 0);
setSetting("chGPIO", 1, 14);
setSetting("chGPIO", 2, 5);
setSetting("chGPIO", 3, 12);
setSetting("chGPIO", 4, 13);
setSetting("chLogic", 1, 0);
setSetting("chLogic", 2, 0);
setSetting("chLogic", 3, 0);
setSetting("chLogic", 4, 0);
setSetting("relays", 1);
#endif
#ifdef ITEAD_MOTOR
#elif defined(ITEAD_MOTOR)
setSetting("board", 22);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -247,9 +251,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#endif
#ifdef ESPURNA_H
#elif defined(TINKERMAN_ESPURNA_H)
setSetting("board", 23);
setSetting("ledGPIO", 1, 5);
setSetting("ledLogic", 1, 0);
@ -257,48 +261,51 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 1);
#endif
setSetting("selGPIO", 2);
setSetting("cf1GPIO", 13);
setSetting("cfGPIO", 14);
#elif defined(HUACANXING_H801)
#ifdef H801_LED_CONTROLLER
setSetting("board", 24);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 5, 1);
setSetting("ledGPIO", 1, 5);
setSetting("ledLogic", 1, 1);
setSetting("ch1GPIO", 15);
setSetting("ch2GPIO", 13);
setSetting("ch3GPIO", 12);
setSetting("ch4GPIO", 14);
setSetting("ch5GPIO", 4);
setSetting("ch1Logic", 0);
setSetting("ch2Logic", 0);
setSetting("ch3Logic", 0);
setSetting("ch4Logic", 0);
setSetting("ch5Logic", 0);
setSetting("chGPIO", 1, 15);
setSetting("chGPIO", 2, 13);
setSetting("chGPIO", 3, 12);
setSetting("chGPIO", 4, 14);
setSetting("chGPIO", 5, 4);
setSetting("chLogic", 1, 0);
setSetting("chLogic", 2, 0);
setSetting("chLogic", 3, 0);
setSetting("chLogic", 4, 0);
setSetting("chLogic", 5, 0);
setSetting("relays", 1);
#endif
#ifdef ITEAD_BNSZ01
#elif defined(ITEAD_BN_SZ01)
setSetting("board", 25);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 13, 1);
setSetting("ledGPIO", 3, 13);
setSetting("ledLogic", 1, 1);
setSetting("ch1GPIO", 12);
setSetting("ch1Logic", 0);
setSetting("chGPIO", 1, 12);
setSetting("chLogic", 1, 0);
setSetting("relays", 1);
#endif
#ifdef SONOFF_RFBRIDGE
#elif defined(ITEAD_SONOFF_RFBRIDGE)
setSetting("board", 26);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 0);
setSetting("relayProvider", RELAY_PROVIDER_RFBRIDGE);
setSetting("relays", 6);
#endif
#ifdef SONOFF_4CH_PRO
#elif defined(ITEAD_SONOFF_4CH_PRO)
setSetting("board", 27);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -306,10 +313,10 @@ void hwUpwardsCompatibility() {
setSetting("btnGPIO", 2, 9);
setSetting("btnGPIO", 3, 10);
setSetting("btnGPIO", 4, 14);
setSetting("btnRelay", 1, 2);
setSetting("btnRelay", 2, 3);
setSetting("btnRelay", 3, 4);
setSetting("btnRelay", 4, 0);
setSetting("btnRelay", 1, 1);
setSetting("btnRelay", 2, 2);
setSetting("btnRelay", 3, 3);
setSetting("btnRelay", 4, 4);
setSetting("relayGPIO", 1, 12);
setSetting("relayGPIO", 2, 5);
setSetting("relayGPIO", 3, 4);
@ -318,31 +325,31 @@ void hwUpwardsCompatibility() {
setSetting("relayLogic", 2, 0);
setSetting("relayLogic", 3, 0);
setSetting("relayLogic", 4, 0);
#endif
#ifdef SONOFF_B1
#elif defined(ITEAD_SONOFF_B1)
setSetting("board", 28);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_MY9192);
setSetting("myDIGPIO", 12);
setSetting("myDCKIGPIO", 14);
setSetting("relays", 1);
#endif
#ifdef SONOFF_LED
#elif defined(ITEAD_SONOFF_LED)
setSetting("board", 29);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 13, 1);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("ch1GPIO", 12);
setSetting("ch1Logic", 0);
setSetting("ch2GPIO", 14);
setSetting("ch2Logic", 0);
setSetting("chGPIO", 1, 12);
setSetting("chLogic", 1, 0);
setSetting("chGPIO", 2, 14);
setSetting("chLogic", 2, 0);
setSetting("relays", 1);
#endif
#ifdef SONOFF_T1_1CH
#elif defined(ITEAD_SONOFF_T1_1CH)
setSetting("board", 30);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -350,9 +357,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 5);
setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_T1_2CH
#elif defined(ITEAD_SONOFF_T1_2CH)
setSetting("board", 31);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -364,9 +371,9 @@ void hwUpwardsCompatibility() {
setSetting("relayGPIO", 2, 4);
setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0);
#endif
#ifdef SONOFF_T1_3CH
#elif defined(ITEAD_SONOFF_T1_3CH)
setSetting("board", 32);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
@ -382,6 +389,21 @@ void hwUpwardsCompatibility() {
setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0);
setSetting("relayLogic", 3, 0);
#elif defined(ITEAD_SONOFF_RF)
setSetting("board", 33);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 0);
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0);
#else
#error "UNSUPPORTED HARDWARE!"
#endif
saveSettings();


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

@ -28,7 +28,7 @@ template<typename T> bool influxDBSend(const char * topic, T payload) {
}
char data[128];
sprintf(data, "%s,device=%s value=%s", topic, getSetting("hostname", HOSTNAME).c_str(), String(payload).c_str());
sprintf(data, "%s,device=%s value=%s", topic, getSetting("hostname").c_str(), String(payload).c_str());
DEBUG_MSG_P(("[INFLUXDB] Data: %s\n"), data);
char request[256];


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

@ -92,7 +92,7 @@ void _mqttFlush() {
root[element.topic] = element.message;
}
if (ntpConnected()) root[MQTT_TOPIC_TIME] = ntpDateTime();
root[MQTT_TOPIC_HOSTNAME] = getSetting("hostname", HOSTNAME);
root[MQTT_TOPIC_HOSTNAME] = getSetting("hostname");
root[MQTT_TOPIC_IP] = getIP();
String output;


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

@ -14,7 +14,7 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
void otaConfigure() {
ArduinoOTA.setPort(OTA_PORT);
ArduinoOTA.setHostname(getSetting("hostname", HOSTNAME).c_str());
ArduinoOTA.setHostname(getSetting("hostname").c_str());
ArduinoOTA.setPassword(getSetting("adminPass", ADMIN_PASS).c_str());
}


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

@ -6,7 +6,7 @@ Copyright (C) 2017 by Xose Pérez <xose dot perez at gmail dot com>
*/
#ifdef SONOFF_RFBRIDGE
#ifdef ITEAD_SONOFF_RFBRIDGE
// -----------------------------------------------------------------------------
// DEFINITIONS


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

@ -92,7 +92,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
ESP.restart();
}
#ifdef SONOFF_RFBRIDGE
#ifdef ITEAD_SONOFF_RFBRIDGE
if (action.equals("rfblearn") && root.containsKey("data")) {
JsonObject& data = root["data"];
rfbLearn(data["id"], data["status"]);
@ -446,7 +446,7 @@ void _wsStart(uint32_t client_id) {
root["chipid"] = chipid;
root["mac"] = WiFi.macAddress();
root["device"] = String(DEVICE);
root["hostname"] = getSetting("hostname", HOSTNAME);
root["hostname"] = getSetting("hostname");
root["network"] = getNetwork();
root["deviceip"] = getIP();
@ -595,7 +595,7 @@ void _wsStart(uint32_t client_id) {
root["powPowerFactor"] = String(getPowerFactor(), 2);
#endif
#ifdef SONOFF_RFBRIDGE
#ifdef ITEAD_SONOFF_RFBRIDGE
root["rfbVisible"] = 1;
root["rfbCount"] = relayCount();
JsonArray& rfb = root.createNestedArray("rfb");


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

@ -49,8 +49,8 @@ bool createAP() {
void wifiConfigure() {
jw.setHostname(getSetting("hostname", HOSTNAME).c_str());
jw.setSoftAP(getSetting("hostname", HOSTNAME).c_str(), getSetting("adminPass", ADMIN_PASS).c_str());
jw.setHostname(getSetting("hostname").c_str());
jw.setSoftAP(getSetting("hostname").c_str(), getSetting("adminPass", ADMIN_PASS).c_str());
jw.setConnectTimeout(WIFI_CONNECT_TIMEOUT);
jw.setReconnectTimeout(WIFI_RECONNECT_INTERVAL);
jw.setAPMode(AP_MODE);


+ 152
- 130
code/platformio.ini View File

@ -1,10 +1,10 @@
[platformio]
env_default = d1-debug
env_default = nodemcu-lolin
src_dir = espurna
data_dir = espurna/data
[common]
build_flags = -g -DDEBUG_PORT=Serial -DMQTT_MAX_PACKET_SIZE=400
build_flags = -g -DMQTT_MAX_PACKET_SIZE=400
build_flags_512k = ${common.build_flags} -Wl,-Tesp8266.flash.512k0.ld
build_flags_1m = ${common.build_flags} -Wl,-Tesp8266.flash.1m0.ld
lib_deps =
@ -32,384 +32,404 @@ lib_deps =
lib_ignore =
# ------------------------------------------------------------------------------
[env:d1-analog]
platform = espressif8266
framework = arduino
board = d1_mini
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
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:wemos-d1mini-relayshield]
platform = espressif8266
framework = arduino
board = d1_mini
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DD1_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH
build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH
[env:d1-debug-ota]
[env:wemos-d1mini-relayshield-ota]
platform = espressif8266
framework = arduino
board = d1_mini
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DD1_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH
build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:node-debug]
[env:nodemcu-lolin]
platform = espressif8266
framework = arduino
board = nodemcuv2
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DNODEMCUV2 -DDEBUG_FAUXMO=Serial -DNOWSAUTH
build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH
[env:node-debug-ota]
[env:nodemcu-lolin-ota]
platform = espressif8266
framework = arduino
board = nodemcuv2
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DNODEMCUV2 -DDEBUG_FAUXMO=Serial -DNOWSAUTH
build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:espurna-debug]
# ------------------------------------------------------------------------------
[env:tinkerman-espurna-h]
platform = espressif8266
framework = arduino
board = esp12e
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DESPURNA_H
build_flags = ${common.build_flags} -DTINKERMAN_ESPURNA_H
[env:espurna-debug-ota]
[env:tinkerman-espurna-h-ota]
platform = espressif8266
framework = arduino
board = esp12e
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DESPURNA_H
build_flags = ${common.build_flags} -DTINKERMAN_ESPURNA_H
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-debug]
# ------------------------------------------------------------------------------
[env:itead-sonoff-basic]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC
[env:sonoff-debug-ota]
[env:itead-sonoff-basic-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-dht22-debug]
[env:itead-sonoff-basic-dht22]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF -DENABLE_DHT=1
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC -DENABLE_DHT=1
[env:sonoff-ds18b20-debug]
[env:itead-sonoff-basic-ds18b20]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF -DENABLE_DS18B20=1
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_BASIC -DENABLE_DS18B20=1
[env:sonoff-pow-debug]
[env:itead-sonoff-rf]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_POW
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RF
[env:sonoff-pow-debug-ota]
[env:itead-sonoff-rf-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_POW
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RF
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-dual-debug]
[env:itead-sonoff-pow]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_DUAL
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_POW
[env:sonoff-dual-debug-ota]
[env:itead-sonoff-pow-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_DUAL
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_POW
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-4ch-debug]
[env:itead-sonoff-dual]
platform = espressif8266
framework = arduino
board = esp8285
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_4CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_DUAL
[env:sonoff-4ch-debug-ota]
[env:itead-sonoff-dual-ota]
platform = espressif8266
framework = arduino
board = esp8285
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_4CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_DUAL
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-4ch-pro-debug]
[env:itead-sonoff-4ch]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_4CH_PRO
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_4CH
[env:sonoff-4ch-pro-debug-ota]
[env:itead-sonoff-4ch-ota]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_4CH_PRO
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_4CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-touch-debug]
[env:itead-sonoff-4ch-pro]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_TOUCH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_4CH_PRO
[env:sonoff-touch-debug-ota]
[env:itead-sonoff-4ch-pro-ota]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_TOUCH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_4CH_PRO
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:slampher-debug]
[env:itead-sonoff-touch]
platform = espressif8266
framework = arduino
board = esp01_1m
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSLAMPHER
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_TOUCH
[env:slampher-debug-ota]
[env:itead-sonoff-touch-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSLAMPHER
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_TOUCH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:s20-debug]
[env:itead-sonoff-b1]
platform = espressif8266
framework = arduino
board = esp01_1m
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DS20
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_B1
[env:s20-debug-ota]
[env:itead-sonoff-b1-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DS20
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_B1
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-b1-debug]
[env:itead-sonoff-t1-1ch]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_B1
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_1CH
[env:sonoff-b1-debug-ota]
[env:itead-sonoff-t1-1ch-ota]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_B1
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_1CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-t1-1ch-debug]
[env:itead-sonoff-t1-2ch]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_T1_1CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_2CH
[env:sonoff-t1-1ch-debug-ota]
[env:itead-sonoff-t1-2ch-ota]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_T1_1CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_2CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-t1-2ch-debug]
[env:itead-sonoff-t1-3ch]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_T1_2CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_3CH
[env:sonoff-t1-2ch-debug-ota]
[env:itead-sonoff-t1-3ch-ota]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_T1_2CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_T1_3CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-t1-3ch-debug]
[env:itead-sonoff-led]
platform = espressif8266
framework = arduino
board = esp8285
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_T1_3CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_LED
[env:sonoff-t1-3ch-debug-ota]
[env:itead-sonoff-led-ota]
platform = espressif8266
framework = arduino
board = esp8285
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_T1_3CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_LED
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:sonoff-led-debug]
[env:itead-sonoff-rfbridge]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RFBRIDGE
[env:itead-sonoff-rfbridge-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RFBRIDGE
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=Algernon1 --port 8266
# ------------------------------------------------------------------------------
[env:itead-slampher]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_LED
build_flags = ${common.build_flags_1m} -DITEAD_SLAMPHER
[env:sonoff-led-debug-ota]
[env:itead-slampher-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_LED
build_flags = ${common.build_flags_1m} -DITEAD_SLAMPHER
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:rfbridge-debug]
[env:itead-s20]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_RFBRIDGE
build_flags = ${common.build_flags_1m} -DITEAD_S20
[env:rfbridge-debug-ota]
[env:itead-s20-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_RFBRIDGE
build_flags = ${common.build_flags_1m} -DITEAD_S20
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=Algernon1 --port 8266
upload_flags = --auth=fibonacci --port 8266
[env:1ch-inching-debug]
[env:itead-1ch-inching]
platform = espressif8266
framework = arduino
board = esp01_1m
@ -418,7 +438,7 @@ lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_1CH_INCHING
[env:1ch-inching-debug-ota]
[env:itead-1ch-inching-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
@ -430,7 +450,7 @@ upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:motor-debug]
[env:itead-motor]
platform = espressif8266
framework = arduino
board = esp01_1m
@ -439,7 +459,7 @@ lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_MOTOR
[env:motor-debug-ota]
[env:itead-motor-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
@ -451,181 +471,183 @@ upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:electrodragon-debug]
# ------------------------------------------------------------------------------
[env:electrodragon-wifi-iot]
platform = espressif8266
framework = arduino
board = esp12e
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DESP_RELAY_BOARD -DENABLE_DHT=1
build_flags = ${common.build_flags} -DELECTRODRAGON_WIFI_IOT -DENABLE_DHT=1
[env:electrodragon-debug-ota]
[env:electrodragon-wifi-iot-ota]
platform = espressif8266
framework = arduino
board = esp12e
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DESP_RELAY_BOARD -DENABLE_DHT=1
build_flags = ${common.build_flags} -DELECTRODRAGON_WIFI_IOT -DENABLE_DHT=1
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:ecoplug-debug]
[env:workchoice-ecoplug]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DECOPLUG
build_flags = ${common.build_flags_1m} -DWORKCHOICE_ECOPLUG
[env:ecoplug-debug-ota]
[env:workchoice-ecoplug-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DECOPLUG
build_flags = ${common.build_flags_1m} -DWORKCHOICE_ECOPLUG
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:jangoe-debug]
[env:jangoe-wifi-relay]
platform = espressif8266
framework = arduino
board = esp12e
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DWIFI_RELAY_NC
build_flags = ${common.build_flags} -DJANGOE_WIFI_RELAY_NC
[env:jangoe-debug-ota]
[env:jangoe-wifi-relay-ota]
platform = espressif8266
framework = arduino
board = esp12e
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DWIFI_RELAY_NC
build_flags = ${common.build_flags} -DJANGOE_WIFI_RELAY_NC
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:mqtt-relay-debug]
[env:openenergymonitor-mqtt-relay]
platform = espressif8266
framework = arduino
board = esp_wroom_02
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DMQTT_RELAY -DENABLE_DS18B20=1
build_flags = ${common.build_flags} -DOPENENERGYMONITOR_MQTT_RELAY -DENABLE_DS18B20=1
[env:mqtt-relay-debug-ota]
[env:openenergymonitor-mqtt-relay-ota]
platform = espressif8266
framework = arduino
board = esp_wroom_02
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DMQTT_RELAY -DENABLE_DS18B20=1
build_flags = ${common.build_flags} -DOPENENERGYMONITOR_MQTT_RELAY -DENABLE_DS18B20=1
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:wifi-relays-debug]
[env:jorgegarcia-wifi-relays]
platform = espressif8266
framework = arduino
board = esp01_1m
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DWIFI_RELAYS_BOARD_KIT
build_flags = ${common.build_flags_1m} -DJORGEGARCIA_WIFI_RELAYS
[env:wifi-relays-debug-ota]
[env:jorgegarcia-wifi-relays-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DWIFI_RELAYS_BOARD_KIT
build_flags = ${common.build_flags_1m} -DJORGEGARCIA_WIFI_RELAYS
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:ai-light-debug]
[env:aithinker-ai-light]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DAI_LIGHT
build_flags = ${common.build_flags_1m} -DAITHINKER_AI_LIGHT
[env:ai-light-debug-ota]
[env:aithinker-ai-light-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DAI_LIGHT
build_flags = ${common.build_flags_1m} -DAITHINKER_AI_LIGHT
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:led-controller-debug]
[env:magichome-led-controller]
platform = espressif8266
framework = arduino
board = esp01_1m
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DLED_CONTROLLER
build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER
[env:led-controller-debug-ota]
[env:magichome-led-controller-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DLED_CONTROLLER
build_flags = ${common.build_flags_1m} -DMAGICHOME_LED_CONTROLLER
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:h801-debug]
[env:huacanxing-h801]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DH801_LED_CONTROLLER -DDEBUG_PORT=Serial1
build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H801 -DDEBUG_PORT=Serial1
[env:h801-debug-ota]
[env:huacanxing-h801-ota]
platform = espressif8266
framework = arduino
board = esp01_1m
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DH801_LED_CONTROLLER -DDEBUG_PORT=Serial1
build_flags = -g -Wl,-Tesp8266.flash.1m0.ld -DHUACANXING_H801 -DDEBUG_PORT=Serial1
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:bnsz01-debug]
[env:itead-bnsz01]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_BNSZ01
build_flags = ${common.build_flags_1m} -DITEAD_BN_SZ01
[env:bnsz01-debug-ota]
[env:itead-bnsz01-ota]
platform = espressif8266
framework = arduino
board = esp8285
board_flash_mode = dout
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_BNSZ01
build_flags = ${common.build_flags_1m} -DITEAD_BN_SZ01
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266

Loading…
Cancel
Save