Browse Source

Merge branch 'dev' into ssl

Conflicts:
	code/espurna/static/index.html.gz.h
	code/platformio.ini
fastled
Xose Pérez 7 years ago
parent
commit
e722a1e677
37 changed files with 4083 additions and 3347 deletions
  1. +0
    -16
      code/build-all
  2. +0
    -2
      code/build-fs
  3. +49
    -0
      code/build.sh
  4. +1
    -1
      code/debug.sh
  5. +0
    -64
      code/deploy
  6. +1
    -1
      code/espurna/analog.ino
  7. +3
    -3
      code/espurna/button.ino
  8. +1
    -2
      code/espurna/config/all.h
  9. +40
    -28
      code/espurna/config/arduino.h
  10. +0
    -15
      code/espurna/config/debug.h
  11. +71
    -27
      code/espurna/config/general.h
  12. +467
    -100
      code/espurna/config/hardware.h
  13. +1
    -8
      code/espurna/config/sensors.h
  14. +1
    -1
      code/espurna/config/version.h
  15. BIN
      code/espurna/data/index.html.gz
  16. +5
    -5
      code/espurna/debug.ino
  17. +2
    -2
      code/espurna/dht.ino
  18. +69
    -50
      code/espurna/domoticz.ino
  19. +4
    -4
      code/espurna/emon.ino
  20. +57
    -30
      code/espurna/espurna.ino
  21. +1
    -1
      code/espurna/fauxmo.ino
  22. +199
    -75
      code/espurna/hardware.ino
  23. +6
    -6
      code/espurna/hlw8012.ino
  24. +5
    -5
      code/espurna/influxdb.ino
  25. +1
    -1
      code/espurna/led.ino
  26. +8
    -8
      code/espurna/light.ino
  27. +2
    -2
      code/espurna/mqtt.ino
  28. +1
    -1
      code/espurna/ntp.ino
  29. +3
    -3
      code/espurna/ota.ino
  30. +18
    -14
      code/espurna/relay.ino
  31. +6
    -6
      code/espurna/rfbridge.ino
  32. +8
    -1
      code/espurna/settings.ino
  33. +2751
    -2750
      code/espurna/static/index.html.gz.h
  34. +23
    -10
      code/espurna/web.ino
  35. +3
    -3
      code/espurna/wifi.ino
  36. +5
    -0
      code/html/index.html
  37. +271
    -102
      code/platformio.ini

+ 0
- 16
code/build-all View File

@ -1,16 +0,0 @@
#!/bin/bash
# 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"
# Get current version
version=`cat espurna/config/version.h | grep APP_VERSION | awk '{print $3}' | sed 's/"//g'`
# Create output folder
mkdir -p firmware
# Build all the required firmwares
for environment in $ENVIRONMENTS; do
platformio run -e $environment
mv .pioenvs/$environment/firmware.bin firmware/espurna-$version-$environment.bin
done

+ 0
- 2
code/build-fs View File

@ -1,2 +0,0 @@
#!/bin/bash
node node_modules/gulp/bin/gulp.js

+ 49
- 0
code/build.sh View File

@ -0,0 +1,49 @@
#!/bin/bash
environments=$@
# Environments to build
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
wion-50055
"
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 node_modules/gulp/bin/gulp.js || exit
# Build all the required firmwares
echo "--------------------------------------------------------------"
echo "Building firmware images..."
for environment in $environments; do
echo "* espurna-$version-$environment.bin"
platformio run -s -e $environment || exit
mv .pioenvs/$environment/firmware.bin firmware/espurna-$version-$environment.bin
done
echo "--------------------------------------------------------------"

code/debug → code/debug.sh View File

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

+ 0
- 64
code/deploy View File

@ -1,64 +0,0 @@
#!/bin/bash
#
# ESPurna Deploy Script
#
# Copyright (C) 2016 by Xose Pérez <xose dot perez at gmail dot com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
MQTT_HOST=192.168.1.10
function help() {
echo "Syntax: $0 <device> <target>"
devices
}
function devices() {
echo "Defined devices:"
cat platformio.ini | grep 'device]' | sed 's/\[env:/ - /g' | sed 's/\-device]//g'
}
function valid_ip() {
local stat=0
rx='([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
if [[ $ip =~ ^$rx\.$rx\.$rx\.$rx$ ]]; then
stat=1
fi
return $stat
}
# Check arguments
if [ "$#" -ne 2 ]; then
help
exit 1
fi
device=$1-device
target=$2
# Get IP
topic=`cat platformio.ini | grep $device -A 2 | grep "topic" | cut -d' ' -f3`
if [ "$topic" == "" ]; then
echo "Unknown device $device or topic not defined"
devices
exit 2
fi
ip=`mosquitto_sub -t $topic -h $MQTT_HOST -N -C 1`
if valid_ip $ip; then
echo "Could not get a valid IP from MQTT broker"
exit 3
fi
platformio run -vv -e $device --target $target --upload-port $ip

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

@ -21,7 +21,7 @@ void analogSetup() {
pinMode(ANALOG_PIN, INPUT); pinMode(ANALOG_PIN, INPUT);
apiRegister(ANALOG_TOPIC, ANALOG_TOPIC, [](char * buffer, size_t len) { apiRegister(ANALOG_TOPIC, ANALOG_TOPIC, [](char * buffer, size_t len) {
snprintf(buffer, len, "%d", getAnalog());
snprintf_P(buffer, len, PSTR("%d"), getAnalog());
}); });
} }


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

@ -25,7 +25,7 @@ std::vector<button_t> _buttons;
void buttonMQTT(unsigned char id, uint8_t event) { void buttonMQTT(unsigned char id, uint8_t event) {
if (id >= _buttons.size()) return; if (id >= _buttons.size()) return;
char payload[2]; char payload[2];
sprintf(payload, "%d", event);
sprintf_P(payload, PSTR("%d"), event);
mqttSend(MQTT_TOPIC_BUTTON, id, payload); mqttSend(MQTT_TOPIC_BUTTON, id, payload);
} }
#endif #endif
@ -119,7 +119,7 @@ void buttonEvent(unsigned int id, unsigned char event) {
void buttonSetup() { 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); 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}); _buttons.push_back({new DebounceEvent(0, BUTTON_PUSHBUTTON), actions, 1});
@ -163,7 +163,7 @@ void buttonSetup() {
void buttonLoop() { void buttonLoop() {
#ifdef SONOFF_DUAL
#ifdef ITEAD_SONOFF_DUAL
if (Serial.available() >= 4) { if (Serial.available() >= 4) {


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

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


+ 40
- 28
code/espurna/config/arduino.h View File

@ -7,43 +7,55 @@
// Hardware // 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_1CH_INCHING
//#define ITEAD_MOTOR //#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) // Features (values below are non-default values)
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//#define ENABLE_ANALOG 1
//#define ENABLE_DHT 1 //#define ENABLE_DHT 1
//#define ENABLE_DOMOTICZ 0
//#define ENABLE_DS18B20 1 //#define ENABLE_DS18B20 1
//#define ENABLE_EMON 1 //#define ENABLE_EMON 1
//#define ENABLE_HLW8012 1
//#define ENABLE_RF 1
//#define ENABLE_I2C 1
//#define ENABLE_INFLUXDB 0
//#define ENABLE_FAUXMO 0 //#define ENABLE_FAUXMO 0
//#define ENABLE_MDNS 0
//#define ENABLE_NOFUSS 1 //#define ENABLE_NOFUSS 1
//#define ENABLE_DOMOTICZ 0
//#define ENABLE_ANALOG 1
//#define ENABLE_INFLUXDB 0
//#define ENABLE_I2C 1
//#define ENABLE_RF 1
//#define ENABLE_SERIAL_DEBUG 0
//#define ENABLE_SPIFFS 1
//#define ENABLE_TERMINAL 0
//#define ENABLE_UDP_DEBUG 1

+ 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

+ 71
- 27
code/espurna/config/general.h View File

@ -4,42 +4,69 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// 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 #ifndef DEBUG_PORT
#define DEBUG_PORT Serial // Default debugging port #define DEBUG_PORT Serial // Default debugging port
#endif #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: // To receive the message son the destination computer use nc:
// nc -ul 8111 // 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==1) || (ENABLE_UDP_DEBUG==1)
#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 // EEPROM
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define EEPROM_SIZE 4096 // EEPROM size in bytes
#define EEPROM_RELAY_STATUS 0 // Address for the relay status (1 byte) #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_ENERGY_COUNT 1 // Address for the energy counter (4 bytes)
#define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte) #define EEPROM_CUSTOM_RESET 5 // Address for the reset reason (1 byte)
#define EEPROM_DATA_END 6 // End of custom EEPROM data block #define EEPROM_DATA_END 6 // End of custom EEPROM data block
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// HEARTBEAT // HEARTBEAT
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define HEARTBEAT_INTERVAL 300000 // Interval between heartbeat messages (in ms) #define HEARTBEAT_INTERVAL 300000 // Interval between heartbeat messages (in ms)
#define UPTIME_OVERFLOW 4294967295 // Uptime overflow value
// Topics that will be reported in heartbeat // Topics that will be reported in heartbeat
#define HEARTBEAT_REPORT_STATUS 1 #define HEARTBEAT_REPORT_STATUS 1
@ -56,9 +83,9 @@
#define HEARTBEAT_REPORT_VERSION 1 #define HEARTBEAT_REPORT_VERSION 1
#define HEARTBEAT_REPORT_INTERVAL 0 #define HEARTBEAT_REPORT_INTERVAL 0
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// RESET // RESET
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define CUSTOM_RESET_HARDWARE 1 // Reset from hardware button #define CUSTOM_RESET_HARDWARE 1 // Reset from hardware button
#define CUSTOM_RESET_WEB 2 // Reset from web interface #define CUSTOM_RESET_WEB 2 // Reset from web interface
@ -89,9 +116,9 @@ PROGMEM const char* const custom_reset_string[] = {
custom_reset_nofuss, custom_reset_upgrade, custom_reset_factory custom_reset_nofuss, custom_reset_upgrade, custom_reset_factory
}; };
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// BUTTON // BUTTON
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms) #define BUTTON_DEBOUNCE_DELAY 50 // Debounce delay (ms)
#define BUTTON_DBLCLICK_DELAY 500 // Time in ms to wait for a second (or third...) click #define BUTTON_DBLCLICK_DELAY 500 // Time in ms to wait for a second (or third...) click
@ -115,9 +142,9 @@ PROGMEM const char* const custom_reset_string[] = {
#define BUTTON_MODE_PULSE 6 #define BUTTON_MODE_PULSE 6
#define BUTTON_MODE_FACTORY 7 #define BUTTON_MODE_FACTORY 7
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// RELAY // RELAY
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define RELAY_MODE_OFF 0 #define RELAY_MODE_OFF 0
#define RELAY_MODE_ON 1 #define RELAY_MODE_ON 1
@ -156,23 +183,28 @@ PROGMEM const char* const custom_reset_string[] = {
// Allowed actual relay changes inside requests flood protection window // Allowed actual relay changes inside requests flood protection window
#define RELAY_FLOOD_CHANGES 5 #define RELAY_FLOOD_CHANGES 5
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// I18N // I18N
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#define TMP_CELSIUS 0 #define TMP_CELSIUS 0
#define TMP_FAHRENHEIT 1 #define TMP_FAHRENHEIT 1
#define TMP_UNITS TMP_CELSIUS // Temperature units (TMP_CELSIUS | TMP_FAHRENHEIT) #define TMP_UNITS TMP_CELSIUS // Temperature units (TMP_CELSIUS | TMP_FAHRENHEIT)
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// LED // LED
//--------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// All defined LEDs in the board can be managed through MQTT // All defined LEDs in the board can be managed through MQTT
// except the first one when LED_AUTO is set to 1. // 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 #define LED_AUTO 1
// LED # to use as WIFI status indicator
#ifndef WIFI_LED
#define WIFI_LED 1
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// WIFI & WEB // WIFI & WEB
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -205,6 +237,15 @@ PROGMEM const char* const custom_reset_string[] = {
#define EMBEDDED_WEB 1 #define EMBEDDED_WEB 1
#endif #endif
// -----------------------------------------------------------------------------
// SPIFFS
// -----------------------------------------------------------------------------
// Do not add support for SPIFFS by default
#ifndef ENABLE_SPIFFS
#define ENABLE_SPIFFS 0
#endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// OTA & NOFUSS // OTA & NOFUSS
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -290,7 +331,9 @@ PROGMEM const char* const custom_reset_string[] = {
// I2C // I2C
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef ENABLE_I2C
#define ENABLE_I2C 0 // I2C enabled #define ENABLE_I2C 0 // I2C enabled
#endif
#define I2C_SDA_PIN 4 // SDA GPIO #define I2C_SDA_PIN 4 // SDA GPIO
#define I2C_SCL_PIN 14 // SCL GPIO #define I2C_SCL_PIN 14 // SCL GPIO
#define I2C_CLOCK_STRETCH_TIME 200 // BRZO clock stretch time #define I2C_CLOCK_STRETCH_TIME 200 // BRZO clock stretch time
@ -328,8 +371,9 @@ PROGMEM const char* const custom_reset_string[] = {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef ENABLE_DOMOTICZ #ifndef ENABLE_DOMOTICZ
#define ENABLE_DOMOTICZ 1 // Enable Domoticz support by default
#define ENABLE_DOMOTICZ 1 // Build with domoticz support
#endif #endif
#define DOMOTICZ_ENABLED 1 // Enable domoticz by default
#define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic #define DOMOTICZ_IN_TOPIC "domoticz/in" // Default subscription topic
#define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Default publication topic


+ 467
- 100
code/espurna/config/hardware.h View File

@ -16,177 +16,331 @@
// RELAY#_LED: LED number that will be bind to the n-th relay (1-based) // 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: GPIO for the n-th LED (1-based, up to 4 LEDs)
// LED#_PIN_INVERSE: LED has inversed logic (lit when pulled down) // 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 // Development boards
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#if defined(NODEMCUV2)
#if defined(NODEMCU_LOLIN)
// Info
#define MANUFACTURER "NODEMCU" #define MANUFACTURER "NODEMCU"
#define DEVICE "LOLIN" #define DEVICE "LOLIN"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_LNGCLICK BUTTON_MODE_PULSE
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
#define LED1_PIN 2
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
#elif defined(D1_RELAYSHIELD)
#elif defined(WEMOS_D1_MINI_RELAYSHIELD)
// Info
#define MANUFACTURER "WEMOS" #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 5
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
#define LED1_PIN 2
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// ESPurna // ESPurna
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(ESPURNA_H)
#elif defined(TINKERMAN_ESPURNA_H)
// Info
#define MANUFACTURER "TINKERMAN" #define MANUFACTURER "TINKERMAN"
#define DEVICE "ESPURNA_H" #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 12
#define RELAY1_PIN_INVERSE 1 #define RELAY1_PIN_INVERSE 1
// LEDs
#define LED1_PIN 5 #define LED1_PIN 5
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
#define BUTTON1_PIN 4
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
// HLW8012
#define ENABLE_HLW8012 1 #define ENABLE_HLW8012 1
#define HLW8012_SEL_PIN 2
#define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Itead Studio boards // 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_PIN 0
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1 #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_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #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" #define DEVICE "SONOFF_TH"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #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" #define DEVICE "SONOFF_SV"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
#elif defined(SLAMPHER)
#elif defined(ITEAD_SLAMPHER)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SLAMPHER" #define DEVICE "SLAMPHER"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
#elif defined(S20)
#elif defined(ITEAD_S20)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "S20" #define DEVICE "S20"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #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" #define DEVICE "SONOFF_TOUCH"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #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 DEVICE "SONOFF_POW"
#define ENABLE_HLW8012 1
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 15 #define LED1_PIN 15
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
// HLW8012
#define ENABLE_HLW8012 1 #define ENABLE_HLW8012 1
#define HLW8012_SEL_PIN 5
#define HLW8012_CF1_PIN 13
#define HLW8012_CF_PIN 14
#elif defined(SONOFF_DUAL)
#elif defined(ITEAD_SONOFF_DUAL)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_DUAL" #define DEVICE "SONOFF_DUAL"
#define BUTTON3_RELAY 1
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
#undef SERIAL_BAUDRATE
#define SERIAL_BAUDRATE 19230 #define SERIAL_BAUDRATE 19230
#undef RELAY_PROVIDER
#define RELAY_PROVIDER RELAY_PROVIDER_DUAL #define RELAY_PROVIDER RELAY_PROVIDER_DUAL
#define DUMMY_RELAY_COUNT 2 #define DUMMY_RELAY_COUNT 2
#define ENABLE_SERIAL_DEBUG 0
#define ENABLE_TERMINAL 0
#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" #define DEVICE "SONOFF_4CH"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 9 #define BUTTON2_PIN 9
#define BUTTON2_RELAY 2
#define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON3_PIN 10 #define BUTTON3_PIN 10
#define BUTTON3_RELAY 3
#define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON4_PIN 14 #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 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 12
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 5 #define RELAY2_PIN 5
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN 4 #define RELAY3_PIN 4
#define RELAY4_PIN 15
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
#define RELAY3_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(ITEAD_SONOFF_4CH_PRO)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_4CH_PRO"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON2_PIN 9
#define BUTTON3_PIN 10
#define BUTTON4_PIN 14
#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 RELAY2_PIN 5
#define RELAY3_PIN 4
#define RELAY4_PIN 15 #define RELAY4_PIN 15
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0
#define RELAY3_PIN_INVERSE 0
#define RELAY4_PIN_INVERSE 0 #define RELAY4_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
@ -201,73 +355,216 @@
// You can still use the pulse options from the web interface // You can still use the pulse options from the web interface
// without problem. // without problem.
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "1CH_INCHING" #define DEVICE "1CH_INCHING"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
#elif defined(ITEAD_MOTOR) #elif defined(ITEAD_MOTOR)
#define MANUFACTURER "ITEAD"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "MOTOR" #define DEVICE "MOTOR"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1 #define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #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 DEVICE "BN-SZ01"
#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(ITEAD_SONOFF_RFBRIDGE)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_RFBRIDGE"
#define SERIAL_BAUDRATE 19200
#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
// LEDs
#define LED1_PIN 13 #define LED1_PIN 13
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
#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(ITEAD_SONOFF_LED)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_LED"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1 #define DUMMY_RELAY_COUNT 1
#define LIGHT_CH1_PIN 12
// 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_CH1_INVERSE 0
#define LIGHT_CH2_INVERSE 0
#elif defined(ITEAD_SONOFF_T1_1CH)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_T1_1CH"
// Buttons
#define BUTTON1_PIN 9
#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(ITEAD_SONOFF_T1_2CH)
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_T1_2CH"
// Buttons
#define BUTTON1_PIN 0
#define BUTTON2_PIN 10
#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 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_RFBRIDGE)
#elif defined(ITEAD_SONOFF_T1_3CH)
#define MANUFACTURER "ITEAD"
#define DEVICE "RFBRIDGE"
// Info
#define MANUFACTURER "ITEAD_STUDIO"
#define DEVICE "SONOFF_T1_3CH"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON2_PIN 9
#define BUTTON3_PIN 10
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #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 RELAY2_PIN 5
#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 13
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1
#undef SERIAL_BAUDRATE
#define SERIAL_BAUDRATE 19200
#undef RELAY_PROVIDER
#define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE
#define DUMMY_RELAY_COUNT 6
#define TRACK_RELAY_STATUS 0
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Electrodragon boards // Electrodragon boards
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(ESP_RELAY_BOARD)
#elif defined(ELECTRODRAGON_WIFI_IOT)
// Info
#define MANUFACTURER "ELECTRODRAGON" #define MANUFACTURER "ELECTRODRAGON"
#define DEVICE "ESP_RELAY_BOARD"
#define DEVICE "WIFI_IOT"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 2 #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 BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 13 #define RELAY2_PIN 13
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0 #define RELAY2_PIN_INVERSE 0
// LEDs
#define LED1_PIN 16 #define LED1_PIN 16
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
@ -275,15 +572,22 @@
// WorkChoice ecoPlug // WorkChoice ecoPlug
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(ECOPLUG)
#elif defined(WORKCHOICE_ECOPLUG)
// Info
#define MANUFACTURER "WORKCHOICE" #define MANUFACTURER "WORKCHOICE"
#define DEVICE "ECOPLUG" #define DEVICE "ECOPLUG"
// Buttons
#define BUTTON1_PIN 13 #define BUTTON1_PIN 13
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 15 #define RELAY1_PIN 15
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 2 #define LED1_PIN 2
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
@ -291,14 +595,14 @@
// AI Thinker // AI Thinker
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(AI_LIGHT)
#elif defined(AITHINKER_AI_LIGHT)
// Info
#define MANUFACTURER "AI_THINKER" #define MANUFACTURER "AI_THINKER"
#define DEVICE "AI_LIGHT" #define DEVICE "AI_LIGHT"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192 #define LIGHT_PROVIDER LIGHT_PROVIDER_MY9192
#define DUMMY_RELAY_COUNT 1 #define DUMMY_RELAY_COUNT 1
#define MY9291_DI_PIN 13 #define MY9291_DI_PIN 13
#define MY9291_DCKI_PIN 15 #define MY9291_DCKI_PIN 15
#define MY9291_COMMAND MY9291_COMMAND_DEFAULT #define MY9291_COMMAND MY9291_COMMAND_DEFAULT
@ -307,16 +611,20 @@
// LED Controller // LED Controller
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(LED_CONTROLLER)
#elif defined(MAGICHOME_LED_CONTROLLER)
// Info
#define MANUFACTURER "MAGIC_HOME" #define MANUFACTURER "MAGIC_HOME"
#define DEVICE "LED_CONTROLLER" #define DEVICE "LED_CONTROLLER"
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1 #define DUMMY_RELAY_COUNT 1
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 1
// Channels
#define LIGHT_CH1_PIN 14 // RED #define LIGHT_CH1_PIN 14 // RED
#define LIGHT_CH2_PIN 5 // GREEN #define LIGHT_CH2_PIN 5 // GREEN
#define LIGHT_CH3_PIN 12 // BLUE #define LIGHT_CH3_PIN 12 // BLUE
@ -331,16 +639,20 @@
// HUACANXING H801 // HUACANXING H801
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(H801_LED_CONTROLLER)
#elif defined(HUACANXING_H801)
// Info
#define MANUFACTURER "HUACANXING" #define MANUFACTURER "HUACANXING"
#define DEVICE "H801" #define DEVICE "H801"
#define LED1_PIN 5
#define LED1_PIN_INVERSE 1
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1 #define DUMMY_RELAY_COUNT 1
// LEDs
#define LED1_PIN 5
#define LED1_PIN_INVERSE 1
// Channels
#define LIGHT_CH1_PIN 15 // RED #define LIGHT_CH1_PIN 15 // RED
#define LIGHT_CH2_PIN 13 // GREEN #define LIGHT_CH2_PIN 13 // GREEN
#define LIGHT_CH3_PIN 12 // BLUE #define LIGHT_CH3_PIN 12 // BLUE
@ -358,34 +670,50 @@
// https://github.com/JanGoe/esp8266-wifi-relay // https://github.com/JanGoe/esp8266-wifi-relay
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(WIFI_RELAY_NC)
#elif defined(JANGOE_WIFI_RELAY_NC)
// Info
#define MANUFACTURER "JAN_GOEDEKE" #define MANUFACTURER "JAN_GOEDEKE"
#define DEVICE "WIFI_RELAY_NC" #define DEVICE "WIFI_RELAY_NC"
// Buttons
#define BUTTON1_PIN 12 #define BUTTON1_PIN 12
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 13 #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 BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 2 #define RELAY1_PIN 2
#define RELAY1_PIN_INVERSE 1
#define RELAY2_PIN 14 #define RELAY2_PIN 14
#define RELAY1_PIN_INVERSE 1
#define RELAY2_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 MANUFACTURER "JAN_GOEDEKE"
#define DEVICE "WIFI_RELAY_NO" #define DEVICE "WIFI_RELAY_NO"
// Buttons
#define BUTTON1_PIN 12 #define BUTTON1_PIN 12
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON2_PIN 13 #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 BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
#define BUTTON2_RELAY 2
// Relays
#define RELAY1_PIN 2 #define RELAY1_PIN 2
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN 14 #define RELAY2_PIN 14
#define RELAY1_PIN_INVERSE 0
#define RELAY2_PIN_INVERSE 0 #define RELAY2_PIN_INVERSE 0
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -394,31 +722,69 @@
// https://github.com/jorgegarciadev/wifikit // https://github.com/jorgegarciadev/wifikit
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(WIFI_RELAYS_BOARD_KIT)
#elif defined(JORGEGARCIA_WIFI_RELAYS)
// Info
#define MANUFACTURER "JORGE_GARCIA" #define MANUFACTURER "JORGE_GARCIA"
#define DEVICE "WIFI_RELAYS_BOARD_KIT"
#define DEVICE "WIFI_RELAYS"
// Relays
#define RELAY1_PIN 0 #define RELAY1_PIN 0
#define RELAY1_PIN_INVERSE 1
#define RELAY2_PIN 2 #define RELAY2_PIN 2
#define RELAY1_PIN_INVERSE 1
#define RELAY2_PIN_INVERSE 1 #define RELAY2_PIN_INVERSE 1
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// WiFi MQTT Relay / Thermostat // WiFi MQTT Relay / Thermostat
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#elif defined(MQTT_RELAY)
#elif defined(OPENENERGYMONITOR_MQTT_RELAY)
// Info
#define MANUFACTURER "OPENENERGYMONITOR" #define MANUFACTURER "OPENENERGYMONITOR"
#define DEVICE "MQTT_RELAY" #define DEVICE "MQTT_RELAY"
// Buttons
#define BUTTON1_PIN 0 #define BUTTON1_PIN 0
#define BUTTON1_RELAY 1 #define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
// Relays
#define RELAY1_PIN 12 #define RELAY1_PIN 12
#define RELAY1_PIN_INVERSE 0 #define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 16 #define LED1_PIN 16
#define LED1_PIN_INVERSE 0 #define LED1_PIN_INVERSE 0
// -----------------------------------------------------------------------------
// WiOn 50055 Indoor Wi-Fi Wall Outlet & Tap
// https://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_id=114&ipn=icep&toolid=20004&campid=5338044841&mpre=http%3A%2F%2Fwww.ebay.com%2Fitm%2FWiOn-50050-Indoor-Wi-Fi-Outlet-Wireless-Switch-Programmable-Timer-%2F263112281551
// https://rover.ebay.com/rover/1/711-53200-19255-0/1?icep_id=114&ipn=icep&toolid=20004&campid=5338044841&mpre=http%3A%2F%2Fwww.ebay.com%2Fitm%2FWiOn-50055-Indoor-Wi-Fi-Wall-Tap-Monitor-Energy-Usage-Wireless-Smart-Switch-%2F263020837777
// -----------------------------------------------------------------------------
#elif defined(WION_50055)
// Currently untested, does not support energy monitoring
// Info
#define MANUFACTURER "WION"
#define DEVICE "50055"
// Buttons
#define BUTTON1_PIN 13
#define BUTTON1_RELAY 1
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
// Relays
#define RELAY1_PIN 15
#define RELAY1_PIN_INVERSE 0
// LEDs
#define LED1_PIN 2
#define LED1_PIN_INVERSE 0
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Unknown hardware // Unknown hardware
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -548,10 +914,6 @@
#define RELAY4_LED 0 #define RELAY4_LED 0
#endif #endif
#ifndef WIFI_LED
#define WIFI_LED 1
#endif
// Needed for ESP8285 boards under Windows using PlatformIO (?) // Needed for ESP8285 boards under Windows using PlatformIO (?)
#ifndef BUTTON_PUSHBUTTON #ifndef BUTTON_PUSHBUTTON
#define BUTTON_PUSHBUTTON 0 #define BUTTON_PUSHBUTTON 0
@ -565,6 +927,11 @@
#define TRACK_RELAY_STATUS 1 #define TRACK_RELAY_STATUS 1
#endif #endif
// Serial baudrate
#ifndef SERIAL_BAUDRATE
#define SERIAL_BAUDRATE 115200
#endif
// Relay providers // Relay providers
#ifndef RELAY_PROVIDER #ifndef RELAY_PROVIDER
#define RELAY_PROVIDER RELAY_PROVIDER_RELAY #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) // HLW8012 power sensor (Sonoff POW, Espurna H)
// Enable support by passing ENABLE_HLW8012=1 build flag // 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_USE_INTERRUPTS 1
#define HLW8012_SEL_CURRENT HIGH #define HLW8012_SEL_CURRENT HIGH


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

@ -1,4 +1,4 @@
#define APP_NAME "ESPurna" #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_AUTHOR "xose.perez@gmail.com"
#define APP_WEBSITE "http://tinkerman.cat" #define APP_WEBSITE "http://tinkerman.cat"

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


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

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


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

@ -34,7 +34,7 @@ void dhtSetup() {
dtostrf(_dhtTemperature, len-1, 1, buffer); dtostrf(_dhtTemperature, len-1, 1, buffer);
}); });
apiRegister(DHT_HUMIDITY_TOPIC, DHT_HUMIDITY_TOPIC, [](char * buffer, size_t len) { apiRegister(DHT_HUMIDITY_TOPIC, DHT_HUMIDITY_TOPIC, [](char * buffer, size_t len) {
snprintf(buffer, len, "%d", _dhtHumidity);
snprintf_P(buffer, len, PSTR("%d"), _dhtHumidity);
}); });
} }
@ -88,7 +88,7 @@ void dhtLoop() {
status = HUMIDITY_DRY; status = HUMIDITY_DRY;
} }
char buffer[2]; char buffer[2];
sprintf(buffer, "%d", status);
sprintf_P(buffer, PSTR("%d"), status);
domoticzSend("dczHumIdx", humidity, buffer); domoticzSend("dczHumIdx", humidity, buffer);
} }
#endif #endif


+ 69
- 50
code/espurna/domoticz.ino View File

@ -10,78 +10,97 @@ Copyright (C) 2016-2017 by Xose Pérez <xose dot perez at gmail dot com>
#include <ArduinoJson.h> #include <ArduinoJson.h>
template<typename T> void domoticzSend(const char * key, T nvalue, const char * svalue) {
unsigned int idx = getSetting(key).toInt();
if (idx > 0) {
char payload[128];
snprintf(payload, 128, "{\"idx\": %d, \"nvalue\": %s, \"svalue\": \"%s\"}", idx, String(nvalue).c_str(), svalue);
mqttSendRaw(getSetting("dczTopicIn", DOMOTICZ_IN_TOPIC).c_str(), payload);
}
}
bool _dczEnabled = false;
template<typename T> void domoticzSend(const char * key, T nvalue) {
domoticzSend(key, nvalue, "");
}
//------------------------------------------------------------------------------
// Private methods
//------------------------------------------------------------------------------
void relayDomoticzSend(unsigned int relayID) {
char buffer[15];
sprintf(buffer, "dczRelayIdx%d", relayID);
domoticzSend(buffer, relayStatus(relayID) ? "1" : "0");
}
int relayFromIdx(unsigned int idx) {
int _domoticzRelay(unsigned int idx) {
for (int relayID=0; relayID<relayCount(); relayID++) { for (int relayID=0; relayID<relayCount(); relayID++) {
if (relayToIdx(relayID) == idx) {
if (domoticzIdx(relayID) == idx) {
return relayID; return relayID;
} }
} }
return -1; return -1;
} }
int relayToIdx(unsigned int relayID) {
char buffer[15];
sprintf(buffer, "dczRelayIdx%d", relayID);
return getSetting(buffer).toInt();
}
void _domoticzMqtt(unsigned int type, const char * topic, const char * payload) {
void domoticzSetup() {
String dczTopicOut = getSetting("dczTopicOut", DOMOTICZ_OUT_TOPIC);
mqttRegister([](unsigned int type, const char * topic, const char * payload) {
if (type == MQTT_CONNECT_EVENT) {
mqttSubscribeRaw(dczTopicOut.c_str());
}
if (type == MQTT_MESSAGE_EVENT) {
if (!_dczEnabled) return;
String dczTopicOut = getSetting("dczTopicOut", DOMOTICZ_OUT_TOPIC);
// Check topic
if (dczTopicOut.equals(topic)) {
// Parse response
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.parseObject((char *) payload);
if (!root.success()) {
DEBUG_MSG_P(PSTR("[DOMOTICZ] Error parsing data\n"));
return;
}
// IDX
unsigned long idx = root["idx"];
int relayID = _domoticzRelay(idx);
if (relayID >= 0) {
unsigned long value = root["nvalue"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %d for IDX %d\n"), value, idx);
relayStatus(relayID, value == 1);
}
if (type == MQTT_CONNECT_EVENT) {
mqttSubscribeRaw(dczTopicOut.c_str());
} }
if (type == MQTT_MESSAGE_EVENT) {
}
// Check topic
if (dczTopicOut.equals(topic)) {
};
// Parse response
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.parseObject((char *) payload);
if (!root.success()) {
DEBUG_MSG_P(PSTR("[DOMOTICZ] Error parsing data\n"));
return;
}
//------------------------------------------------------------------------------
// Public API
//------------------------------------------------------------------------------
// IDX
unsigned long idx = root["idx"];
int relayID = relayFromIdx(idx);
if (relayID >= 0) {
unsigned long value = root["nvalue"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %d for IDX %d\n"), value, idx);
relayStatus(relayID, value == 1);
}
template<typename T> void domoticzSend(const char * key, T nvalue, const char * svalue) {
if (!_dczEnabled) return;
unsigned int idx = getSetting(key).toInt();
if (idx > 0) {
char payload[128];
snprintf(payload, 128, "{\"idx\": %d, \"nvalue\": %s, \"svalue\": \"%s\"}", idx, String(nvalue).c_str(), svalue);
mqttSendRaw(getSetting("dczTopicIn", DOMOTICZ_IN_TOPIC).c_str(), payload);
}
}
}
template<typename T> void domoticzSend(const char * key, T nvalue) {
domoticzSend(key, nvalue, "");
}
}
void domoticzSendRelay(unsigned int relayID) {
if (!_dczEnabled) return;
char buffer[15];
sprintf_P(buffer, PSTR("dczRelayIdx%d"), relayID);
domoticzSend(buffer, relayStatus(relayID) ? "1" : "0");
}
});
int domoticzIdx(unsigned int relayID) {
char buffer[15];
sprintf_P(buffer, PSTR("dczRelayIdx%d"), relayID);
return getSetting(buffer).toInt();
}
void domoticzConfigure() {
_dczEnabled = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1;
} }
void domoticzSetup() {
domoticzConfigure();
mqttRegister(_domoticzMqtt);
}
#endif #endif

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

@ -113,7 +113,7 @@ void powerMonitorSetup() {
apiRegister(EMON_APOWER_TOPIC, EMON_APOWER_TOPIC, [](char * buffer, size_t len) { apiRegister(EMON_APOWER_TOPIC, EMON_APOWER_TOPIC, [](char * buffer, size_t len) {
if (_emonReady) { if (_emonReady) {
snprintf(buffer, len, "%d", _emonPower);
snprintf_P(buffer, len, PSTR("%d"), _emonPower);
} else { } else {
buffer = NULL; buffer = NULL;
} }
@ -191,11 +191,11 @@ void powerMonitorLoop() {
#if ENABLE_DOMOTICZ #if ENABLE_DOMOTICZ
{ {
char buffer[20]; char buffer[20];
snprintf(buffer, 20, "%d;%s", _emonPower, String(energy_delta, 3).c_str());
snprintf_P(buffer, 20, PSTR("%d;%s"), _emonPower, String(energy_delta, 3).c_str());
domoticzSend("dczPowIdx", 0, buffer); domoticzSend("dczPowIdx", 0, buffer);
snprintf(buffer, 20, "%s", String(energy_delta, 3).c_str());
snprintf_P(buffer, 20, PSTR("%s"), String(energy_delta, 3).c_str());
domoticzSend("dczEnergyIdx", 0, buffer); domoticzSend("dczEnergyIdx", 0, buffer);
snprintf(buffer, 20, "%s", String(_emonCurrent, 3).c_str());
snprintf_P(buffer, 20, PSTR("%s"), String(_emonCurrent, 3).c_str());
domoticzSend("dczCurrentIdx", 0, buffer); domoticzSend("dczCurrentIdx", 0, buffer);
} }
#endif #endif


+ 57
- 30
code/espurna/espurna.ino View File

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
String getIdentifier() { String getIdentifier() {
char identifier[20]; char identifier[20];
sprintf(identifier, "%s_%06X", DEVICE, ESP.getChipId());
sprintf_P(identifier, PSTR("%s_%06X"), DEVICE, ESP.getChipId());
return String(identifier); return String(identifier);
} }
@ -119,9 +119,9 @@ unsigned char customReset() {
void hardwareSetup() { void hardwareSetup() {
EEPROM.begin(4096);
EEPROM.begin(EEPROM_SIZE);
#ifdef DEBUG_PORT
#if ENABLE_SERIAL_DEBUG
DEBUG_PORT.begin(SERIAL_BAUDRATE); DEBUG_PORT.begin(SERIAL_BAUDRATE);
if (customReset() == CUSTOM_RESET_HARDWARE) { if (customReset() == CUSTOM_RESET_HARDWARE) {
DEBUG_PORT.setDebugOutput(true); DEBUG_PORT.setDebugOutput(true);
@ -130,7 +130,7 @@ void hardwareSetup() {
Serial.begin(SERIAL_BAUDRATE); Serial.begin(SERIAL_BAUDRATE);
#endif #endif
#if not EMBEDDED_WEB
#if ENABLE_SPIFFS
SPIFFS.begin(); SPIFFS.begin();
#endif #endif
@ -151,13 +151,56 @@ void hardwareLoop() {
// BOOTING // BOOTING
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
unsigned int sectors(size_t size) {
return (int) (size + SPI_FLASH_SEC_SIZE - 1) / SPI_FLASH_SEC_SIZE;
}
void welcome() { void welcome() {
DEBUG_MSG_P(PSTR("\n\n"));
DEBUG_MSG_P(PSTR("%s %s\n"), (char *) APP_NAME, (char *) APP_VERSION); DEBUG_MSG_P(PSTR("%s %s\n"), (char *) APP_NAME, (char *) APP_VERSION);
DEBUG_MSG_P(PSTR("%s\n%s\n\n"), (char *) APP_AUTHOR, (char *) APP_WEBSITE); DEBUG_MSG_P(PSTR("%s\n%s\n\n"), (char *) APP_AUTHOR, (char *) APP_WEBSITE);
DEBUG_MSG_P(PSTR("ChipID: %06X\n"), ESP.getChipId());
DEBUG_MSG_P(PSTR("CPU chip ID: 0x%06X\n"), ESP.getChipId());
DEBUG_MSG_P(PSTR("CPU frequency: %d MHz\n"), ESP.getCpuFreqMHz()); DEBUG_MSG_P(PSTR("CPU frequency: %d MHz\n"), ESP.getCpuFreqMHz());
DEBUG_MSG_P(PSTR("SDK version: %s\n"), ESP.getSdkVersion());
DEBUG_MSG_P(PSTR("Core version: %s\n"), ESP.getCoreVersion().c_str());
DEBUG_MSG_P(PSTR("\n"));
FlashMode_t mode = ESP.getFlashChipMode();
DEBUG_MSG_P(PSTR("Flash chip ID: 0x%06X\n"), ESP.getFlashChipId());
DEBUG_MSG_P(PSTR("Flash speed: %u Hz\n"), ESP.getFlashChipSpeed());
DEBUG_MSG_P(PSTR("Flash mode: %s\n"), mode == FM_QIO ? "QIO" : mode == FM_QOUT ? "QOUT" : mode == FM_DIO ? "DIO" : mode == FM_DOUT ? "DOUT" : "UNKNOWN");
DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("Flash sector size: %8u bytes\n"), SPI_FLASH_SEC_SIZE);
DEBUG_MSG_P(PSTR("Flash size (SDK): %8u bytes\n"), ESP.getFlashChipSize());
DEBUG_MSG_P(PSTR("Flash size (CHIP): %8u bytes / %4d sectors\n"), ESP.getFlashChipRealSize(), sectors(ESP.getFlashChipRealSize()));
DEBUG_MSG_P(PSTR("Firmware size: %8u bytes / %4d sectors\n"), ESP.getSketchSize(), sectors(ESP.getSketchSize()));
DEBUG_MSG_P(PSTR("OTA size: %8u bytes / %4d sectors\n"), ESP.getFreeSketchSpace(), sectors(ESP.getFreeSketchSpace()));
#if ENABLE_SPIFFS
FSInfo fs_info;
bool fs = SPIFFS.info(fs_info);
if (fs) {
DEBUG_MSG_P(PSTR("SPIFFS size: %8u bytes / %4d sectors\n"), fs_info.totalBytes, sectors(fs_info.totalBytes));
}
#else
DEBUG_MSG_P(PSTR("SPIFFS size: %8u bytes / %4d sectors\n"), 0, 0);
#endif
DEBUG_MSG_P(PSTR("EEPROM size: %8u bytes / %4d sectors\n"), settingsMaxSize(), sectors(settingsMaxSize()));
DEBUG_MSG_P(PSTR("Empty space: %8u bytes / 4 sectors\n"), 4 * SPI_FLASH_SEC_SIZE);
#if ENABLE_SPIFFS
if (fs) {
DEBUG_MSG_P(PSTR("\n"));
DEBUG_MSG_P(PSTR("SPIFFS total size: %8u bytes\n"), fs_info.totalBytes);
DEBUG_MSG_P(PSTR(" used size: %8u bytes\n"), fs_info.usedBytes);
DEBUG_MSG_P(PSTR(" block size: %8u bytes\n"), fs_info.blockSize);
DEBUG_MSG_P(PSTR(" page size: %8u bytes\n"), fs_info.pageSize);
DEBUG_MSG_P(PSTR(" max files: %8u\n"), fs_info.maxOpenFiles);
DEBUG_MSG_P(PSTR(" max length: %8u\n"), fs_info.maxPathLength);
}
#endif
DEBUG_MSG_P(PSTR("\n"));
unsigned char custom_reset = customReset(); unsigned char custom_reset = customReset();
if (custom_reset > 0) { if (custom_reset > 0) {
char buffer[32]; char buffer[32];
@ -166,24 +209,7 @@ void welcome() {
} else { } else {
DEBUG_MSG_P(PSTR("Last reset reason: %s\n"), (char *) ESP.getResetReason().c_str()); DEBUG_MSG_P(PSTR("Last reset reason: %s\n"), (char *) ESP.getResetReason().c_str());
} }
DEBUG_MSG_P(PSTR("Memory size (SDK): %d bytes\n"), ESP.getFlashChipSize());
DEBUG_MSG_P(PSTR("Memory size (CHIP): %d bytes\n"), ESP.getFlashChipRealSize());
DEBUG_MSG_P(PSTR("Free heap: %d bytes\n"), ESP.getFreeHeap());
DEBUG_MSG_P(PSTR("Firmware size: %d bytes\n"), ESP.getSketchSize());
DEBUG_MSG_P(PSTR("Free firmware space: %d bytes\n"), ESP.getFreeSketchSpace());
#if not EMBEDDED_WEB
FSInfo fs_info;
if (SPIFFS.info(fs_info)) {
DEBUG_MSG_P(PSTR("File system total size: %d bytes\n"), fs_info.totalBytes);
DEBUG_MSG_P(PSTR(" used size : %d bytes\n"), fs_info.usedBytes);
DEBUG_MSG_P(PSTR(" block size: %d bytes\n"), fs_info.blockSize);
DEBUG_MSG_P(PSTR(" page size : %d bytes\n"), fs_info.pageSize);
DEBUG_MSG_P(PSTR(" max files : %d\n"), fs_info.maxOpenFiles);
DEBUG_MSG_P(PSTR(" max length: %d\n"), fs_info.maxPathLength);
}
#endif
DEBUG_MSG_P(PSTR("Free heap: %u bytes\n"), ESP.getFreeHeap());
DEBUG_MSG_P(PSTR("\n\n")); DEBUG_MSG_P(PSTR("\n\n"));
@ -215,9 +241,10 @@ void setup() {
mqttSetup(); mqttSetup();
ntpSetup(); ntpSetup();
#ifdef SONOFF_RFBRIDGE
#ifdef ITEAD_SONOFF_RFBRIDGE
rfbSetup(); rfbSetup();
#endif #endif
#if ENABLE_I2C #if ENABLE_I2C
i2cSetup(); i2cSetup();
#endif #endif
@ -254,7 +281,6 @@ void setup() {
// Prepare configuration for version 2.0 // Prepare configuration for version 2.0
hwUpwardsCompatibility(); hwUpwardsCompatibility();
//settingsDump();
} }
@ -269,14 +295,15 @@ void loop() {
mqttLoop(); mqttLoop();
ntpLoop(); ntpLoop();
#if ENABLE_FAUXMO
fauxmoLoop();
#ifdef ITEAD_SONOFF_RFBRIDGE
rfbLoop();
#endif #endif
#if !defined(SONOFF_DUAL) & !defined(SONOFF_RFBRIDGE)
#if ENABLE_TERMINAL
settingsLoop(); settingsLoop();
#endif #endif
#ifdef SONOFF_RFBRIDGE
rfbLoop();
#if ENABLE_FAUXMO
fauxmoLoop();
#endif #endif
#if ENABLE_NOFUSS #if ENABLE_NOFUSS
nofussLoop(); nofussLoop();


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

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


+ 199
- 75
code/espurna/hardware.ino View File

@ -18,7 +18,8 @@ void hwUpwardsCompatibility() {
unsigned int board = getSetting("board", 0).toInt(); unsigned int board = getSetting("board", 0).toInt();
if (board > 0) return; if (board > 0) return;
#ifdef NODEMCUV2
#if defined(NODEMCU_LOLIN)
setSetting("board", 2); setSetting("board", 2);
setSetting("ledGPIO", 1, 2); setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -26,17 +27,17 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef D1_RELAYSHIELD
#elif defined(WEMOS_D1_MINI_RELAYSHIELD)
setSetting("board", 3); setSetting("board", 3);
setSetting("ledGPIO", 1, 2); setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
setSetting("relayGPIO", 1, 5); setSetting("relayGPIO", 1, 5);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF
#elif defined(ITEAD_SONOFF_BASIC)
setSetting("board", 4); setSetting("board", 4);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -44,9 +45,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_TH
#elif defined(ITEAD_SONOFF_TH)
setSetting("board", 5); setSetting("board", 5);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -54,9 +55,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_SV
#elif defined(ITEAD_SONOFF_SV)
setSetting("board", 6); setSetting("board", 6);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -64,9 +65,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_TOUCH
#elif defined(ITEAD_SONOFF_TOUCH)
setSetting("board", 7); setSetting("board", 7);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -74,9 +75,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_POW
#elif defined(ITEAD_SONOFF_POW)
setSetting("board", 8); setSetting("board", 8);
setSetting("ledGPIO", 1, 15); setSetting("ledGPIO", 1, 15);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -84,17 +85,21 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); 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("board", 9);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
setSetting("btnRelay", 3, 1); setSetting("btnRelay", 3, 1);
setSetting("relayProvider", RELAY_PROVIDER_DUAL); setSetting("relayProvider", RELAY_PROVIDER_DUAL);
#endif
setSetting("relays", 2);
#elif defined(ITEAD_1CH_INCHING)
#ifdef ITEAD_1CH_INCHING
setSetting("board", 10); setSetting("board", 10);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -102,9 +107,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef SONOFF_4CH
#elif defined(ITEAD_SONOFF_4CH)
setSetting("board", 11); setSetting("board", 11);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -112,10 +117,10 @@ void hwUpwardsCompatibility() {
setSetting("btnGPIO", 2, 9); setSetting("btnGPIO", 2, 9);
setSetting("btnGPIO", 3, 10); setSetting("btnGPIO", 3, 10);
setSetting("btnGPIO", 4, 14); 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", 1, 12);
setSetting("relayGPIO", 2, 5); setSetting("relayGPIO", 2, 5);
setSetting("relayGPIO", 3, 4); setSetting("relayGPIO", 3, 4);
@ -124,9 +129,9 @@ void hwUpwardsCompatibility() {
setSetting("relayLogic", 2, 0); setSetting("relayLogic", 2, 0);
setSetting("relayLogic", 3, 0); setSetting("relayLogic", 3, 0);
setSetting("relayLogic", 4, 0); setSetting("relayLogic", 4, 0);
#endif
#ifdef SLAMPHER
#elif defined(ITEAD_SLAMPHER)
setSetting("board", 12); setSetting("board", 12);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -134,9 +139,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef S20
#elif defined(ITEAD_S20)
setSetting("board", 13); setSetting("board", 13);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -144,9 +149,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef ESP_RELAY_BOARD
#elif defined(ELECTRODRAGON_WIFI_IOT)
setSetting("board", 14); setSetting("board", 14);
setSetting("ledGPIO", 1, 16); setSetting("ledGPIO", 1, 16);
setSetting("ledLogic", 1, 0); setSetting("ledLogic", 1, 0);
@ -158,9 +163,9 @@ void hwUpwardsCompatibility() {
setSetting("relayGPIO", 2, 13); setSetting("relayGPIO", 2, 13);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0); setSetting("relayLogic", 2, 0);
#endif
#ifdef ECOPLUG
#elif defined(WORKCHOICE_ECOPLUG)
setSetting("board", 15); setSetting("board", 15);
setSetting("ledGPIO", 1, 2); setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 0); setSetting("ledLogic", 1, 0);
@ -168,9 +173,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 15); setSetting("relayGPIO", 1, 15);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef WIFI_RELAY_NC
#elif defined(JANGOE_WIFI_RELAY_NC)
setSetting("board", 16); setSetting("board", 16);
setSetting("btnGPIO", 1, 12); setSetting("btnGPIO", 1, 12);
setSetting("btnGPIO", 2, 13); setSetting("btnGPIO", 2, 13);
@ -180,9 +185,9 @@ void hwUpwardsCompatibility() {
setSetting("relayGPIO", 2, 14); setSetting("relayGPIO", 2, 14);
setSetting("relayLogic", 1, 1); setSetting("relayLogic", 1, 1);
setSetting("relayLogic", 2, 1); setSetting("relayLogic", 2, 1);
#endif
#ifdef WIFI_RELAY_NO
#elif defined(JANGOE_WIFI_RELAY_NO)
setSetting("board", 17); setSetting("board", 17);
setSetting("btnGPIO", 1, 12); setSetting("btnGPIO", 1, 12);
setSetting("btnGPIO", 2, 13); setSetting("btnGPIO", 2, 13);
@ -192,9 +197,9 @@ void hwUpwardsCompatibility() {
setSetting("relayGPIO", 2, 14); setSetting("relayGPIO", 2, 14);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0); setSetting("relayLogic", 2, 0);
#endif
#ifdef MQTT_RELAY
#elif defined(OPENENERGYMONITOR_MQTT_RELAY)
setSetting("board", 18); setSetting("board", 18);
setSetting("ledGPIO", 1, 16); setSetting("ledGPIO", 1, 16);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -202,41 +207,43 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef WIFI_RELAYS_BOARD_KIT
#elif defined(JORGEGARCIA_WIFI_RELAYS)
setSetting("board", 19); setSetting("board", 19);
setSetting("relayGPIO", 1, 0); setSetting("relayGPIO", 1, 0);
setSetting("relayLogic", 1, 1); setSetting("relayLogic", 1, 1);
setSetting("relayGPIO", 2, 2); setSetting("relayGPIO", 2, 2);
setSetting("relayLogic", 2, 1); setSetting("relayLogic", 2, 1);
#endif
#ifdef AI_LIGHT
#elif defined(AITHINKER_AI_LIGHT)
setSetting("board", 20); setSetting("board", 20);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT); setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_MY9192); setSetting("lightProvider", LIGHT_PROVIDER_MY9192);
setSetting("myDIGPIO", 13); setSetting("myDIGPIO", 13);
setSetting("myDCKIGPIO", 15); setSetting("myDCKIGPIO", 15);
#endif
setSetting("relays", 1);
#elif defined(MAGICHOME_LED_CONTROLLER)
#ifdef LED_CONTROLLER
setSetting("board", 21); setSetting("board", 21);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT); setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 1, 2); setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 1); 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);
#endif
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);
#elif defined(ITEAD_MOTOR)
#ifdef ITEAD_MOTOR
setSetting("board", 22); setSetting("board", 22);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
@ -244,9 +251,9 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 0); setSetting("relayLogic", 1, 0);
#endif
#ifdef ESPURNA_H
#elif defined(TINKERMAN_ESPURNA_H)
setSetting("board", 23); setSetting("board", 23);
setSetting("ledGPIO", 1, 5); setSetting("ledGPIO", 1, 5);
setSetting("ledLogic", 1, 0); setSetting("ledLogic", 1, 0);
@ -254,42 +261,159 @@ void hwUpwardsCompatibility() {
setSetting("btnRelay", 1, 1); setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 12); setSetting("relayGPIO", 1, 12);
setSetting("relayLogic", 1, 1); 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("board", 24);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT); setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 5, 1);
setSetting("ledGPIO", 1, 5);
setSetting("ledLogic", 1, 1); 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);
#endif
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);
#elif defined(ITEAD_BN_SZ01)
#ifdef ITEAD_BNSZ01
setSetting("board", 25); setSetting("board", 25);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT); setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 13, 1);
setSetting("ledGPIO", 3, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
setSetting("ch1GPIO", 12);
setSetting("ch1Logic", 0);
#endif
setSetting("chGPIO", 1, 12);
setSetting("chLogic", 1, 0);
setSetting("relays", 1);
#elif defined(ITEAD_SONOFF_RFBRIDGE)
#ifdef SONOFF_RFBRIDGE
setSetting("board", 26); setSetting("board", 26);
setSetting("ledGPIO", 1, 13); setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1); setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 0); setSetting("btnGPIO", 1, 0);
setSetting("relayProvider", RELAY_PROVIDER_RFBRIDGE); setSetting("relayProvider", RELAY_PROVIDER_RFBRIDGE);
setSetting("relays", 6);
#elif defined(ITEAD_SONOFF_4CH_PRO)
setSetting("board", 27);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 0);
setSetting("btnGPIO", 2, 9);
setSetting("btnGPIO", 3, 10);
setSetting("btnGPIO", 4, 14);
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);
setSetting("relayGPIO", 4, 15);
setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0);
setSetting("relayLogic", 3, 0);
setSetting("relayLogic", 4, 0);
#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);
#elif defined(ITEAD_SONOFF_LED)
setSetting("board", 29);
setSetting("relayProvider", RELAY_PROVIDER_LIGHT);
setSetting("lightProvider", LIGHT_PROVIDER_DIMMER);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("chGPIO", 1, 12);
setSetting("chLogic", 1, 0);
setSetting("chGPIO", 2, 14);
setSetting("chLogic", 2, 0);
setSetting("relays", 1);
#elif defined(ITEAD_SONOFF_T1_1CH)
setSetting("board", 30);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 9);
setSetting("btnRelay", 1, 1);
setSetting("relayGPIO", 1, 5);
setSetting("relayLogic", 1, 0);
#elif defined(ITEAD_SONOFF_T1_2CH)
setSetting("board", 31);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 0);
setSetting("btnGPIO", 2, 10);
setSetting("btnRelay", 1, 1);
setSetting("btnRelay", 2, 2);
setSetting("relayGPIO", 1, 12);
setSetting("relayGPIO", 2, 4);
setSetting("relayLogic", 1, 0);
setSetting("relayLogic", 2, 0);
#elif defined(ITEAD_SONOFF_T1_3CH)
setSetting("board", 32);
setSetting("ledGPIO", 1, 13);
setSetting("ledLogic", 1, 1);
setSetting("btnGPIO", 1, 0);
setSetting("btnGPIO", 2, 9);
setSetting("btnGPIO", 3, 10);
setSetting("btnRelay", 1, 1);
setSetting("btnRelay", 2, 2);
setSetting("btnRelay", 3, 3);
setSetting("relayGPIO", 1, 12);
setSetting("relayGPIO", 2, 5);
setSetting("relayGPIO", 3, 4);
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);
#elif defined(WION_50055)
setSetting("board", 34);
setSetting("ledGPIO", 1, 2);
setSetting("ledLogic", 1, 0);
setSetting("btnGPIO", 1, 13);
setSetting("btnRelay", 1,1);
setSetting("relayGPIO", 1, 15);
setSetting("relayLogic", 1, 0);
#else
#error "UNSUPPORTED HARDWARE!"
#endif #endif
saveSettings(); saveSettings();


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

@ -160,7 +160,7 @@ void hlw8012Setup() {
// API definitions // API definitions
apiRegister(HLW8012_POWER_TOPIC, HLW8012_POWER_TOPIC, [](char * buffer, size_t len) { apiRegister(HLW8012_POWER_TOPIC, HLW8012_POWER_TOPIC, [](char * buffer, size_t len) {
if (_hlwReady) { if (_hlwReady) {
snprintf(buffer, len, "%d", _hlwPower);
snprintf_P(buffer, len, PSTR("%d"), _hlwPower);
} else { } else {
buffer = NULL; buffer = NULL;
} }
@ -174,7 +174,7 @@ void hlw8012Setup() {
}); });
apiRegister(HLW8012_VOLTAGE_TOPIC, HLW8012_VOLTAGE_TOPIC, [](char * buffer, size_t len) { apiRegister(HLW8012_VOLTAGE_TOPIC, HLW8012_VOLTAGE_TOPIC, [](char * buffer, size_t len) {
if (_hlwReady) { if (_hlwReady) {
snprintf(buffer, len, "%d", _hlwVoltage);
snprintf_P(buffer, len, PSTR("%d"), _hlwVoltage);
} else { } else {
buffer = NULL; buffer = NULL;
} }
@ -295,13 +295,13 @@ void hlw8012Loop() {
#if ENABLE_DOMOTICZ #if ENABLE_DOMOTICZ
{ {
char buffer[20]; char buffer[20];
snprintf(buffer, 20, "%d;%s", _hlwPower, String(energy_delta, 3).c_str());
snprintf_P(buffer, 20, PSTR("%d;%s"), _hlwPower, String(energy_delta, 3).c_str());
domoticzSend("dczPowIdx", 0, buffer); domoticzSend("dczPowIdx", 0, buffer);
snprintf(buffer, 20, "%s", String(energy_delta, 3).c_str());
snprintf_P(buffer, 20, PSTR("%s"), String(energy_delta, 3).c_str());
domoticzSend("dczEnergyIdx", 0, buffer); domoticzSend("dczEnergyIdx", 0, buffer);
snprintf(buffer, 20, "%d", _hlwVoltage);
snprintf_P(buffer, 20, PSTR("%d"), _hlwVoltage);
domoticzSend("dczVoltIdx", 0, buffer); domoticzSend("dczVoltIdx", 0, buffer);
snprintf(buffer, 20, "%s", String(_hlwCurrent).c_str());
snprintf_P(buffer, 20, PSTR("%s"), String(_hlwCurrent).c_str());
domoticzSend("dczCurrentIdx", 0, buffer); domoticzSend("dczCurrentIdx", 0, buffer);
} }
#endif #endif


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

@ -19,17 +19,17 @@ template<typename T> bool influxDBSend(const char * topic, T payload) {
if (!influxDBEnabled) return true; if (!influxDBEnabled) return true;
if (!wifiConnected() || (WiFi.getMode() != WIFI_STA)) return true; if (!wifiConnected() || (WiFi.getMode() != WIFI_STA)) return true;
DEBUG_MSG_P(("[INFLUXDB] Sending\n"));
DEBUG_MSG("[INFLUXDB] Sending\n");
_influxClient.setTimeout(2); _influxClient.setTimeout(2);
if (!_influxClient.connect(getSetting("idbHost").c_str(), getSetting("idbPort", INFLUXDB_PORT).toInt())) { if (!_influxClient.connect(getSetting("idbHost").c_str(), getSetting("idbPort", INFLUXDB_PORT).toInt())) {
DEBUG_MSG_P(("[INFLUXDB] Connection failed\n"));
DEBUG_MSG("[INFLUXDB] Connection failed\n");
return false; return false;
} }
char data[128]; char data[128];
sprintf(data, "%s,device=%s value=%s", topic, getSetting("hostname", HOSTNAME).c_str(), String(payload).c_str());
DEBUG_MSG_P(("[INFLUXDB] Data: %s\n"), data);
sprintf(data, "%s,device=%s value=%s", topic, getSetting("hostname").c_str(), String(payload).c_str());
DEBUG_MSG("[INFLUXDB] Data: %s\n", data);
char request[256]; char request[256];
sprintf(request, "POST /write?db=%s&u=%s&p=%s HTTP/1.1\r\nHost: %s:%d\r\nContent-Length: %d\r\n\r\n%s", sprintf(request, "POST /write?db=%s&u=%s&p=%s HTTP/1.1\r\nHost: %s:%d\r\nContent-Length: %d\r\n\r\n%s",
@ -45,7 +45,7 @@ template<typename T> bool influxDBSend(const char * topic, T payload) {
} }
_influxClient.stop(); _influxClient.stop();
DEBUG_MSG_P(("[INFLUXDB] Sent failed\n"));
DEBUG_MSG("[INFLUXDB] Sent failed\n");
while (_influxClient.connected()) delay(0); while (_influxClient.connected()) delay(0);
return false; return false;


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

@ -64,7 +64,7 @@ void ledMQTTCallback(unsigned int type, const char * topic, const char * payload
if (type == MQTT_CONNECT_EVENT) { if (type == MQTT_CONNECT_EVENT) {
char buffer[strlen(MQTT_TOPIC_LED) + 3]; char buffer[strlen(MQTT_TOPIC_LED) + 3];
sprintf(buffer, "%s/+", MQTT_TOPIC_LED);
sprintf_P(buffer, PSTR("%s/+"), MQTT_TOPIC_LED);
mqttSubscribe(buffer); mqttSubscribe(buffer);
} }


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

@ -133,7 +133,7 @@ void _toRGB(char * rgb, size_t len, bool applyBrightness) {
value <<= 8; value <<= 8;
value += _channels[2].value * b; value += _channels[2].value * b;
snprintf(rgb, len, "#%06X", value);
snprintf_P(rgb, len, PSTR("#%06X"), value);
} }
@ -293,7 +293,7 @@ void _lightMQTTCallback(unsigned int type, const char * topic, const char * payl
} }
char buffer[strlen(MQTT_TOPIC_CHANNEL) + 3]; char buffer[strlen(MQTT_TOPIC_CHANNEL) + 3];
sprintf(buffer, "%s/+", MQTT_TOPIC_CHANNEL);
sprintf_P(buffer, PSTR("%s/+"), MQTT_TOPIC_CHANNEL);
mqttSubscribe(buffer); mqttSubscribe(buffer);
} }
@ -370,14 +370,14 @@ void lightMQTT() {
mqttSend(MQTT_TOPIC_COLOR, buffer); mqttSend(MQTT_TOPIC_COLOR, buffer);
// Brightness // Brightness
sprintf(buffer, "%d", _brightness);
sprintf_P(buffer, PSTR("%d"), _brightness);
mqttSend(MQTT_TOPIC_BRIGHTNESS, buffer); mqttSend(MQTT_TOPIC_BRIGHTNESS, buffer);
} }
// Channels // Channels
for (unsigned int i=0; i < _channels.size(); i++) { for (unsigned int i=0; i < _channels.size(); i++) {
sprintf(buffer, "%d", _channels[i].value);
sprintf_P(buffer, PSTR("%d"), _channels[i].value);
mqttSend(MQTT_TOPIC_CHANNEL, i, buffer); mqttSend(MQTT_TOPIC_CHANNEL, i, buffer);
} }
@ -476,7 +476,7 @@ void _lightAPISetup() {
apiRegister(MQTT_TOPIC_BRIGHTNESS, MQTT_TOPIC_BRIGHTNESS, apiRegister(MQTT_TOPIC_BRIGHTNESS, MQTT_TOPIC_BRIGHTNESS,
[](char * buffer, size_t len) { [](char * buffer, size_t len) {
snprintf(buffer, len, "%d", _brightness);
snprintf_P(buffer, len, PSTR("%d"), _brightness);
}, },
[](const char * payload) { [](const char * payload) {
lightBrightness(atoi(payload)); lightBrightness(atoi(payload));
@ -505,14 +505,14 @@ void _lightAPISetup() {
for (unsigned int id=0; id<lightChannels(); id++) { for (unsigned int id=0; id<lightChannels(); id++) {
char url[15]; char url[15];
sprintf(url, "%s/%d", MQTT_TOPIC_CHANNEL, id);
sprintf_P(url, PSTR("%s/%d"), MQTT_TOPIC_CHANNEL, id);
char key[10]; char key[10];
sprintf(key, "%s%d", MQTT_TOPIC_CHANNEL, id);
sprintf_P(key, PSTR("%s%d"), MQTT_TOPIC_CHANNEL, id);
apiRegister(url, key, apiRegister(url, key,
[id](char * buffer, size_t len) { [id](char * buffer, size_t len) {
snprintf(buffer, len, "%d", lightChannel(id));
snprintf_P(buffer, len, PSTR("%d"), lightChannel(id));
}, },
[id](const char * payload) { [id](const char * payload) {
lightChannel(id, atoi(payload)); lightChannel(id, atoi(payload));


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

@ -92,7 +92,7 @@ void _mqttFlush() {
root[element.topic] = element.message; root[element.topic] = element.message;
} }
if (ntpConnected()) root[MQTT_TOPIC_TIME] = ntpDateTime(); 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(); root[MQTT_TOPIC_IP] = getIP();
String output; String output;
@ -129,7 +129,7 @@ void mqttSend(const char * topic, const char * message) {
void mqttSend(const char * topic, unsigned int index, const char * message, bool force) { void mqttSend(const char * topic, unsigned int index, const char * message, bool force) {
char buffer[strlen(topic)+5]; char buffer[strlen(topic)+5];
sprintf(buffer, "%s/%d", topic, index);
sprintf_P(buffer, PSTR("%s/%d"), topic, index);
mqttSend(buffer, message, force); mqttSend(buffer, message, force);
} }


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

@ -39,7 +39,7 @@ String ntpDateTime() {
int month = value.substring(12, 14).toInt(); int month = value.substring(12, 14).toInt();
int year = value.substring(15, 19).toInt(); int year = value.substring(15, 19).toInt();
char buffer[20]; char buffer[20];
sprintf(buffer, "%04d/%02d/%02dT%02d:%02d:%02d", year, month, day, hour, minute, second);
sprintf_P(buffer, PSTR("%04d/%02d/%02dT%02d:%02d:%02d"), year, month, day, hour, minute, second);
return String(buffer); return String(buffer);
} }


+ 3
- 3
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() { void otaConfigure() {
ArduinoOTA.setPort(OTA_PORT); 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()); ArduinoOTA.setPassword(getSetting("adminPass", ADMIN_PASS).c_str());
} }
@ -39,8 +39,8 @@ void otaSetup() {
}); });
ArduinoOTA.onError([](ota_error_t error) { ArduinoOTA.onError([](ota_error_t error) {
#if DEBUG_PORT
DEBUG_MSG_P(PSTR("\n[OTA] Error[%u]: "), error);
#if ENABLE_SERIAL_DEBUG || ENABLE_UDP_DEBUG
DEBUG_MSG_P(PSTR("\n[OTA] Error #%u: "), error);
if (error == OTA_AUTH_ERROR) DEBUG_MSG_P(PSTR("Auth Failed\n")); if (error == OTA_AUTH_ERROR) DEBUG_MSG_P(PSTR("Auth Failed\n"));
else if (error == OTA_BEGIN_ERROR) DEBUG_MSG_P(PSTR("Begin Failed\n")); else if (error == OTA_BEGIN_ERROR) DEBUG_MSG_P(PSTR("Begin Failed\n"));
else if (error == OTA_CONNECT_ERROR) DEBUG_MSG_P(PSTR("Connect Failed\n")); else if (error == OTA_CONNECT_ERROR) DEBUG_MSG_P(PSTR("Connect Failed\n"));


+ 18
- 14
code/espurna/relay.ino View File

@ -123,15 +123,15 @@ void relayPulseMode(unsigned int value, bool report) {
/* /*
if (report) { if (report) {
char topic[strlen(MQTT_TOPIC_RELAY) + 10]; char topic[strlen(MQTT_TOPIC_RELAY) + 10];
sprintf(topic, "%s/pulse", MQTT_TOPIC_RELAY);
sprintf_P(topic, PSTR("%s/pulse"), MQTT_TOPIC_RELAY);
char value[2]; char value[2];
sprintf(value, "%d", value);
sprintf_P(value, PSTR("%d"), value);
mqttSend(topic, value); mqttSend(topic, value);
} }
*/ */
char message[20]; char message[20];
sprintf(message, "{\"relayPulseMode\": %d}", value);
sprintf_P(message, PSTR("{\"relayPulseMode\": %d}"), value);
wsSend(message); wsSend(message);
} }
@ -153,7 +153,15 @@ bool relayStatus(unsigned char id, bool status, bool report) {
bool changed = false; bool changed = false;
#if TRACK_RELAY_STATUS #if TRACK_RELAY_STATUS
if (relayStatus(id) != status) {
if (relayStatus(id) == status) {
if (_relays[id].scheduled) {
DEBUG_MSG_P(PSTR("[RELAY] #%d scheduled change cancelled\n"), id);
_relays[id].scheduled = false;
_relays[id].scheduledStatus = status;
_relays[id].scheduledReport = false;
changed = true;
}
} else {
#endif #endif
unsigned int currentTime = millis(); unsigned int currentTime = millis();
@ -291,14 +299,14 @@ void relaySetupAPI() {
for (unsigned int relayID=0; relayID<relayCount(); relayID++) { for (unsigned int relayID=0; relayID<relayCount(); relayID++) {
char url[15]; char url[15];
sprintf(url, "%s/%d", MQTT_TOPIC_RELAY, relayID);
sprintf_P(url, PSTR("%s/%d"), MQTT_TOPIC_RELAY, relayID);
char key[10]; char key[10];
sprintf(key, "%s%d", MQTT_TOPIC_RELAY, relayID);
sprintf_P(key, PSTR("%s%d"), MQTT_TOPIC_RELAY, relayID);
apiRegister(url, key, apiRegister(url, key,
[relayID](char * buffer, size_t len) { [relayID](char * buffer, size_t len) {
snprintf(buffer, len, "%d", relayStatus(relayID) ? 1 : 0);
snprintf_P(buffer, len, PSTR("%d"), relayStatus(relayID) ? 1 : 0);
}, },
[relayID](const char * payload) { [relayID](const char * payload) {
unsigned int value = payload[0] - '0'; unsigned int value = payload[0] - '0';
@ -354,7 +362,7 @@ void relayMQTTCallback(unsigned int type, const char * topic, const char * paylo
#endif #endif
char buffer[strlen(MQTT_TOPIC_RELAY) + 3]; char buffer[strlen(MQTT_TOPIC_RELAY) + 3];
sprintf(buffer, "%s/+", MQTT_TOPIC_RELAY);
sprintf_P(buffer, PSTR("%s/+"), MQTT_TOPIC_RELAY);
mqttSubscribe(buffer); mqttSubscribe(buffer);
} }
@ -404,7 +412,7 @@ void relaySetupMQTT() {
void relayInfluxDB(unsigned char id) { void relayInfluxDB(unsigned char id) {
if (id >= _relays.size()) return; if (id >= _relays.size()) return;
char buffer[10]; char buffer[10];
sprintf(buffer, "%s,id=%d", MQTT_TOPIC_RELAY, id);
sprintf_P(buffer, PSTR("%s,id=%d"), MQTT_TOPIC_RELAY, id);
influxDBSend(buffer, relayStatus(id) ? "1" : "0"); influxDBSend(buffer, relayStatus(id) ? "1" : "0");
} }
#endif #endif
@ -467,11 +475,7 @@ void relayLoop(void) {
unsigned int currentTime = millis(); unsigned int currentTime = millis();
bool status = _relays[id].scheduledStatus; bool status = _relays[id].scheduledStatus;
#if TRACK_RELAY_STATUS
if (relayStatus(id) != status && currentTime >= _relays[id].scheduledStatusTime) {
#else
if (_relays[id].scheduled && currentTime >= _relays[id].scheduledStatusTime) { if (_relays[id].scheduled && currentTime >= _relays[id].scheduledStatusTime) {
#endif
DEBUG_MSG_P(PSTR("[RELAY] #%d set to %s\n"), id, status ? "ON" : "OFF"); DEBUG_MSG_P(PSTR("[RELAY] #%d set to %s\n"), id, status ? "ON" : "OFF");
@ -496,7 +500,7 @@ void relayLoop(void) {
} }
#if ENABLE_DOMOTICZ #if ENABLE_DOMOTICZ
relayDomoticzSend(id);
domoticzSendRelay(id);
#endif #endif
#if ENABLE_INFLUXDB #if ENABLE_INFLUXDB


+ 6
- 6
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 // DEFINITIONS
@ -201,7 +201,7 @@ From a byte array to an hexa char array ("A220EE...", double the size)
*/ */
bool _rfbToChar(byte * in, char * out) { bool _rfbToChar(byte * in, char * out) {
for (unsigned char p = 0; p<RF_MESSAGE_SIZE; p++) { for (unsigned char p = 0; p<RF_MESSAGE_SIZE; p++) {
sprintf(&out[p*2], "%02X", in[p]);
sprintf_P(&out[p*2], PSTR("%02X"), in[p]);
} }
return true; return true;
} }
@ -210,7 +210,7 @@ void _rfbMqttCallback(unsigned int type, const char * topic, const char * payloa
if (type == MQTT_CONNECT_EVENT) { if (type == MQTT_CONNECT_EVENT) {
char buffer[strlen(MQTT_TOPIC_RFLEARN) + 3]; char buffer[strlen(MQTT_TOPIC_RFLEARN) + 3];
sprintf(buffer, "%s/+", MQTT_TOPIC_RFLEARN);
sprintf_P(buffer, PSTR("%s/+"), MQTT_TOPIC_RFLEARN);
mqttSubscribe(buffer); mqttSubscribe(buffer);
mqttSubscribe(MQTT_TOPIC_RFOUT); mqttSubscribe(MQTT_TOPIC_RFOUT);
} }
@ -251,13 +251,13 @@ void _rfbMqttCallback(unsigned int type, const char * topic, const char * payloa
void rfbStore(unsigned char id, bool status, const char * code) { void rfbStore(unsigned char id, bool status, const char * code) {
DEBUG_MSG_P(PSTR("[RFBRIDGE] Storing %d-%s => '%s'\n"), id, status ? "ON" : "OFF", code); DEBUG_MSG_P(PSTR("[RFBRIDGE] Storing %d-%s => '%s'\n"), id, status ? "ON" : "OFF", code);
char key[8] = {0}; char key[8] = {0};
sprintf(key, "rfb%d%s", id, status ? "on" : "off");
sprintf_P(key, PSTR("rfb%d%s"), id, status ? "on" : "off");
setSetting(key, code); setSetting(key, code);
} }
String rfbRetrieve(unsigned char id, bool status) { String rfbRetrieve(unsigned char id, bool status) {
char key[8] = {0}; char key[8] = {0};
sprintf(key, "rfb%d%s", id, status ? "on" : "off");
sprintf_P(key, PSTR("rfb%d%s"), id, status ? "on" : "off");
return getSetting(key); return getSetting(key);
} }
@ -282,7 +282,7 @@ void rfbLearn(unsigned char id, bool status) {
void rfbForget(unsigned char id, bool status) { void rfbForget(unsigned char id, bool status) {
char key[8] = {0}; char key[8] = {0};
sprintf(key, "rfb%d%s", id, status ? "on" : "off");
sprintf_P(key, PSTR("rfb%d%s"), id, status ? "on" : "off");
delSetting(key); delSetting(key);
// Websocket update // Websocket update


+ 8
- 1
code/espurna/settings.ino View File

@ -23,6 +23,13 @@ Embedis embedis(Serial);
// Settings // Settings
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
size_t settingsMaxSize() {
size_t size = EEPROM_SIZE;
if (size > SPI_FLASH_SEC_SIZE) size = SPI_FLASH_SEC_SIZE;
size = (size + 3) & (~3);
return size;
}
unsigned long settingsSize() { unsigned long settingsSize() {
unsigned pos = SPI_FLASH_SEC_SIZE - 1; unsigned pos = SPI_FLASH_SEC_SIZE - 1;
while (size_t len = EEPROM.read(pos)) { while (size_t len = EEPROM.read(pos)) {
@ -299,5 +306,5 @@ void saveSettings() {
#if not AUTO_SAVE #if not AUTO_SAVE
EEPROM.commit(); EEPROM.commit();
#endif #endif
settingsDump();
//settingsDump();
} }

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


+ 23
- 10
code/espurna/web.ino View File

@ -97,7 +97,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
ESP.restart(); ESP.restart();
} }
#ifdef SONOFF_RFBRIDGE
#ifdef ITEAD_SONOFF_RFBRIDGE
if (action.equals("rfblearn") && root.containsKey("data")) { if (action.equals("rfblearn") && root.containsKey("data")) {
JsonObject& data = root["data"]; JsonObject& data = root["data"];
rfbLearn(data["id"], data["status"]); rfbLearn(data["id"], data["status"]);
@ -215,6 +215,9 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
#if ENABLE_FAUXMO #if ENABLE_FAUXMO
bool fauxmoEnabled = false; bool fauxmoEnabled = false;
#endif #endif
#if ENABLE_DOMOTICZ
bool dczEnabled = false;
#endif
unsigned int network = 0; unsigned int network = 0;
unsigned int dczRelayIdx = 0; unsigned int dczRelayIdx = 0;
String adminPass; String adminPass;
@ -309,6 +312,9 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
#if ENABLE_FAUXMO #if ENABLE_FAUXMO
if (key == "fauxmoEnabled") { fauxmoEnabled = true; continue; } if (key == "fauxmoEnabled") { fauxmoEnabled = true; continue; }
#endif #endif
#if ENABLE_DOMOTICZ
if (key == "dczEnabled") { dczEnabled = true; continue; }
#endif
if (key == "ssid") { if (key == "ssid") {
key = key + String(network); key = key + String(network);
@ -355,6 +361,9 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
#if ENABLE_FAUXMO #if ENABLE_FAUXMO
setBoolSetting("fauxmoEnabled", fauxmoEnabled, FAUXMO_ENABLED); setBoolSetting("fauxmoEnabled", fauxmoEnabled, FAUXMO_ENABLED);
#endif #endif
#if ENABLE_DOMOTICZ
setBoolSetting("dczEnabled", dczEnabled, DOMOTICZ_ENABLED);
#endif
// Clean wifi networks // Clean wifi networks
int i = 0; int i = 0;
@ -397,6 +406,9 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
#if ENABLE_INFLUXDB #if ENABLE_INFLUXDB
influxDBConfigure(); influxDBConfigure();
#endif #endif
#if ENABLE_DOMOTICZ
domoticzConfigure();
#endif
mqttConfigure(); mqttConfigure();
#if ENABLE_RF #if ENABLE_RF
@ -432,7 +444,7 @@ void _wsParse(uint32_t client_id, uint8_t * payload, size_t length) {
void _wsStart(uint32_t client_id) { void _wsStart(uint32_t client_id) {
char chipid[6]; char chipid[6];
sprintf(chipid, "%06X", ESP.getChipId());
sprintf_P(chipid, PSTR("%06X"), ESP.getChipId());
DynamicJsonBuffer jsonBuffer; DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject(); JsonObject& root = jsonBuffer.createObject();
@ -460,7 +472,7 @@ void _wsStart(uint32_t client_id) {
root["chipid"] = chipid; root["chipid"] = chipid;
root["mac"] = WiFi.macAddress(); root["mac"] = WiFi.macAddress();
root["device"] = String(DEVICE); root["device"] = String(DEVICE);
root["hostname"] = getSetting("hostname", HOSTNAME);
root["hostname"] = getSetting("hostname");
root["network"] = getNetwork(); root["network"] = getNetwork();
root["deviceip"] = getIP(); root["deviceip"] = getIP();
@ -524,12 +536,13 @@ void _wsStart(uint32_t client_id) {
#if ENABLE_DOMOTICZ #if ENABLE_DOMOTICZ
root["dczVisible"] = 1; root["dczVisible"] = 1;
root["dczEnabled"] = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1;
root["dczTopicIn"] = getSetting("dczTopicIn", DOMOTICZ_IN_TOPIC); root["dczTopicIn"] = getSetting("dczTopicIn", DOMOTICZ_IN_TOPIC);
root["dczTopicOut"] = getSetting("dczTopicOut", DOMOTICZ_OUT_TOPIC); root["dczTopicOut"] = getSetting("dczTopicOut", DOMOTICZ_OUT_TOPIC);
JsonArray& dczRelayIdx = root.createNestedArray("dczRelayIdx"); JsonArray& dczRelayIdx = root.createNestedArray("dczRelayIdx");
for (byte i=0; i<relayCount(); i++) { for (byte i=0; i<relayCount(); i++) {
dczRelayIdx.add(relayToIdx(i));
dczRelayIdx.add(domoticzIdx(i));
} }
#if ENABLE_DHT #if ENABLE_DHT
@ -614,7 +627,7 @@ void _wsStart(uint32_t client_id) {
root["powPowerFactor"] = String(getPowerFactor(), 2); root["powPowerFactor"] = String(getPowerFactor(), 2);
#endif #endif
#ifdef SONOFF_RFBRIDGE
#ifdef ITEAD_SONOFF_RFBRIDGE
root["rfbVisible"] = 1; root["rfbVisible"] = 1;
root["rfbCount"] = relayCount(); root["rfbCount"] = relayCount();
JsonArray& rfb = root.createNestedArray("rfb"); JsonArray& rfb = root.createNestedArray("rfb");
@ -782,7 +795,7 @@ ArRequestHandlerFunction _bindAPI(unsigned int apiID) {
char *p = ltrim(value); char *p = ltrim(value);
// The response will be a 404 NOT FOUND if the resource is not available // The response will be a 404 NOT FOUND if the resource is not available
if (*value == NULL) {
if (!value) {
DEBUG_MSG_P(PSTR("[API] Sending 404 response\n")); DEBUG_MSG_P(PSTR("[API] Sending 404 response\n"));
request->send(404); request->send(404);
return; return;
@ -807,7 +820,7 @@ void apiRegister(const char * url, const char * key, apiGetCallbackFunction getF
// Store it // Store it
web_api_t api; web_api_t api;
char buffer[40]; char buffer[40];
snprintf(buffer, 39, "/api/%s", url);
snprintf_P(buffer, 39, PSTR("/api/%s"), url);
api.url = strdup(buffer); api.url = strdup(buffer);
api.key = strdup(key); api.key = strdup(key);
api.getFn = getFn; api.getFn = getFn;
@ -919,7 +932,7 @@ void _onGetConfig(AsyncWebServerRequest *request) {
} }
char buffer[100]; char buffer[100];
sprintf(buffer, "attachment; filename=\"%s-backup.json\"", (char *) getSetting("hostname").c_str());
sprintf_P(buffer, PSTR("attachment; filename=\"%s-backup.json\""), (char *) getSetting("hostname").c_str());
response->addHeader("Content-Disposition", buffer); response->addHeader("Content-Disposition", buffer);
response->setLength(); response->setLength();
request->send(response); request->send(response);
@ -1083,7 +1096,7 @@ void webSetup() {
mqttRegister(wsMQTTCallback); mqttRegister(wsMQTTCallback);
// Cache the Last-Modifier header value // Cache the Last-Modifier header value
sprintf(_last_modified, "%s %s GMT", __DATE__, __TIME__);
sprintf_P(_last_modified, PSTR("%s %s GMT"), __DATE__, __TIME__);
// Setup webserver // Setup webserver
_server->addHandler(&ws); _server->addHandler(&ws);
@ -1102,7 +1115,7 @@ void webSetup() {
_server->on("/upgrade", HTTP_POST, _onUpgrade, _onUpgradeData); _server->on("/upgrade", HTTP_POST, _onUpgrade, _onUpgradeData);
// Serve static files // Serve static files
#if not EMBEDDED_WEB
#if ENABLE_SPIFFS
_server->serveStatic("/", SPIFFS, "/") _server->serveStatic("/", SPIFFS, "/")
.setLastModified(_last_modified) .setLastModified(_last_modified)
.setFilter([](AsyncWebServerRequest *request) -> bool { .setFilter([](AsyncWebServerRequest *request) -> bool {


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

@ -49,8 +49,8 @@ bool createAP() {
void wifiConfigure() { 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.setConnectTimeout(WIFI_CONNECT_TIMEOUT);
jw.setReconnectTimeout(WIFI_RECONNECT_INTERVAL); jw.setReconnectTimeout(WIFI_RECONNECT_INTERVAL);
jw.setAPMode(AP_MODE); jw.setAPMode(AP_MODE);
@ -123,7 +123,7 @@ void wifiSetup() {
// Message callbacks // Message callbacks
jw.onMessage([](justwifi_messages_t code, char * parameter) { jw.onMessage([](justwifi_messages_t code, char * parameter) {
#ifdef DEBUG_PORT
#if ENABLE_SERIAL_DEBUG || ENABLE_UDP_DEBUG
if (code == MESSAGE_SCANNING) { if (code == MESSAGE_SCANNING) {
DEBUG_MSG_P(PSTR("[WIFI] Scanning\n")); DEBUG_MSG_P(PSTR("[WIFI] Scanning\n"));


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

@ -614,6 +614,11 @@
<fieldset> <fieldset>
<div class="pure-g">
<div class="pure-u-1 pure-u-sm-1-4"><label for="dczEnabled">Enable Domoticz</label></div>
<div class="pure-u-1 pure-u-sm-1-4"><input type="checkbox" name="dczEnabled" tabindex="30" /></div>
</div>
<div class="pure-g"> <div class="pure-g">
<label class="pure-u-1 pure-u-md-1-4" for="dczTopicIn">Domoticz IN Topic</label> <label class="pure-u-1 pure-u-md-1-4" for="dczTopicIn">Domoticz IN Topic</label>
<input class="pure-u-1 pure-u-md-3-4" name="dczTopicIn" type="text" tabindex="31" /> <input class="pure-u-1 pure-u-md-3-4" name="dczTopicIn" type="text" tabindex="31" />


+ 271
- 102
code/platformio.ini View File

@ -1,10 +1,10 @@
[platformio] [platformio]
env_default = d1-debug
env_default = nodemcu-lolin
src_dir = espurna src_dir = espurna
data_dir = espurna/data data_dir = espurna/data
[common] [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_512k = ${common.build_flags} -Wl,-Tesp8266.flash.512k0.ld
build_flags_1m = ${common.build_flags} -Wl,-Tesp8266.flash.1m0.ld build_flags_1m = ${common.build_flags} -Wl,-Tesp8266.flash.1m0.ld
lib_deps = lib_deps =
@ -32,274 +32,420 @@ lib_deps =
lib_ignore = 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 platform = espressif8266
framework = arduino framework = arduino
board = d1_mini board = d1_mini
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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-ssl-debug]
[env:wemos-d1mini-relayshield-ssl]
platform = espressif8266_stage platform = espressif8266_stage
framework = arduino framework = arduino
board = d1_mini board = d1_mini
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DD1_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1
build_flags = ${common.build_flags} -DWEMOS_D1_MINI_RELAYSHIELD -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1
[env:d1-debug-ota]
[env:wemos-d1mini-relayshield-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = d1_mini board = d1_mini
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:node-debug]
[env:nodemcu-lolin]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = nodemcuv2 board = nodemcuv2
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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-ssl]
[env:nodemcu-lolin-ssl]
platform = espressif8266_stage platform = espressif8266_stage
framework = arduino framework = arduino
board = nodemcuv2 board = nodemcuv2
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DNODEMCUV2 -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1
build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1
[env:node-debug-ota]
[env:nodemcu-lolin-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = nodemcuv2 board = nodemcuv2
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:espurna-debug]
# ------------------------------------------------------------------------------
[env:tinkerman-espurna-h]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DESPURNA_H
build_flags = ${common.build_flags} -DTINKERMAN_ESPURNA_H
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:sonoff-debug]
# ------------------------------------------------------------------------------
[env:itead-sonoff-basic]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 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} -DITEAD_SONOFF_BASIC -DENABLE_DHT=1
[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} -DITEAD_SONOFF_BASIC -DENABLE_DS18B20=1
[env:itead-sonoff-rf]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF -DENABLE_DHT=1
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RF
[env:sonoff-ds18b20-debug]
[env:itead-sonoff-rf-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF -DENABLE_DS18B20=1
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-pow-debug]
[env:itead-sonoff-pow]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_POW
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_POW
[env:sonoff-pow-debug-ota]
[env:itead-sonoff-pow-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_POW
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_POW
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:sonoff-dual-debug]
[env:itead-sonoff-dual]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_DUAL
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_DUAL
[env:sonoff-dual-debug-ota]
[env:itead-sonoff-dual-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_DUAL
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: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} -DITEAD_SONOFF_4CH
[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} -DITEAD_SONOFF_4CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[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} -DITEAD_SONOFF_4CH_PRO
[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} -DITEAD_SONOFF_4CH_PRO
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:sonoff-4ch-debug]
[env:itead-sonoff-touch]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp8285 board = esp8285
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_4CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_TOUCH
[env:sonoff-4ch-debug-ota]
[env:itead-sonoff-touch-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp8285 board = esp8285
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_4CH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_TOUCH
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:sonoff-touch-debug]
[env:itead-sonoff-b1]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp8285 board = esp8285
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_TOUCH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_B1
[env:sonoff-touch-debug-ota]
[env:itead-sonoff-b1-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp8285 board = esp8285
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSONOFF_TOUCH
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_B1
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:slampher-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} -DITEAD_SONOFF_T1_1CH
[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} -DITEAD_SONOFF_T1_1CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[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} -DITEAD_SONOFF_T1_2CH
[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} -DITEAD_SONOFF_T1_2CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[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} -DITEAD_SONOFF_T1_3CH
[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} -DITEAD_SONOFF_T1_3CH
upload_speed = 115200
upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266
[env:itead-sonoff-led]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSLAMPHER
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_LED
[env:slampher-debug-ota]
[env:itead-sonoff-led-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DSLAMPHER
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_LED
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:s20-debug]
[env:itead-sonoff-rfbridge]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DS20
build_flags = ${common.build_flags_1m} -DITEAD_SONOFF_RFBRIDGE
[env:s20-debug-ota]
[env:itead-sonoff-rfbridge-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DS20
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} -DITEAD_SLAMPHER
[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} -DITEAD_SLAMPHER
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:rfbridge-debug]
[env:itead-s20]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
@ -308,7 +454,7 @@ lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_1CH_INCHING build_flags = ${common.build_flags_1m} -DITEAD_1CH_INCHING
[env:1ch-inching-debug-ota]
[env:itead-1ch-inching-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
@ -320,7 +466,7 @@ upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:motor-debug]
[env:itead-motor]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
@ -329,7 +475,7 @@ lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DITEAD_MOTOR build_flags = ${common.build_flags_1m} -DITEAD_MOTOR
[env:motor-debug-ota]
[env:itead-motor-ota]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
@ -341,181 +487,204 @@ upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:electrodragon-debug]
# ------------------------------------------------------------------------------
[env:electrodragon-wifi-iot]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:ecoplug-debug]
[env:workchoice-ecoplug]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m} -DECOPLUG
build_flags = ${common.build_flags_1m} -DWORKCHOICE_ECOPLUG
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:jangoe-debug]
[env:jangoe-wifi-relay]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp12e board = esp12e
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:mqtt-relay-debug]
[env:openenergymonitor-mqtt-relay]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp_wroom_02 board = esp_wroom_02
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp_wroom_02 board = esp_wroom_02
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:wifi-relays-debug]
[env:jorgegarcia-wifi-relays]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:ai-light-debug]
[env:aithinker-ai-light]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:led-controller-debug]
[env:magichome-led-controller]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:h801-debug]
[env:huacanxing-h801]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp01_1m board = esp01_1m
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266
[env:bnsz01-debug]
[env:itead-bnsz01]
platform = espressif8266 platform = espressif8266
framework = arduino framework = arduino
board = esp8285 board = esp8285
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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 platform = espressif8266
framework = arduino framework = arduino
board = esp8285 board = esp8285
board_flash_mode = dout board_flash_mode = dout
lib_deps = ${common.lib_deps} lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore} 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
[env:wion-50055]
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} -DWION_50055
[env:wion-50055-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} -DWION_50055
upload_speed = 115200 upload_speed = 115200
upload_port = "192.168.4.1" upload_port = "192.168.4.1"
upload_flags = --auth=fibonacci --port 8266 upload_flags = --auth=fibonacci --port 8266

Loading…
Cancel
Save