diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 9930021b..cfcbde1f 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1,93 +1,116 @@ // ----------------------------------------------------------------------------- -// Configuration HELP -// ----------------------------------------------------------------------------- -// -// MANUFACTURER: Name of the manufacturer of the board ("string") -// DEVICE: Name of the device ("string") -// BUTTON#_PIN: GPIO for the n-th button (1-based, up to 4 buttons) -// BUTTON#_RELAY: Relay number that will be bind to the n-th button (1-based) -// BUTTON#_MODE: A mask of options (BUTTON_PUSHBUTTON and BUTTON_SWITCH cannot be together) -// - BUTTON_PUSHBUTTON: button event is fired when released -// - BUTTON_SWITCH: button event is fired when pressed or released -// - BUTTON_DEFAULT_HIGH: there is a pull up in place -// - BUTTON_SET_PULLUP: set pullup by software -// RELAY#_PIN: GPIO for the n-th relay (1-based, up to 8 relays) -// RELAY#_TYPE: Relay can be RELAY_TYPE_NORMAL, RELAY_TYPE_INVERSE, RELAY_TYPE_LATCHED or RELAY_TYPE_LATCHED_INVERSE -// LED#_PIN: GPIO for the n-th LED (1-based, up to 8 LEDs) -// LED#_PIN_INVERSE: LED has inversed logic (lit when pulled down) -// LED#_MODE: Check types.h for LED_MODE_% -// LED#_RELAY: Linked relay (1-based) -// -// Besides, other hardware specific information should be stated here - -// ----------------------------------------------------------------------------- -// ESPurna Core -// ----------------------------------------------------------------------------- - -#if defined(ESPURNA_CORE) - - // This is a special device targeted to generate a light-weight binary image - // meant to be able to do two-step-updates: - // https://github.com/xoseperez/espurna/wiki/TwoStepUpdates - - // Info - #define MANUFACTURER "ESPRESSIF" - #define DEVICE "ESPURNA_CORE" - - // Disable non-core modules - #define ALEXA_SUPPORT 0 - #define BROKER_SUPPORT 0 - #define BUTTON_SUPPORT 0 - #define DOMOTICZ_SUPPORT 0 - #define HOMEASSISTANT_SUPPORT 0 - #define I2C_SUPPORT 0 - #define MDNS_SERVER_SUPPORT 0 - #define MQTT_SUPPORT 0 - #define NTP_SUPPORT 0 - #define SCHEDULER_SUPPORT 0 - #define SENSOR_SUPPORT 0 - #define THINGSPEAK_SUPPORT 0 - #define WEB_SUPPORT 0 - - // Extra light-weight image - //#define DEBUG_SERIAL_SUPPORT 0 - //#define DEBUG_TELNET_SUPPORT 0 - //#define DEBUG_WEB_SUPPORT 0 - //#define LED_SUPPORT 0 - //#define TELNET_SUPPORT 0 - //#define TERMINAL_SUPPORT 0 +// Devices +// ----------------------------------------------------------------------------- + +// New boards have to be added just before the BOARD_LAST line, +// then add configuration in the hardware.ino +enum boards { + + BOARD_UNKNOWN, + BOARD_CUSTOM, + + BOARD_NODEMCU_LOLIN, + BOARD_WEMOS_D1_MINI_RELAYSHIELD, + BOARD_ITEAD_SONOFF_BASIC, + BOARD_ITEAD_SONOFF_TH, + BOARD_ITEAD_SONOFF_SV, + BOARD_ITEAD_SONOFF_TOUCH, + BOARD_ITEAD_SONOFF_POW, + BOARD_ITEAD_SONOFF_DUAL, + BOARD_ITEAD_1CH_INCHING, + BOARD_ITEAD_SONOFF_4CH, + BOARD_ITEAD_SLAMPHER, + BOARD_ITEAD_S20, + BOARD_ELECTRODRAGON_WIFI_IOT, + BOARD_WORKCHOICE_ECOPLUG, + BOARD_JANGOE_WIFI_RELAY_NC, + BOARD_JANGOE_WIFI_RELAY_NO, + BOARD_OPENENERGYMONITOR_MQTT_RELAY, + BOARD_JORGEGARCIA_WIFI_RELAYS, + BOARD_AITHINKER_AI_LIGHT, + BOARD_MAGICHOME_LED_CONTROLLER, + BOARD_ITEAD_MOTOR, + BOARD_TINKERMAN_ESPURNA_H06, + BOARD_HUACANXING_H801, + BOARD_ITEAD_BNSZ01, + BOARD_ITEAD_SONOFF_RFBRIDGE, + BOARD_ITEAD_SONOFF_4CH_PRO, + BOARD_ITEAD_SONOFF_B1, + BOARD_ITEAD_SONOFF_LED, + BOARD_ITEAD_SONOFF_T1_1CH, + BOARD_ITEAD_SONOFF_T1_2CH, + BOARD_ITEAD_SONOFF_T1_3CH, + BOARD_ITEAD_SONOFF_RF, + BOARD_WION_50055, + BOARD_EXS_WIFI_RELAY_V31, + BOARD_HUACANXING_H802, + BOARD_GENERIC_V9261F, + BOARD_GENERIC_ECH1560, + BOARD_TINKERMAN_ESPURNA_H08, + BOARD_MANCAVEMADE_ESPLIVE, + BOARD_INTERMITTECH_QUINLED, + BOARD_MAGICHOME_LED_CONTROLLER_20, + BOARD_ARILUX_AL_LC06, + BOARD_XENON_SM_PW702U, + BOARD_AUTHOMETION_LYT8266, + BOARD_ARILUX_E27, + BOARD_YJZK_SWITCH_2CH, + BOARD_ITEAD_SONOFF_DUAL_R2, + BOARD_GENERIC_8CH, + BOARD_ARILUX_AL_LC01, + BOARD_ARILUX_AL_LC11, + BOARD_ARILUX_AL_LC02, + BOARD_KMC_70011, + BOARD_GIZWITS_WITTY_CLOUD, + BOARD_EUROMATE_WIFI_STECKER_SCHUKO, + BOARD_TONBUX_POWERSTRIP02, + BOARD_LINGAN_SWA1, + BOARD_HEYGO_HY02, + BOARD_MAXCIO_WUS002S, + BOARD_YIDIAN_XSSSA05, + BOARD_TONBUX_XSSSA06, + BOARD_GREEN_ESP8266RELAY, + BOARD_IKE_ESPIKE, + BOARD_ARNIEX_SWIFITCH, + BOARD_GENERIC_ESP01S_RELAY_V40, + BOARD_GENERIC_ESP01S_RGBLED_V10, + BOARD_HELTEC_TOUCHRELAY, + BOARD_GENERIC_ESP01S_DHT11_V10, + BOARD_GENERIC_ESP01S_DS18B20_V10, + BOARD_ZHILDE_EU44_W, + BOARD_ITEAD_SONOFF_POW_R2, + BOARD_LUANI_HVIO, + BOARD_ALLNET_4DUINO_IOT_WLAN_RELAIS, + BOARD_TONBUX_MOSQUITO_KILLER, + BOARD_NEO_COOLCAM_NAS_WR01W, + BOARD_PILOTAK_ESP_DIN_V1, + BOARD_ESTINK_WIFI_POWER_STRIP, + BOARD_BH_ONOFRE, + BOARD_BLITZWOLF_BWSHP2, + BOARD_TINKERMAN_ESPURNA_SWITCH, + BOARD_ITEAD_SONOFF_S31, + BOARD_STM_RELAY, + BOARD_VANZAVANZU_SMART_WIFI_PLUG_MINI, + BOARD_GENERIC_GEIGER_COUNTER, + BOARD_TINKERMAN_RFM69GW, + BOARD_ITEAD_SONOFF_IFAN02, + BOARD_GENERIC_AG_L4, + + BOARD_LAST + +}; // ----------------------------------------------------------------------------- // Development boards // ----------------------------------------------------------------------------- -#elif defined(NODEMCU_LOLIN) - - //#include "devices/002_nodemcu_lolin.json.h" +#if defined(NODEMCU_LOLIN) -#elif defined(WEMOS_D1_MINI) - - // Info - #define MANUFACTURER "WEMOS" - #define DEVICE "D1_MINI" - - // Buttons - // No buttons on the D1 MINI alone, but defining it without adding a button doen't create problems - #define BUTTON1_PIN 0 // Connect a pushbutton between D3 and GND, - // it's the same as using a Wemos one button shield - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 - - #define I2C_SDA_PIN 4 // D2 - #define I2C_SCL_PIN 5 // D1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(WEMOS_D1_MINI_RELAYSHIELD) - //#include "devices/003_wemos_d1_mini_relayshield.json.h" + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // ESPurna @@ -95,82 +118,36 @@ #elif defined(TINKERMAN_ESPURNA_H06) - //#include "devices/023_tinkerman_espurna_h06.json.h" + #define ESPURNA_IMAGE ESPURNA_POWER // HLW8012 #ifndef HLW8012_SUPPORT - #define HLW8012_SUPPORT 1 + #define HLW8012_SUPPORT 1 #endif - #define HLW8012_SEL_PIN 2 - #define HLW8012_CF1_PIN 13 - #define HLW8012_CF_PIN 14 + #define HLW8012_SEL_PIN 2 + #define HLW8012_CF1_PIN 13 + #define HLW8012_CF_PIN 14 #elif defined(TINKERMAN_ESPURNA_H08) - // Info - #define MANUFACTURER "TINKERMAN" - #define DEVICE "ESPURNA_H08" - - // Buttons - #define BUTTON1_PIN 4 - #define BUTTON1_RELAY 1 - - // Normal pushbutton - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_POWER // HLW8012 #ifndef HLW8012_SUPPORT - #define HLW8012_SUPPORT 1 + #define HLW8012_SUPPORT 1 #endif - #define HLW8012_SEL_PIN 5 - #define HLW8012_CF1_PIN 13 - #define HLW8012_CF_PIN 14 + #define HLW8012_SEL_PIN 5 + #define HLW8012_CF1_PIN 13 + #define HLW8012_CF_PIN 14 #elif defined(TINKERMAN_ESPURNA_SWITCH) - // Info - #define MANUFACTURER "TINKERMAN" - #define DEVICE "ESPURNA_SWITCH" - - // Buttons - #define BUTTON1_PIN 4 - #define BUTTON1_RELAY 1 - - // Touch button - #define BUTTON1_MODE BUTTON_PUSHBUTTON - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 0 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_INVERSE - + #define ESPURNA_IMAGE ESPURNA_BASIC // Check http://tinkerman.cat/rfm69-wifi-gateway/ #elif defined(TINKERMAN_RFM69GW) - // Info - #define MANUFACTURER "TINKERMAN" - #define DEVICE "RFM69GW" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define ESPURNA_IMAGE ESPURNA_RFM69 // RFM69GW #define RFM69_SUPPORT 1 @@ -190,679 +167,191 @@ #elif defined(ITEAD_SONOFF_BASIC) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_BASIC" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - #define BUTTON2_PIN 14 - #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON2_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_RF) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_RF" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - #define BUTTON2_PIN 14 - #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON2_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_TH) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_TH" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_SENSOR // Jack is connected to GPIO14 (and with a small hack to GPIO4) #ifndef DALLAS_SUPPORT - #define DALLAS_SUPPORT 1 + #define DALLAS_SUPPORT 1 #endif - #define DALLAS_PIN 14 + #define DALLAS_PIN 14 #ifndef DHT_SUPPORT - #define DHT_SUPPORT 1 + #define DHT_SUPPORT 1 #endif - #define DHT_PIN 14 - - //#define I2C_SDA_PIN 4 - //#define I2C_SCL_PIN 14 + #define DHT_PIN 14 #elif defined(ITEAD_SONOFF_SV) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_SV" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SLAMPHER) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SLAMPHER" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_S20) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "S20" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_TOUCH) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_TOUCH" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_POW) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_POW" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 15 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_POWER // HLW8012 #ifndef HLW8012_SUPPORT - #define HLW8012_SUPPORT 1 + #define HLW8012_SUPPORT 1 #endif - #define HLW8012_SEL_PIN 5 - #define HLW8012_CF1_PIN 13 - #define HLW8012_CF_PIN 14 + #define HLW8012_SEL_PIN 5 + #define HLW8012_CF1_PIN 13 + #define HLW8012_CF_PIN 14 #elif defined(ITEAD_SONOFF_POW_R2) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_POW_R2" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_POWER // Disable UART noise - #define DEBUG_SERIAL_SUPPORT 0 + #define DEBUG_SERIAL_SUPPORT 0 // CSE7766 #ifndef CSE7766_SUPPORT - #define CSE7766_SUPPORT 1 + #define CSE7766_SUPPORT 1 #endif - #define CSE7766_PIN 1 + #define CSE7766_PIN 1 #elif defined(ITEAD_SONOFF_DUAL) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_DUAL" - #define SERIAL_BAUDRATE 19230 - #define RELAY_PROVIDER RELAY_PROVIDER_DUAL - #define DUMMY_RELAY_COUNT 2 - #define DEBUG_SERIAL_SUPPORT 0 - - // Buttons - #define BUTTON3_RELAY 1 + #define ESPURNA_IMAGE ESPURNA_SONOFF_DUAL - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define SERIAL_BAUDRATE 19230 + #define RELAY_PROVIDER RELAY_PROVIDER_DUAL + #define DEBUG_SERIAL_SUPPORT 0 #elif defined(ITEAD_SONOFF_DUAL_R2) - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_DUAL_R2" - - // Buttons - #define BUTTON1_PIN 0 // Button 0 on header - #define BUTTON2_PIN 9 // Button 1 on header - #define BUTTON3_PIN 10 // Physical button - #define BUTTON1_RELAY 1 - #define BUTTON2_RELAY 2 - #define BUTTON3_RELAY 1 - #define BUTTON1_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Relays - #define RELAY1_PIN 12 - #define RELAY2_PIN 5 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_4CH) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_4CH" - - // 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 RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - #define RELAY3_TYPE RELAY_TYPE_NORMAL - #define RELAY4_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_4CH_PRO) - // Info - #define MANUFACTURER "ITEAD" - #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 - - // Sonoff 4CH Pro uses a secondary STM32 microcontroller to handle - // buttons and relays, but it also forwards button presses to the ESP8285. - // This allows ESPurna to handle button presses -almost- the same way - // as with other devices except: - // * Double click seems to break/disable the button on the STM32 side - // * With S6 switch to 1 (self-locking and inching modes) everything's OK - // * With S6 switch to 0 (interlock mode) if there is a relay ON - // and you click on another relay button, the STM32 sends a "press" - // event for the button of the first relay (to turn it OFF) but it - // does not send a "release" event. It's like it's holding the - // button down since you can see it is still LOW. - // Whatever reason the result is that it may actually perform a - // long click or long-long click. - // The configuration below make the button toggle the relay on press events - // and disables any possibly harmful combination with S6 set to 0. - // If you are sure you will only use S6 to 1 you can comment the - // BUTTON1_LNGCLICK and BUTTON1_LNGLNGCLICK options below to recover the - // reset mode and factory reset functionalities, or link other actions like - // AP mode in the commented line below. - - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - //#define BUTTON1_LNGCLICK BUTTON_MODE_AP - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE - #define BUTTON2_PRESS BUTTON_MODE_TOGGLE - #define BUTTON2_CLICK BUTTON_MODE_NONE - #define BUTTON3_PRESS BUTTON_MODE_TOGGLE - #define BUTTON3_CLICK BUTTON_MODE_NONE - #define BUTTON4_PRESS BUTTON_MODE_TOGGLE - #define BUTTON4_CLICK BUTTON_MODE_NONE - - // Relays - #define RELAY1_PIN 12 - #define RELAY2_PIN 5 - #define RELAY3_PIN 4 - #define RELAY4_PIN 15 - - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - #define RELAY3_TYPE RELAY_TYPE_NORMAL - #define RELAY4_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_1CH_INCHING) - // The inching functionality is managed by a misterious IC in the board. - // You cannot control the inching button and functionality from the ESP8266 - // Besides, enabling the inching functionality using the hardware button - // will result in the relay switching on and off continuously. - // Fortunately the unkown IC keeps memory of the hardware inching status - // so you can just disable it and forget. The inching LED must be lit. - // You can still use the pulse options from the web interface - // without problem. - - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "1CH_INCHING" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_MOTOR) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "MOTOR" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_BNSZ01) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "BNSZ01" - #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 - - // Light - #define LIGHT_CHANNELS 1 - #define LIGHT_CH1_PIN 12 - #define LIGHT_CH1_INVERSE 0 - -#elif defined(ITEAD_SONOFF_RFBRIDGE) + #define ESPURNA_IMAGE ESPURNA_LIGHT // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_RFBRIDGE" - #define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 1 + #define LIGHT_CH1_PIN 12 + #define LIGHT_CH1_INVERSE 0 - // Number of virtual switches - #ifndef DUMMY_RELAY_COUNT - #define DUMMY_RELAY_COUNT 8 - #endif +#elif defined(ITEAD_SONOFF_RFBRIDGE) - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define ESPURNA_IMAGE ESPURNA_SONOFF_RFBRIDGE - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_RFBRIDGE // RFB Direct hack thanks to @wildwiz // https://github.com/xoseperez/espurna/wiki/Hardware-Itead-Sonoff-RF-Bridge---Direct-Hack #ifndef RFB_DIRECT - #define RFB_DIRECT 0 + #define RFB_DIRECT 0 #endif #ifndef RFB_RX_PIN - #define RFB_RX_PIN 4 // GPIO for RX when RFB_DIRECT + #define RFB_RX_PIN 4 // GPIO for RX when RFB_DIRECT #endif #ifndef RFB_TX_PIN - #define RFB_TX_PIN 5 // GPIO for TX when RFB_DIRECT + #define RFB_TX_PIN 5 // GPIO for TX when RFB_DIRECT #endif // When using un-modified harware, ESPurna communicates with the secondary // MCU EFM8BB1 via UART at 19200 bps so we need to change the speed of // the port and remove UART noise on serial line #if not RFB_DIRECT - #define SERIAL_BAUDRATE 19200 - #define DEBUG_SERIAL_SUPPORT 0 + #define SERIAL_BAUDRATE 19200 + #define DEBUG_SERIAL_SUPPORT 0 #endif #elif defined(ITEAD_SONOFF_B1) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_B1" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX - #define DUMMY_RELAY_COUNT 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 5 - #define MY92XX_MODEL MY92XX_MODEL_MY9231 - #define MY92XX_CHIPS 2 - #define MY92XX_DI_PIN 12 - #define MY92XX_DCKI_PIN 14 - #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT - #define MY92XX_MAPPING 4, 3, 5, 0, 1 - #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX + #define LIGHT_CHANNELS 5 + #define MY92XX_MODEL MY92XX_MODEL_MY9231 + #define MY92XX_CHIPS 2 + #define MY92XX_DI_PIN 12 + #define MY92XX_DCKI_PIN 14 + #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT + #define MY92XX_MAPPING 4, 3, 5, 0, 1 + #define LIGHT_WHITE_FACTOR (0.1) // White LEDs are way more bright in the B1 #elif defined(ITEAD_SONOFF_LED) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_LED" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 - - // Light - #define LIGHT_CHANNELS 2 - #define LIGHT_CH1_PIN 12 // Cold white - #define LIGHT_CH2_PIN 14 // Warm white - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 2 + #define LIGHT_CH1_PIN 12 // Cold white + #define LIGHT_CH2_PIN 14 // Warm white + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 #elif defined(ITEAD_SONOFF_T1_1CH) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_T1_1CH" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_T1_2CH) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_T1_2CH" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON2_PIN 9 - - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET - - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_PRESS BUTTON_MODE_TOGGLE - #define BUTTON2_CLICK BUTTON_MODE_NONE - #define BUTTON2_DBLCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGLNGCLICK BUTTON_MODE_RESET - - #define BUTTON1_RELAY 1 - #define BUTTON2_RELAY 2 - - // Relays - #define RELAY1_PIN 12 - #define RELAY2_PIN 5 - - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_T1_3CH) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_T1_3CH" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON2_PIN 9 - #define BUTTON3_PIN 10 - - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET - - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_PRESS BUTTON_MODE_TOGGLE - #define BUTTON2_CLICK BUTTON_MODE_NONE - #define BUTTON2_DBLCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGLNGCLICK BUTTON_MODE_RESET - - #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON3_PRESS BUTTON_MODE_TOGGLE - #define BUTTON3_CLICK BUTTON_MODE_NONE - #define BUTTON3_DBLCLICK BUTTON_MODE_NONE - #define BUTTON3_LNGCLICK BUTTON_MODE_NONE - #define BUTTON3_LNGLNGCLICK BUTTON_MODE_RESET - - #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_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - #define RELAY3_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(ITEAD_SONOFF_S31) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_S31" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_POWER // Disable UART noise - #define DEBUG_SERIAL_SUPPORT 0 + #define DEBUG_SERIAL_SUPPORT 0 // CSE7766 - #define CSE7766_SUPPORT 1 - #define CSE7766_PIN 1 + #define CSE7766_SUPPORT 1 + #define CSE7766_PIN 1 #elif defined(ITEAD_SONOFF_IFAN02) - // Info - #define MANUFACTURER "ITEAD" - #define DEVICE "SONOFF_IFAN02" - - // These are virtual buttons triggered by the remote - #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 - - // Relays - #define RELAY1_PIN 12 - #define RELAY2_PIN 5 - #define RELAY3_PIN 4 - #define RELAY4_PIN 15 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - #define RELAY3_TYPE RELAY_TYPE_NORMAL - #define RELAY4_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // YJZK @@ -870,31 +359,7 @@ #elif defined(YJZK_SWITCH_2CH) - // Info - #define MANUFACTURER "YJZK" - #define DEVICE "SWITCH_2CH" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON2_PIN 9 - - #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 5 - - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 0 - + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Electrodragon boards @@ -902,30 +367,7 @@ #elif defined(ELECTRODRAGON_WIFI_IOT) - // Info - #define MANUFACTURER "ELECTRODRAGON" - #define DEVICE "WIFI_IOT" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON2_PIN 2 - - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - #define BUTTON1_RELAY 1 - #define BUTTON2_RELAY 2 - - // Relays - #define RELAY1_PIN 12 - #define RELAY2_PIN 13 - - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 16 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // WorkChoice ecoPlug @@ -933,22 +375,7 @@ #elif defined(WORKCHOICE_ECOPLUG) - // Info - #define MANUFACTURER "WORKCHOICE" - #define DEVICE "ECOPLUG" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 15 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // AI Thinker @@ -956,21 +383,18 @@ #elif defined(AITHINKER_AI_LIGHT) - // Info - #define MANUFACTURER "AITHINKER" - #define DEVICE "AI_LIGHT" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX - #define DUMMY_RELAY_COUNT 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 4 - #define MY92XX_MODEL MY92XX_MODEL_MY9291 - #define MY92XX_CHIPS 1 - #define MY92XX_DI_PIN 13 - #define MY92XX_DCKI_PIN 15 - #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT - #define MY92XX_MAPPING 0, 1, 2, 3 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX + #define LIGHT_CHANNELS 4 + #define MY92XX_MODEL MY92XX_MODEL_MY9291 + #define MY92XX_CHIPS 1 + #define MY92XX_DI_PIN 13 + #define MY92XX_DCKI_PIN 15 + #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT + #define MY92XX_MAPPING 0, 1, 2, 3 // ----------------------------------------------------------------------------- // LED Controller @@ -978,61 +402,48 @@ #elif defined(MAGICHOME_LED_CONTROLLER) - // Info - #define MANUFACTURER "MAGICHOME" - #define DEVICE "LED_CONTROLLER" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 4 - #define LIGHT_CH1_PIN 14 // RED - #define LIGHT_CH2_PIN 5 // GREEN - #define LIGHT_CH3_PIN 12 // BLUE - #define LIGHT_CH4_PIN 13 // WHITE - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + #define LIGHT_CHANNELS 4 + #define LIGHT_CH1_PIN 14 // RED + #define LIGHT_CH2_PIN 5 // GREEN + #define LIGHT_CH3_PIN 12 // BLUE + #define LIGHT_CH4_PIN 13 // WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 // IR - #define IR_SUPPORT 1 - #define IR_RECEIVER_PIN 4 - #define IR_BUTTON_SET 1 + #define IR_SUPPORT 1 + #define IR_RECEIVER_PIN 4 + #define IR_BUTTON_SET 1 #elif defined(MAGICHOME_LED_CONTROLLER_20) - // Info - #define MANUFACTURER "MAGICHOME" - #define DEVICE "LED_CONTROLLER_20" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 4 - #define LIGHT_CH1_PIN 5 // RED - #define LIGHT_CH2_PIN 12 // GREEN - #define LIGHT_CH3_PIN 13 // BLUE - #define LIGHT_CH4_PIN 15 // WHITE - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 4 + #define LIGHT_CH1_PIN 5 // RED + #define LIGHT_CH2_PIN 12 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 15 // WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 // IR - #define IR_SUPPORT 1 - #define IR_RECEIVER_PIN 4 - #define IR_BUTTON_SET 1 + #define IR_SUPPORT 1 + #define IR_RECEIVER_PIN 4 + #define IR_BUTTON_SET 1 // ----------------------------------------------------------------------------- // HUACANXING H801 & H802 @@ -1040,53 +451,43 @@ #elif defined(HUACANXING_H801) - // Info - #define MANUFACTURER "HUACANXING" - #define DEVICE "H801" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - #define DEBUG_PORT Serial1 - #define SERIAL_RX_ENABLED 1 - - // LEDs - #define LED1_PIN 5 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 5 - #define LIGHT_CH1_PIN 15 // RED - #define LIGHT_CH2_PIN 13 // GREEN - #define LIGHT_CH3_PIN 12 // BLUE - #define LIGHT_CH4_PIN 14 // WHITE1 - #define LIGHT_CH5_PIN 4 // WHITE2 - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 - #define LIGHT_CH5_INVERSE 0 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DEBUG_PORT Serial1 + #define SERIAL_RX_ENABLED 1 + #define LIGHT_CHANNELS 5 + #define LIGHT_CH1_PIN 15 // RED + #define LIGHT_CH2_PIN 13 // GREEN + #define LIGHT_CH3_PIN 12 // BLUE + #define LIGHT_CH4_PIN 14 // WHITE1 + #define LIGHT_CH5_PIN 4 // WHITE2 + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + #define LIGHT_CH5_INVERSE 0 #elif defined(HUACANXING_H802) + #define ESPURNA_IMAGE ESPURNA_LIGHT + // Info - #define MANUFACTURER "HUACANXING" - #define DEVICE "H802" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - #define DEBUG_PORT Serial1 - #define SERIAL_RX_ENABLED 1 - - // Light - #define LIGHT_CHANNELS 4 - #define LIGHT_CH1_PIN 12 // RED - #define LIGHT_CH2_PIN 14 // GREEN - #define LIGHT_CH3_PIN 13 // BLUE - #define LIGHT_CH4_PIN 15 // WHITE - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DEBUG_PORT Serial1 + #define SERIAL_RX_ENABLED 1 + #define LIGHT_CHANNELS 4 + #define LIGHT_CH1_PIN 12 // RED + #define LIGHT_CH2_PIN 14 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 15 // WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 // ----------------------------------------------------------------------------- // Jan Goedeke Wifi Relay @@ -1095,49 +496,11 @@ #elif defined(JANGOE_WIFI_RELAY_NC) - // Info - #define MANUFACTURER "JANGOE" - #define DEVICE "WIFI_RELAY_NC" - - // Buttons - #define BUTTON1_PIN 12 - #define BUTTON2_PIN 13 - - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - #define BUTTON1_RELAY 1 - #define BUTTON2_RELAY 2 - - // Relays - #define RELAY1_PIN 2 - #define RELAY2_PIN 14 - - #define RELAY1_TYPE RELAY_TYPE_INVERSE - #define RELAY2_TYPE RELAY_TYPE_INVERSE + #define ESPURNA_IMAGE ESPURNA_BASIC #elif defined(JANGOE_WIFI_RELAY_NO) - // Info - #define MANUFACTURER "JANGOE" - #define DEVICE "WIFI_RELAY_NO" - - // Buttons - #define BUTTON1_PIN 12 - #define BUTTON2_PIN 13 - - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - #define BUTTON1_RELAY 1 - #define BUTTON2_RELAY 2 - - // Relays - #define RELAY1_PIN 2 - #define RELAY2_PIN 14 - - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Jorge García Wifi+Relays Board Kit @@ -1147,16 +510,7 @@ #elif defined(JORGEGARCIA_WIFI_RELAYS) - // Info - #define MANUFACTURER "JORGEGARCIA" - #define DEVICE "WIFI_RELAYS" - - // Relays - #define RELAY1_PIN 0 - #define RELAY2_PIN 2 - - #define RELAY1_TYPE RELAY_TYPE_INVERSE - #define RELAY2_TYPE RELAY_TYPE_INVERSE + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // WiFi MQTT Relay / Thermostat @@ -1164,22 +518,7 @@ #elif defined(OPENENERGYMONITOR_MQTT_RELAY) - // Info - #define MANUFACTURER "OPENENERGYMONITOR" - #define DEVICE "MQTT_RELAY" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 16 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // WiOn 50055 Indoor Wi-Fi Wall Outlet & Tap @@ -1189,24 +528,7 @@ #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_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // EX-Store Wifi Relay v3.1 @@ -1215,21 +537,7 @@ #elif defined(EXS_WIFI_RELAY_V31) - // Untested - - // Info - #define MANUFACTURER "EXS" - #define DEVICE "WIFI_RELAY_V31" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Relays - #define RELAY1_PIN 13 - #define RELAY1_TYPE RELAY_TYPE_LATCHED - #define RELAY1_RESET_PIN 12 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // V9261F @@ -1237,15 +545,15 @@ #elif defined(GENERIC_V9261F) + #define ESPURNA_IMAGE ESPURNA_POWER + // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "V9261F" - #define ALEXA_SUPPORT 0 + #define ALEXA_SUPPORT 0 // V9261F - #define V9261F_SUPPORT 1 - #define V9261F_PIN 2 - #define V9261F_PIN_INVERSE 1 + #define V9261F_SUPPORT 1 + #define V9261F_PIN 2 + #define V9261F_PIN_INVERSE 1 // ----------------------------------------------------------------------------- // ECH1560 @@ -1253,16 +561,16 @@ #elif defined(GENERIC_ECH1560) + #define ESPURNA_IMAGE ESPURNA_POWER + // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "ECH1560" - #define ALEXA_SUPPORT 0 + #define ALEXA_SUPPORT 0 // ECH1560 - #define ECH1560_SUPPORT 1 - #define ECH1560_CLK_PIN 4 - #define ECH1560_MISO_PIN 5 - #define ECH1560_INVERTED 0 + #define ECH1560_SUPPORT 1 + #define ECH1560_CLK_PIN 4 + #define ECH1560_MISO_PIN 5 + #define ECH1560_INVERTED 0 // ----------------------------------------------------------------------------- // ESPLive @@ -1271,26 +579,7 @@ #elif defined(MANCAVEMADE_ESPLIVE) - // Info - #define MANUFACTURER "MANCAVEMADE" - #define DEVICE "ESPLIVE" - - // Buttons - #define BUTTON1_PIN 4 - #define BUTTON2_PIN 5 - - #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 13 - - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL + #define ESPURNA_IMAGE ESPURNA_SENSOR // DS18B20 #ifndef DALLAS_SUPPORT @@ -1307,23 +596,16 @@ #elif defined(INTERMITTECH_QUINLED) - // Info - #define MANUFACTURER "INTERMITTECH" - #define DEVICE "QUINLED" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // LEDs - #define LED1_PIN 5 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 2 - #define LIGHT_CH1_PIN 0 - #define LIGHT_CH2_PIN 2 - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 2 + #define LIGHT_CH1_PIN 0 + #define LIGHT_CH2_PIN 2 + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 // ----------------------------------------------------------------------------- // Arilux AL-LC06 @@ -1331,103 +613,88 @@ #elif defined(ARILUX_AL_LC01) - // Info - #define MANUFACTURER "ARILUX" - #define DEVICE "AL_LC01" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // Light - #define LIGHT_CHANNELS 3 - #define LIGHT_CH1_PIN 5 // RED - #define LIGHT_CH2_PIN 12 // GREEN - #define LIGHT_CH3_PIN 13 // BLUE - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - -#elif defined(ARILUX_AL_LC02) + #define ESPURNA_IMAGE ESPURNA_LIGHT // Info - #define MANUFACTURER "ARILUX" - #define DEVICE "AL_LC02" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 3 + #define LIGHT_CH1_PIN 5 // RED + #define LIGHT_CH2_PIN 12 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 - // Light - #define LIGHT_CHANNELS 4 - #define LIGHT_CH1_PIN 12 // RED - #define LIGHT_CH2_PIN 5 // GREEN - #define LIGHT_CH3_PIN 13 // BLUE - #define LIGHT_CH4_PIN 15 // WHITE1 - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 +#elif defined(ARILUX_AL_LC02) -#elif defined(ARILUX_AL_LC06) + #define ESPURNA_IMAGE ESPURNA_LIGHT // Info - #define MANUFACTURER "ARILUX" - #define DEVICE "AL_LC06" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 4 + #define LIGHT_CH1_PIN 12 // RED + #define LIGHT_CH2_PIN 5 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 15 // WHITE1 + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + +#elif defined(ARILUX_AL_LC06) - // Light - #define LIGHT_CHANNELS 5 - #define LIGHT_CH1_PIN 14 // RED - #define LIGHT_CH2_PIN 12 // GREEN - #define LIGHT_CH3_PIN 13 // BLUE - #define LIGHT_CH4_PIN 15 // WHITE1 - #define LIGHT_CH5_PIN 5 // WHITE2 - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 - #define LIGHT_CH5_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_LIGHT + + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 5 + #define LIGHT_CH1_PIN 14 // RED + #define LIGHT_CH2_PIN 12 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 15 // WHITE1 + #define LIGHT_CH5_PIN 5 // WHITE2 + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + #define LIGHT_CH5_INVERSE 0 #elif defined(ARILUX_AL_LC11) - // Info - #define MANUFACTURER "ARILUX" - #define DEVICE "AL_LC11" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 5 - #define LIGHT_CH1_PIN 5 // RED - #define LIGHT_CH2_PIN 4 // GREEN - #define LIGHT_CH3_PIN 14 // BLUE - #define LIGHT_CH4_PIN 13 // WHITE1 - #define LIGHT_CH5_PIN 12 // WHITE1 - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 - #define LIGHT_CH5_INVERSE 0 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 5 + #define LIGHT_CH1_PIN 5 // RED + #define LIGHT_CH2_PIN 4 // GREEN + #define LIGHT_CH3_PIN 14 // BLUE + #define LIGHT_CH4_PIN 13 // WHITE1 + #define LIGHT_CH5_PIN 12 // WHITE1 + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + #define LIGHT_CH5_INVERSE 0 #elif defined(ARILUX_E27) - // Info - #define MANUFACTURER "ARILUX" - #define DEVICE "E27" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX - #define DUMMY_RELAY_COUNT 1 + #define ESPURNA_IMAGE ESPURNA_LIGHT - // Light - #define LIGHT_CHANNELS 4 - #define MY92XX_MODEL MY92XX_MODEL_MY9291 - #define MY92XX_CHIPS 1 - #define MY92XX_DI_PIN 13 - #define MY92XX_DCKI_PIN 15 - #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT - #define MY92XX_MAPPING 0, 1, 2, 3 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX + #define LIGHT_CHANNELS 4 + #define MY92XX_MODEL MY92XX_MODEL_MY9291 + #define MY92XX_CHIPS 1 + #define MY92XX_DI_PIN 13 + #define MY92XX_DCKI_PIN 15 + #define MY92XX_COMMAND MY92XX_COMMAND_DEFAULT + #define MY92XX_MAPPING 0, 1, 2, 3 // ----------------------------------------------------------------------------- // XENON SM-PW701U @@ -1435,22 +702,7 @@ #elif defined(XENON_SM_PW702U) - // Info - #define MANUFACTURER "XENON" - #define DEVICE "SM_PW702U" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 4 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // AUTHOMETION LYT8266 @@ -1459,58 +711,38 @@ #elif defined(AUTHOMETION_LYT8266) - // Info - #define MANUFACTURER "AUTHOMETION" - #define DEVICE "LYT8266" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // Light - #define LIGHT_CHANNELS 4 - #define LIGHT_CH1_PIN 13 // RED - #define LIGHT_CH2_PIN 12 // GREEN - #define LIGHT_CH3_PIN 14 // BLUE - #define LIGHT_CH4_PIN 2 // WHITE - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 - #define LIGHT_CH4_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_LIGHT - #define LIGHT_ENABLE_PIN 15 + // Info + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 4 + #define LIGHT_CH1_PIN 13 // RED + #define LIGHT_CH2_PIN 12 // GREEN + #define LIGHT_CH3_PIN 14 // BLUE + #define LIGHT_CH4_PIN 2 // WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + #define LIGHT_ENABLE_PIN 15 #elif defined(GIZWITS_WITTY_CLOUD) + #define ESPURNA_IMAGE ESPURNA_LIGHT + // Info - #define MANUFACTURER "GIZWITS" - #define DEVICE "WITTY_CLOUD" - #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT - #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define LIGHT_CHANNELS 3 + #define LIGHT_CH1_PIN 15 // RED + #define LIGHT_CH2_PIN 12 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 - // Buttons - #define BUTTON1_PIN 4 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET - - #define ANALOG_SUPPORT 1 - - // LEDs - #define LED1_PIN 2 // BLUE build-in - #define LED1_PIN_INVERSE 1 - - // Light - #define LIGHT_CHANNELS 3 - #define LIGHT_CH1_PIN 15 // RED - #define LIGHT_CH2_PIN 12 // GREEN - #define LIGHT_CH3_PIN 13 // BLUE - #define LIGHT_CH1_INVERSE 0 - #define LIGHT_CH2_INVERSE 0 - #define LIGHT_CH3_INVERSE 0 + #define ANALOG_SUPPORT 1 // TODO: specific or generic? // ----------------------------------------------------------------------------- // KMC 70011 @@ -1519,32 +751,16 @@ #elif defined(KMC_70011) - // Info - #define MANUFACTURER "KMC" - #define DEVICE "70011" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 14 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 13 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_POWER // HLW8012 #ifndef HLW8012_SUPPORT - #define HLW8012_SUPPORT 1 + #define HLW8012_SUPPORT 1 #endif - #define HLW8012_SEL_PIN 12 - #define HLW8012_CF1_PIN 5 - #define HLW8012_CF_PIN 4 - - #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 5 + #define HLW8012_CF_PIN 4 + #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor // ----------------------------------------------------------------------------- // Euromate (?) Wifi Stecker Shuko @@ -1554,28 +770,7 @@ #elif defined(EUROMATE_WIFI_STECKER_SCHUKO) - // Info - #define MANUFACTURER "EUROMATE" - #define DEVICE "WIFI_STECKER_SCHUKO" - - // Buttons - #define BUTTON1_PIN 14 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // The relay in the device is not a bistable (latched) relay. - // The device is reported to have a flip-flop circuit to drive the relay - // So @Geitde hack is still the only possible - - // Hack: drive GPIO12 low and use GPIO5 as normal relay pin: - #define RELAY1_PIN 5 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define LED2_PIN 12 /* DUMMY: exploit default off state for GPIO12=low */ - #define LED2_PIN_INVERSE 0 - - // LEDs - #define LED1_PIN 4 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Generic 8CH @@ -1583,27 +778,7 @@ #elif defined(GENERIC_8CH) - // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "8CH" - - // Relays - #define RELAY1_PIN 0 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_PIN 2 - #define RELAY2_TYPE RELAY_TYPE_NORMAL - #define RELAY3_PIN 4 - #define RELAY3_TYPE RELAY_TYPE_NORMAL - #define RELAY4_PIN 5 - #define RELAY4_TYPE RELAY_TYPE_NORMAL - #define RELAY5_PIN 12 - #define RELAY5_TYPE RELAY_TYPE_NORMAL - #define RELAY6_PIN 13 - #define RELAY6_TYPE RELAY_TYPE_NORMAL - #define RELAY7_PIN 14 - #define RELAY7_TYPE RELAY_TYPE_NORMAL - #define RELAY8_PIN 15 - #define RELAY8_TYPE RELAY_TYPE_NORMAL + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // STM RELAY @@ -1611,16 +786,10 @@ #elif defined(STM_RELAY) - // Info - #define MANUFACTURER "STM_RELAY" - #define DEVICE "2CH" - - // Relays - #define DUMMY_RELAY_COUNT 2 - #define RELAY_PROVIDER RELAY_PROVIDER_STM + #define ESPURNA_IMAGE ESPURNA_STM - // Remove UART noise on serial line - #define DEBUG_SERIAL_SUPPORT 0 + #define RELAY_PROVIDER RELAY_PROVIDER_STM + #define DEBUG_SERIAL_SUPPORT 0 // ----------------------------------------------------------------------------- // Tonbux Powerstrip02 @@ -1628,33 +797,7 @@ #elif defined(TONBUX_POWERSTRIP02) - // Info - #define MANUFACTURER "TONBUX" - #define DEVICE "POWERSTRIP02" - - // Buttons - #define BUTTON1_PIN 5 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 0 - - // Relays - #define RELAY1_PIN 4 - #define RELAY1_TYPE RELAY_TYPE_INVERSE - #define RELAY2_PIN 13 - #define RELAY2_TYPE RELAY_TYPE_INVERSE - #define RELAY3_PIN 12 - #define RELAY3_TYPE RELAY_TYPE_INVERSE - #define RELAY4_PIN 14 - #define RELAY4_TYPE RELAY_TYPE_INVERSE - // Not a relay. USB ports on/off - #define RELAY5_PIN 16 - #define RELAY5_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 0 // 1 blue led - #define LED1_PIN_INVERSE 1 - #define LED2_PIN 3 // 3 red leds - #define LED2_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Lingan SWA1 @@ -1662,22 +805,7 @@ #elif defined(LINGAN_SWA1) - // Info - #define MANUFACTURER "LINGAN" - #define DEVICE "SWA1" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 5 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 4 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // HEYGO HY02 @@ -1685,22 +813,7 @@ #elif defined(HEYGO_HY02) - // Info - #define MANUFACTURER "HEYGO" - #define DEVICE "HY02" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 4 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Maxcio W-US002S @@ -1708,33 +821,17 @@ #elif defined(MAXCIO_WUS002S) - // Info - #define MANUFACTURER "MAXCIO" - #define DEVICE "WUS002S" - - // Buttons - #define BUTTON1_PIN 2 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 13 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 3 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_POWER // HLW8012 #ifndef HLW8012_SUPPORT - #define HLW8012_SUPPORT 1 + #define HLW8012_SUPPORT 1 #endif - #define HLW8012_SEL_PIN 12 - #define HLW8012_CF1_PIN 5 - #define HLW8012_CF_PIN 4 - - #define HLW8012_CURRENT_R 0.002 // Current resistor - #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 5 + #define HLW8012_CF_PIN 4 + #define HLW8012_CURRENT_R 0.002 // Current resistor + #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor // ----------------------------------------------------------------------------- // YiDian XS-SSA05 @@ -1742,33 +839,17 @@ #elif defined(YIDIAN_XSSSA05) - // Info - #define MANUFACTURER "YIDIAN" - #define DEVICE "XSSSA05" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 4 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_POWER // HLW8012 #ifndef HLW8012_SUPPORT - #define HLW8012_SUPPORT 1 + #define HLW8012_SUPPORT 1 #endif - #define HLW8012_SEL_PIN 3 - #define HLW8012_CF1_PIN 14 - #define HLW8012_CF_PIN 5 - - #define HLW8012_CURRENT_R 0.001 // Current resistor - #define HLW8012_VOLTAGE_R_UP ( 2 * 1200000 ) // Upstream voltage resistor + #define HLW8012_SEL_PIN 3 + #define HLW8012_CF1_PIN 14 + #define HLW8012_CF_PIN 5 + #define HLW8012_CURRENT_R 0.001 // Current resistor + #define HLW8012_VOLTAGE_R_UP ( 2 * 1200000 ) // Upstream voltage resistor // ----------------------------------------------------------------------------- // TONBUX XS-SSA06 @@ -1776,26 +857,7 @@ #elif defined(TONBUX_XSSSA06) - // Info - #define MANUFACTURER "TONBUX" - #define DEVICE "XSSSA06" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 15 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 0 // R - 8 rgb led ring - #define LED1_PIN_INVERSE 0 - #define LED2_PIN 5 // G - #define LED2_PIN_INVERSE 0 - #define LED3_PIN 2 // B - #define LED3_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // GREEN ESP8266 RELAY MODULE @@ -1804,23 +866,7 @@ #elif defined(GREEN_ESP8266RELAY) - // Info - #define MANUFACTURER "GREEN" - #define DEVICE "ESP8266RELAY" - - // Buttons - // Not a button but input via Optocoupler - #define BUTTON1_PIN 5 - #define BUTTON1_MODE BUTTON_PUSHBUTTON - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 4 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Henrique Gravina ESPIKE @@ -1829,36 +875,7 @@ #elif defined(IKE_ESPIKE) - #define MANUFACTURER "IKE" - #define DEVICE "ESPIKE" - - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - - #define BUTTON1_PIN 13 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - #define BUTTON2_PIN 12 - #define BUTTON2_RELAY 2 - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - #define BUTTON3_PIN 14 - #define BUTTON3_RELAY 3 - #define BUTTON3_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - #define RELAY1_PIN 4 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - #define RELAY2_PIN 5 - #define RELAY2_TYPE RELAY_TYPE_NORMAL - - #define RELAY3_PIN 16 - #define RELAY3_TYPE RELAY_TYPE_NORMAL - - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // SWIFITCH @@ -1867,28 +884,7 @@ #elif defined(ARNIEX_SWIFITCH) - // Info - #define MANUFACTURER "ARNIEX" - #define DEVICE "SWIFITCH" - - // Buttons - #define BUTTON1_PIN 4 // D2 - #define BUTTON1_MODE BUTTON_SWITCH | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - #define BUTTON1_PRESS BUTTON_MODE_NONE - #define BUTTON1_CLICK BUTTON_MODE_TOGGLE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE - - // Relays - #define RELAY1_PIN 5 // D1 - #define RELAY1_TYPE RELAY_TYPE_INVERSE - - // LEDs - #define LED1_PIN 12 // D6 - #define LED1_PIN_INVERSE 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // ESP-01S RELAY v4.0 @@ -1897,17 +893,7 @@ #elif defined(GENERIC_ESP01S_RELAY_V40) - // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "ESP01S_RELAY_40" - - // Relays - #define RELAY1_PIN 0 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // ESP-01S RGB LED v1.0 (some sold with ws2818) @@ -1916,23 +902,7 @@ #elif defined(GENERIC_ESP01S_RGBLED_V10) - // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "ESP01S_RGBLED_10" - - // This board is sold as RGB LED module BUT it has on board 3 pin ph2.0 connector (VCC, GPIO2, GND) - // so, if you wish, you may connect LED, BUTTON, RELAY, SENSOR etc. - - // Buttons - //#define BUTTON1_PIN 2 - - // Relays - //#define RELAY1_PIN 2 - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 0 - + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // ESP-01S DHT11 v1.0 @@ -1941,16 +911,14 @@ #elif defined(GENERIC_ESP01S_DHT11_V10) - // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "ESP01S_DHT11_10" + #define ESPURNA_IMAGE ESPURNA_SENSOR // DHT11 #ifndef DHT_SUPPORT - #define DHT_SUPPORT 1 + #define DHT_SUPPORT 1 #endif - #define DHT_PIN 2 - #define DHT_TYPE DHT_CHIP_DHT11 + #define DHT_PIN 2 + #define DHT_TYPE DHT_CHIP_DHT11 // ----------------------------------------------------------------------------- // ESP-01S DS18B20 v1.0 @@ -1959,15 +927,13 @@ #elif defined(GENERIC_ESP01S_DS18B20_V10) - // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "ESP01S_DS18B20_10" + #define ESPURNA_IMAGE ESPURNA_SENSOR // DB18B20 #ifndef DALLAS_SUPPORT - #define DALLAS_SUPPORT 1 + #define DALLAS_SUPPORT 1 #endif - #define DALLAS_PIN 2 + #define DALLAS_PIN 2 // ----------------------------------------------------------------------------- // ESP-DIN relay board V1 @@ -1976,44 +942,26 @@ #elif defined(PILOTAK_ESP_DIN_V1) - // Info - #define MANUFACTURER "PILOTAK" - #define DEVICE "ESP_DIN_V1" - - // Buttons - #define BUTTON1_PIN 0 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Relays - #define RELAY1_PIN 4 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - #define RELAY2_PIN 5 - #define RELAY2_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 15 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_SENSOR - #define I2C_SDA_PIN 12 - #define I2C_SCL_PIN 13 + #define I2C_SDA_PIN 12 // TODO:what is this for? + #define I2C_SCL_PIN 13 #ifndef DALLAS_SUPPORT - #define DALLAS_SUPPORT 1 + #define DALLAS_SUPPORT 1 #endif - #define DALLAS_PIN 2 + #define DALLAS_PIN 2 #ifndef RF_SUPPORT - #define RF_SUPPORT 1 + #define RF_SUPPORT 1 #endif - #define RF_PIN 14 + #define RF_PIN 14 #ifndef DIGITAL_SUPPORT - #define DIGITAL_SUPPORT 1 + #define DIGITAL_SUPPORT 1 #endif - #define DIGITAL_PIN 16 - #define DIGITAL_PIN_MODE INPUT + #define DIGITAL_PIN 16 + #define DIGITAL_PIN_MODE INPUT // ----------------------------------------------------------------------------- // Heltec Touch Relay @@ -2022,19 +970,7 @@ #elif defined(HELTEC_TOUCHRELAY) - // Info - #define MANUFACTURER "HELTEC" - #define DEVICE "TOUCH_RELAY" - - // Buttons - #define BUTTON1_PIN 14 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Zhilde ZLD-EU44-W @@ -2043,75 +979,21 @@ #elif defined(ZHILDE_EU44_W) - // Info - #define MANUFACTURER "ZHILDE" - #define DEVICE "EU44_W" + #define ESPURNA_IMAGE ESPURNA_BASIC // Based on the reporter, this product uses GPIO1 and 3 for the button // and onboard LED, so hardware serial should be disabled... - #define DEBUG_SERIAL_SUPPORT 0 - - // Buttons - #define BUTTON1_PIN 3 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Relays - #define RELAY1_PIN 5 - #define RELAY2_PIN 4 - #define RELAY3_PIN 12 - #define RELAY4_PIN 13 - #define RELAY5_PIN 14 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - #define RELAY3_TYPE RELAY_TYPE_NORMAL - #define RELAY4_TYPE RELAY_TYPE_NORMAL - #define RELAY5_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 1 - #define LED1_PIN_INVERSE 1 - - // ----------------------------------------------------------------------------- - // Allnet 4duino ESP8266-UP-Relais - // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/ - // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf - // ----------------------------------------------------------------------------- - -#elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS) - - // Info - #define MANUFACTURER "ALLNET" - #define DEVICE "4DUINO_IOT_WLAN_RELAIS" - - // Relays - #define RELAY1_PIN 14 - #define RELAY1_RESET_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_LATCHED - - // LEDs - #define LED1_PIN 0 - #define LED1_PIN_INVERSE 1 - - // Buttons - //#define BUTTON1_PIN 0 - //#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - - // Using pins labelled as SDA & SCL as buttons - #define BUTTON2_PIN 4 - #define BUTTON2_MODE BUTTON_PUSHBUTTON - #define BUTTON2_PRESS BUTTON_MODE_TOGGLE - #define BUTTON2_CLICK BUTTON_MODE_NONE - #define BUTTON2_DBLCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE + #define DEBUG_SERIAL_SUPPORT 0 - #define BUTTON3_PIN 5 - #define BUTTON3_MODE BUTTON_PUSHBUTTON +// ----------------------------------------------------------------------------- +// Allnet 4duino ESP8266-UP-Relais +// http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/ +// https://shop.allnet.de/fileadmin/transfer/products/148814.pdf +// ----------------------------------------------------------------------------- - // Using pins labelled as SDA & SCL for I2C - //#define I2C_SDA_PIN 4 - //#define I2C_SCL_PIN 5 +#elif defined(ALLNET_4DUINO_IOT_WLAN_RELAIS) + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Luani HVIO @@ -2121,36 +1003,7 @@ #elif defined(LUANI_HVIO) - // Info - #define MANUFACTURER "LUANI" - #define DEVICE "HVIO" - - // Buttons - #define BUTTON1_PIN 12 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_SWITCH | BUTTON_DEFAULT_HIGH //Hardware Pullup - - #define BUTTON1_PRESS BUTTON_MODE_NONE - #define BUTTON1_CLICK BUTTON_MODE_TOGGLE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_NONE - - #define BUTTON2_PIN 13 - #define BUTTON2_RELAY 2 - #define BUTTON2_MODE BUTTON_SWITCH | BUTTON_DEFAULT_HIGH //Hardware Pullup - - #define BUTTON2_CLICK BUTTON_MODE_TOGGLE - - // Relays - #define RELAY1_PIN 4 - #define RELAY2_PIN 5 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 15 - #define LED1_PIN_INVERSE 0 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Tonbux 50-100M Smart Mosquito Killer USB @@ -2159,33 +1012,7 @@ #elif defined(TONBUX_MOSQUITO_KILLER) - // Info - #define MANUFACTURER "TONBUX" - #define DEVICE "MOSQUITO_KILLER" - - // Buttons - #define BUTTON1_PIN 2 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 5 // not a relay, fan - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 15 // blue led - #define LED1_PIN_INVERSE 1 - #define LED1_MODE LED_MODE_WIFI - #define LED2_PIN 14 // red led - #define LED2_PIN_INVERSE 1 - #define LED2_MODE LED_MODE_RELAY - - #define LED3_PIN 12 // UV leds (1-2-3-4-5-6-7-8) - #define LED3_PIN_INVERSE 0 - #define LED3_RELAY 1 - #define LED4_PIN 16 // UV leds (9-10-11) - #define LED4_PIN_INVERSE 0 - #define LED4_RELAY 1 + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // NEO Coolcam NAS-WR01W Wifi Smart Power Plug @@ -2195,23 +1022,7 @@ #elif defined(NEO_COOLCAM_NAS_WR01W) - // Info - #define MANUFACTURER "NEO_COOLCAM" - #define DEVICE "NAS_WR01W" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 12 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 4 - #define LED1_PIN_INVERSE 1 - + #define ESPURNA_IMAGE ESPURNA_BASIC // ------------------------------------------------------------------------------ // Estink Wifi Power Strip @@ -2222,49 +1033,10 @@ #elif defined(ESTINK_WIFI_POWER_STRIP) - // Info - #define MANUFACTURER "ESTINK" - #define DEVICE "WIFI_POWER_STRIP" + #define ESPURNA_IMAGE ESPURNA_BASIC // Disable UART noise since this board uses GPIO3 - #define DEBUG_SERIAL_SUPPORT 0 - - // Buttons - #define BUTTON1_PIN 16 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 4 - - // Relays - #define RELAY1_PIN 14 // USB power - #define RELAY2_PIN 13 // power plug 1 - #define RELAY3_PIN 4 // power plug 2 - #define RELAY4_PIN 15 // power plug 3 - - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_TYPE RELAY_TYPE_NORMAL - #define RELAY3_TYPE RELAY_TYPE_NORMAL - #define RELAY4_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 0 // power led - #define LED2_PIN 12 // power plug 1 - #define LED3_PIN 3 // power plug 2 - #define LED4_PIN 5 // power plug 3 - - #define LED1_PIN_INVERSE 1 - #define LED2_PIN_INVERSE 1 - #define LED3_PIN_INVERSE 1 - #define LED4_PIN_INVERSE 1 - - #define LED1_MODE LED_MODE_FINDME - #define LED2_MODE LED_MODE_FOLLOW - #define LED3_MODE LED_MODE_FOLLOW - #define LED4_MODE LED_MODE_FOLLOW - - #define LED2_RELAY 2 - #define LED3_RELAY 3 - #define LED4_RELAY 4 - + #define DEBUG_SERIAL_SUPPORT 0 // ----------------------------------------------------------------------------- // Bruno Horta's OnOfre @@ -2274,23 +1046,7 @@ #elif defined(BH_ONOFRE) - // Info - #define MANUFACTURER "BH" - #define DEVICE "ONOFRE" - - // Buttons - #define BUTTON1_PIN 12 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP - #define BUTTON1_RELAY 1 - #define BUTTON2_PIN 13 - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP - #define BUTTON2_RELAY 2 - - // Relays - #define RELAY1_PIN 4 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - #define RELAY2_PIN 5 - #define RELAY2_TYPE RELAY_TYPE_NORMAL + #define ESPURNA_IMAGE ESPURNA_BASIC // ----------------------------------------------------------------------------- // Several boards under different names uing a power chip labelled BL0937 or HJL-01 @@ -2303,26 +1059,7 @@ #elif defined(BLITZWOLF_BWSHP2) - // Info - #define MANUFACTURER "BLITZWOLF" - #define DEVICE "BWSHP2" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 15 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 - #define LED2_PIN 0 - #define LED2_PIN_INVERSE 1 - #define LED2_MODE LED_MODE_FINDME - #define LED2_RELAY 1 + #define ESPURNA_IMAGE ESPURNA_POWER // HJL01 / BL0937 #ifndef HLW8012_SUPPORT @@ -2331,7 +1068,6 @@ #define HLW8012_SEL_PIN 12 #define HLW8012_CF1_PIN 14 #define HLW8012_CF_PIN 5 - #define HLW8012_SEL_CURRENT LOW #define HLW8012_CURRENT_RATIO 25740 #define HLW8012_VOLTAGE_RATIO 313400 @@ -2344,38 +1080,7 @@ // ---------------------------------------------------------------------------------------- #elif defined(HOMECUBE_16A) - // Info - #define MANUFACTURER "HOMECUBE" - #define DEVICE "16A" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 15 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - //LED Pin 4 - ESP8266 onboard LED - //Red LED: 0 - //Green LED: 12 - //Blue LED: 2 - - // Blue - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 0 - - // Green - #define LED2_PIN 12 - #define LED2_PIN_INVERSE 1 - #define LED2_MODE LED_MODE_RELAY - - // Red - #define LED3_PIN 0 - #define LED3_PIN_INVERSE 0 - #define LED2_MODE LED_MODE_OFF + #define ESPURNA_IMAGE ESPURNA_POWER // HJL01 / BL0937 #ifndef HLW8012_SUPPORT @@ -2384,7 +1089,6 @@ #define HLW8012_SEL_PIN 16 #define HLW8012_CF1_PIN 14 #define HLW8012_CF_PIN 5 - #define HLW8012_SEL_CURRENT LOW #define HLW8012_CURRENT_RATIO 25740 #define HLW8012_VOLTAGE_RATIO 313400 @@ -2399,26 +1103,7 @@ #elif defined(VANZAVANZU_SMART_WIFI_PLUG_MINI) - // Info - #define MANUFACTURER "VANZAVANZU" - #define DEVICE "SMART_WIFI_PLUG_MINI" - - // Buttons - #define BUTTON1_PIN 13 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Relays - #define RELAY1_PIN 15 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // LEDs - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 - #define LED2_PIN 0 - #define LED2_PIN_INVERSE 1 - #define LED2_MODE LED_MODE_FINDME - #define LED2_RELAY 1 + #define ESPURNA_IMAGE ESPURNA_POWER // Disable UART noise #define DEBUG_SERIAL_SUPPORT 0 @@ -2430,7 +1115,6 @@ #define HLW8012_SEL_PIN 3 #define HLW8012_CF1_PIN 14 #define HLW8012_CF_PIN 5 - #define HLW8012_SEL_CURRENT LOW #define HLW8012_CURRENT_RATIO 25740 #define HLW8012_VOLTAGE_RATIO 313400 @@ -2439,41 +1123,11 @@ #elif defined(GENERIC_AG_L4) + #define ESPURNA_IMAGE ESPURNA_LIGHT + // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "AG_L4" #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER - #define DUMMY_RELAY_COUNT 1 - - // button 1: "power" button - #define BUTTON1_PIN 4 - #define BUTTON1_RELAY 1 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_SET_PULLUP | BUTTON_DEFAULT_HIGH - #define BUTTON1_PRESS BUTTON_MODE_TOGGLE - #define BUTTON1_CLICK BUTTON_MODE_NONE - #define BUTTON1_DBLCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGCLICK BUTTON_MODE_NONE - #define BUTTON1_LNGLNGCLICK BUTTON_MODE_RESET - - // button 2: "wifi" button - #define BUTTON2_PIN 2 - #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON2_PRESS BUTTON_MODE_TOGGLE - #define BUTTON2_CLICK BUTTON_MODE_NONE - #define BUTTON2_DBLCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGCLICK BUTTON_MODE_NONE - #define BUTTON2_LNGLNGCLICK BUTTON_MODE_NONE - - // LEDs - #define LED1_PIN 5 // red status led - #define LED1_PIN_INVERSE 0 - - #define LED2_PIN 16 // master light power - #define LED2_PIN_INVERSE 1 - #define LED2_MODE LED_MODE_RELAY - - // Light #define LIGHT_CHANNELS 3 #define LIGHT_CH1_PIN 14 // RED #define LIGHT_CH2_PIN 13 // GREEN @@ -2487,9 +1141,7 @@ #elif defined(GENERIC_GEIGER_COUNTER) - // Info - #define MANUFACTURER "GENERIC" - #define DEVICE "GEIGER_COUNTER" + #define ESPURNA_IMAGE ESPURNA_GEIGER // Enable Geiger Counter #define GEIGER_SUPPORT 1 @@ -2504,23 +1156,6 @@ #elif defined(TRAVIS01) - // Info - #define MANUFACTURER "TravisCI" - #define DEVICE "Virtual board 01" - - // Some buttons - pin 0 - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - - // Some relays - pin 1 - #define RELAY1_PIN 1 - #define RELAY1_TYPE RELAY_TYPE_NORMAL - - // Some LEDs - pin 2 - #define LED1_PIN 2 - #define LED1_PIN_INVERSE 1 - // A bit of I2C - pins 3,4 #define I2C_SDA_PIN 3 #define I2C_SCL_PIN 4 @@ -2576,15 +1211,6 @@ #elif defined(TRAVIS02) - // Relay provider dual - #define MANUFACTURER "TravisCI" - #define DEVICE "Virtual board 02" - - // Some buttons - pin 0 - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - // A bit of CSE7766 - pin 1 #ifndef CSE7766_SUPPORT #define CSE7766_SUPPORT 1 @@ -2648,15 +1274,6 @@ #elif defined(TRAVIS03) - // Relay provider light/my92XX - #define MANUFACTURER "TravisCI" - #define DEVICE "Virtual board 03" - - // Some buttons - pin 0 - #define BUTTON1_PIN 0 - #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH - #define BUTTON1_RELAY 1 - // MY9231 Light - pins 1,2 #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT #define LIGHT_PROVIDER LIGHT_PROVIDER_MY92XX @@ -2679,12 +1296,39 @@ #define NETBIOS_SUPPORT 1 #define SSDP_SUPPORT 1 -#endif - // ----------------------------------------------------------------------------- -// Check definitions +// ESPurna Core // ----------------------------------------------------------------------------- -//#if not defined(MANUFACTURER) || not defined(DEVICE) -// #error "UNSUPPORTED HARDWARE!!" -//#endif +#else + + // This is a special device targeted to generate a light-weight binary image + // meant to be able to do two-step-updates: + // https://github.com/xoseperez/espurna/wiki/TwoStepUpdates + + #define ESPURNA_IMAGE ESPURNA_CORE + + // Disable non-core modules + #define ALEXA_SUPPORT 0 + #define BROKER_SUPPORT 0 + #define BUTTON_SUPPORT 0 + #define DOMOTICZ_SUPPORT 0 + #define HOMEASSISTANT_SUPPORT 0 + #define I2C_SUPPORT 0 + #define MDNS_SERVER_SUPPORT 0 + #define MQTT_SUPPORT 0 + #define NTP_SUPPORT 0 + #define SCHEDULER_SUPPORT 0 + #define SENSOR_SUPPORT 0 + #define THINGSPEAK_SUPPORT 0 + #define WEB_SUPPORT 0 + + // Extra light-weight image + //#define DEBUG_SERIAL_SUPPORT 0 + //#define DEBUG_TELNET_SUPPORT 0 + //#define DEBUG_WEB_SUPPORT 0 + //#define LED_SUPPORT 0 + //#define TELNET_SUPPORT 0 + //#define TERMINAL_SUPPORT 0 + +#endif diff --git a/code/espurna/config/types.h b/code/espurna/config/types.h index 36416c6e..d3141e67 100644 --- a/code/espurna/config/types.h +++ b/code/espurna/config/types.h @@ -3,6 +3,21 @@ // Do not touch this definitions //------------------------------------------------------------------------------ +// ----------------------------------------------------------------------------- +// IMAGES +// ----------------------------------------------------------------------------- + +#define ESPURNA_CORE 0 // minimal +#define ESPURNA_BASIC 1 // relay, button, led +#define ESPURNA_LIGHT 2 // ESPURNA_BASIC + light drivers +#define ESPURNA_POWER 3 // ESPURNA_BASIC + power monitoring sensors +#define ESPURNA_SENSOR 4 // ESPURNA_BASIC + basic sensors +#define ESPURNA_SONOFF_DUAL 10 // Device specific +#define ESPURNA_SONOFF_RFBRIDGE 11 // Device specific +#define ESPURNA_RFM69 12 // Device specific +#define ESPURNA_STM 13 // Device specific +#define ESPURNA_GEIGER 14 // Device specific + // ----------------------------------------------------------------------------- // WIFI // ----------------------------------------------------------------------------- diff --git a/code/espurna/hardware.ino b/code/espurna/hardware.ino index 92d0a30e..53d35e84 100644 --- a/code/espurna/hardware.ino +++ b/code/espurna/hardware.ino @@ -6,72 +6,33 @@ Copyright (C) 2016-2018 by Xose Pérez */ -void _hardwareMigrateMoveIndexDown(const char * key, int offset = 0) { - if (hasSetting(key, 0)) return; - for (unsigned char index = 1; index < SETTINGS_MAX_LIST_COUNT; index++) { - if (hasSetting(key, index)) { - setSetting(key, index - 1, getSetting(key, index).toInt() + offset); - } else { - delSetting(key, index - 1); - } - } -} - -// Configuration versions +// ----------------------------------------------------------------------------- +// Configuration HELP +// ----------------------------------------------------------------------------- // -// 1: based on Embedis, no board definitions -// 2: based on Embedis, with board definitions 1-based -// 3: based on Embedis, with board definitions 0-based -// 4: based on Embedis, added sensors and force resetting - -void _hardwareMigrate() { - - moveSetting("boardName", "device"); - moveSettings("relayGPIO", "rlyGPIO"); - moveSettings("relayResetGPIO", "rlyResetGPIO"); - moveSettings("relayType", "rlyType"); - moveSetting("selGPIO", "hlwSELGPIO"); - moveSetting("cfGPIO", "hlwCFGPIO"); - moveSetting("cf1GPIO", "hlwCF1GPIO"); - moveSetting("relayProvider", "rlyProvider"); - moveSetting("lightProvider", "litProvider"); - moveSetting("relays", "rlyDummy"); - moveSettings("chGPIO", "litChGPIO"); - moveSettings("chLogic", "litChLogic"); - moveSetting("enGPIO", "litEnableGPIO"); - moveSetting("hlwSelC", "hlwCurLevel"); - moveSetting("hlwIntM", "hlwInt"); - delSetting("ledWifi"); - - // Get config version - unsigned int board = getSetting("board", 0).toInt(); - unsigned int config_version = getSetting("cfg", board > 0 ? 2 : 1).toInt(); - setSetting("cfg", CFG_VERSION); - - if (config_version == 2) { - _hardwareMigrateMoveIndexDown("ledGPIO"); - _hardwareMigrateMoveIndexDown("ledLogic"); - _hardwareMigrateMoveIndexDown("btnGPIO"); - _hardwareMigrateMoveIndexDown("btnRelay", -1); - _hardwareMigrateMoveIndexDown("rlyGPIO"); - _hardwareMigrateMoveIndexDown("rlyType"); - } - -} - -/* -void _hardwareLoad() { - #ifndef ESPURNA_CORE - char buffer[device_config_len+1]; - strncpy_P(buffer, (const char *) device_config, device_config_len); - buffer[device_config_len] = 0; - DynamicJsonBuffer jsonBuffer; - JsonObject& json = jsonBuffer.parseObject(buffer); - json["app"] = APP_NAME; - settingsRestoreJson(json); - #endif -} -*/ +// Configuration settings for each device, the most common ones are: +// +// board: ID of the board according to XXX +// device: Name of the device ("string") +// btnGPIO : GPIO for the n-th button (0-based) +// btnRelay : Relay index linked to the n-th button +// btnMode : Mode for the n-th button, can be a sum of: +// - BUTTON_PUSHBUTTON: button event is fired when released +// - BUTTON_SWITCH: button event is fired when pressed or released +// - BUTTON_DEFAULT_HIGH: there is a pull up in place +// - BUTTON_SET_PULLUP: set pullup by software +// rlyGPIO : GPIO for the n-th relay (0-based) +// rlyType : Type of the n-th relaym can be on of: +// - RELAY_TYPE_NORMAL +// - RELAY_TYPE_INVERSE +// - RELAY_TYPE_LATCHED +// - RELAY_TYPE_LATCHED_INVERSE +// ledGPIO : GPIO for the n-th LED (0-based) +// ledLogic : GPIO_LOGIC_DIRECT or GPIO_LOGIC_INVERSE +// ledMode : Mode for the n-th LED, check types.h for LED_MODE_% +// ledRelay : Relay linked to the n-th LED +// +// Besides, other hardware specific information can be added to any device void _hardwareLoad() { @@ -81,7 +42,7 @@ void _hardwareLoad() { #if defined(NODEMCU_LOLIN) - setSetting("board", 2); + setSetting("board", BOARD_NODEMCU_LOLIN); setSetting("device", "NODEMCU_LOLIN"); setSetting("btnGPIO", 0, 0); @@ -96,7 +57,7 @@ void _hardwareLoad() { #elif defined(WEMOS_D1_MINI_RELAYSHIELD) - setSetting("board", 3); + setSetting("board", BOARD_WEMOS_D1_MINI_RELAYSHIELD); setSetting("device", "WEMOS_D1_MINI_RELAYSHIELD"); setSetting("btnGPIO", 0, 0); @@ -111,7 +72,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_BASIC) - setSetting("board", 4); + setSetting("board", BOARD_ITEAD_SONOFF_BASIC); setSetting("device", "ITEAD_SONOFF_BASIC"); setSetting("btnGPIO", 0, 0); @@ -126,7 +87,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_TH) - setSetting("board", 5); + setSetting("board", BOARD_ITEAD_SONOFF_TH); setSetting("device", "ITEAD_SONOFF_TH"); setSetting("btnGPIO", 0, 0); @@ -147,7 +108,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_SV) - setSetting("board", 6); + setSetting("board", BOARD_ITEAD_SONOFF_SV); setSetting("device", "ITEAD_SONOFF_SV"); setSetting("btnGPIO", 0, 0); @@ -162,7 +123,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_TOUCH) - setSetting("board", 7); + setSetting("board", BOARD_ITEAD_SONOFF_TOUCH); setSetting("device", "ITEAD_SONOFF_TOUCH"); setSetting("btnGPIO", 0, 0); @@ -182,7 +143,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_POW) - setSetting("board", 8); + setSetting("board", BOARD_ITEAD_SONOFF_POW); setSetting("device", "ITEAD_SONOFF_POW"); setSetting("btnGPIO", 0, 0); @@ -202,7 +163,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_DUAL) - setSetting("board", 9); + setSetting("board", BOARD_ITEAD_SONOFF_DUAL); setSetting("device", "ITEAD_SONOFF_DUAL"); setSetting("btnRelay", 0, GPIO_NONE); @@ -229,7 +190,7 @@ void _hardwareLoad() { // You can still use the pulse options from the web interface // without problem. - setSetting("board", 10); + setSetting("board", BOARD_ITEAD_1CH_INCHING); setSetting("device", "ITEAD_1CH_INCHING"); setSetting("btnGPIO", 0, 0); @@ -244,7 +205,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_4CH) - setSetting("board", 11); + setSetting("board", BOARD_ITEAD_SONOFF_4CH); setSetting("device", "ITEAD_SONOFF_4CH"); setSetting("btnGPIO", 0, 0); @@ -274,7 +235,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SLAMPHER) - setSetting("board", 12); + setSetting("board", BOARD_ITEAD_SLAMPHER); setSetting("device", "ITEAD_SLAMPHER"); setSetting("btnGPIO", 0, 0); @@ -289,7 +250,7 @@ void _hardwareLoad() { #elif defined(ITEAD_S20) - setSetting("board", 13); + setSetting("board", BOARD_ITEAD_S20); setSetting("device", "ITEAD_S20"); setSetting("btnGPIO", 0, 0); @@ -304,7 +265,7 @@ void _hardwareLoad() { #elif defined(ELECTRODRAGON_WIFI_IOT) - setSetting("board", 14); + setSetting("board", BOARD_ELECTRODRAGON_WIFI_IOT); setSetting("device", "ELECTRODRAGON_WIFI_IOT"); setSetting("btnGPIO", 0, 0); @@ -324,7 +285,7 @@ void _hardwareLoad() { #elif defined(WORKCHOICE_ECOPLUG) - setSetting("board", 15); + setSetting("board", BOARD_WORKCHOICE_ECOPLUG); setSetting("device", "WORKCHOICE_ECOPLUG"); setSetting("btnGPIO", 0, 13); @@ -342,7 +303,7 @@ void _hardwareLoad() { // Jan Goedeke Wifi Relay // https://github.com/JanGoe/esp8266-wifi-relay - setSetting("board", 16); + setSetting("board", BOARD_JANGOE_WIFI_RELAY_NC); setSetting("device", "JANGOE_WIFI_RELAY_NC"); setSetting("btnGPIO", 0, 12); @@ -359,7 +320,7 @@ void _hardwareLoad() { #elif defined(JANGOE_WIFI_RELAY_NO) - setSetting("board", 17); + setSetting("board", BOARD_JANGOE_WIFI_RELAY_NO); setSetting("device", "JANGOE_WIFI_RELAY_NO"); setSetting("btnGPIO", 0, 12); @@ -376,7 +337,7 @@ void _hardwareLoad() { #elif defined(OPENENERGYMONITOR_MQTT_RELAY) - setSetting("board", 18); + setSetting("board", BOARD_OPENENERGYMONITOR_MQTT_RELAY); setSetting("device", "OPENENERGYMONITOR_MQTT_RELAY"); setSetting("btnGPIO", 0, 0); @@ -395,7 +356,7 @@ void _hardwareLoad() { // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit // https://github.com/jorgegarciadev/wifikit - setSetting("board", 19); + setSetting("board", BOARD_JORGEGARCIA_WIFI_RELAYS); setSetting("device", "JORGEGARCIA_WIFI_RELAYS"); setSetting("rlyGPIO", 0, 0); @@ -405,7 +366,7 @@ void _hardwareLoad() { #elif defined(AITHINKER_AI_LIGHT) - setSetting("board", 20); + setSetting("board", BOARD_AITHINKER_AI_LIGHT); setSetting("device", "AITHINKER_AI_LIGHT"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -421,7 +382,7 @@ void _hardwareLoad() { #elif defined(MAGICHOME_LED_CONTROLLER) - setSetting("board", 21); + setSetting("board", BOARD_MAGICHOME_LED_CONTROLLER); setSetting("device", "MAGICHOME_LED_CONTROLLER"); setSetting("ledGPIO", 0, 2); @@ -446,7 +407,7 @@ void _hardwareLoad() { #elif defined(ITEAD_MOTOR) - setSetting("board", 22); + setSetting("board", BOARD_ITEAD_MOTOR); setSetting("device", "ITEAD_MOTOR"); setSetting("btnGPIO", 0, 0); @@ -461,7 +422,7 @@ void _hardwareLoad() { #elif defined(TINKERMAN_ESPURNA_H06) - setSetting("board", 23); + setSetting("board", BOARD_TINKERMAN_ESPURNA_H06); setSetting("device", "TINKERMAN_ESPURNA_H06"); setSetting("btnGPIO", 0, 4); @@ -481,7 +442,7 @@ void _hardwareLoad() { #elif defined(HUACANXING_H801) - setSetting("board", 24); + setSetting("board", BOARD_HUACANXING_H801); setSetting("device", "HUACANXING_H801"); setSetting("ledGPIO", 0, 5); @@ -506,7 +467,7 @@ void _hardwareLoad() { #elif defined(ITEAD_BNSZ01) - setSetting("board", 25); + setSetting("board", BOARD_ITEAD_BNSZ01); setSetting("device", "ITEAD_BNSZ01"); setSetting("ledGPIO", 0, 13); @@ -521,7 +482,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_RFBRIDGE) - setSetting("board", 26); + setSetting("board", BOARD_ITEAD_SONOFF_RFBRIDGE); setSetting("device", "ITEAD_SONOFF_RFBRIDGE"); setSetting("btnGPIO", 0, 0); @@ -545,7 +506,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_4CH_PRO) - setSetting("board", 27); + setSetting("board", BOARD_ITEAD_SONOFF_4CH_PRO); setSetting("device", "ITEAD_SONOFF_4CH_PRO"); setSetting("btnGPIO", 0, 0); @@ -606,7 +567,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_B1) - setSetting("board", 28); + setSetting("board", BOARD_ITEAD_SONOFF_B1); setSetting("device", "ITEAD_SONOFF_B1"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -624,7 +585,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_LED) - setSetting("board", 29); + setSetting("board", BOARD_ITEAD_SONOFF_LED); setSetting("device", "ITEAD_SONOFF_LED"); setSetting("ledGPIO", 0, 13); @@ -641,7 +602,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_T1_1CH) - setSetting("board", 30); + setSetting("board", BOARD_ITEAD_SONOFF_T1_1CH); setSetting("device", "ITEAD_SONOFF_T1_1CH"); setSetting("btnGPIO", 0, 0); @@ -662,7 +623,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_T1_2CH) - setSetting("board", 31); + setSetting("board", BOARD_ITEAD_SONOFF_T1_2CH); setSetting("device", "ITEAD_SONOFF_T1_2CH"); setSetting("btnGPIO", 0, 0); @@ -693,7 +654,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_T1_3CH) - setSetting("board", 32); + setSetting("board", BOARD_ITEAD_SONOFF_T1_3CH); setSetting("device", "ITEAD_SONOFF_T1_3CH"); setSetting("btnGPIO", 0, 0); @@ -734,7 +695,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_RF) - setSetting("board", 33); + setSetting("board", BOARD_ITEAD_SONOFF_RF); setSetting("device", "ITEAD_SONOFF_RF"); setSetting("btnGPIO", 0, 0); @@ -754,7 +715,7 @@ void _hardwareLoad() { // 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 // Does not support power monitoring yet - setSetting("board", 34); + setSetting("board", BOARD_WION_50055); setSetting("device", "WION_50055"); setSetting("btnGPIO", 0, 13); @@ -772,7 +733,7 @@ void _hardwareLoad() { // EX-Store Wifi Relay v3.1 // https://ex-store.de/ESP8266-WiFi-Relay-V31 - setSetting("board", 35); + setSetting("board", BOARD_EXS_WIFI_RELAY_V31); setSetting("device", "EXS_WIFI_RELAY_V31"); setSetting("btnGPIO", 0, 0); @@ -785,7 +746,7 @@ void _hardwareLoad() { #elif defined(HUACANXING_H802) - setSetting("board", 36); + setSetting("board", BOARD_HUACANXING_H802); setSetting("device", "HUACANXING_H802"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -805,7 +766,7 @@ void _hardwareLoad() { #elif defined(GENERIC_V9261F) - setSetting("board", 37); + setSetting("board", BOARD_GENERIC_V9261F); setSetting("device", "GENERIC_V9261F"); setSetting("v92Enabled", 1); @@ -814,7 +775,7 @@ void _hardwareLoad() { #elif defined(GENERIC_ECH1560) - setSetting("board", 38); + setSetting("board", BOARD_GENERIC_ECH1560); setSetting("device", "GENERIC_ECH1560"); setSetting("echEnabled", 1); @@ -824,7 +785,7 @@ void _hardwareLoad() { #elif defined(TINKERMAN_ESPURNA_H08) - setSetting("board", 39); + setSetting("board", BOARD_TINKERMAN_ESPURNA_H08); setSetting("device", "TINKERMAN_ESPURNA_H08"); setSetting("btnGPIO", 0, 4); @@ -847,7 +808,7 @@ void _hardwareLoad() { // ESPLive // https://github.com/ManCaveMade/ESP-Live - setSetting("board", 40); + setSetting("board", BOARD_MANCAVEMADE_ESPLIVE); setSetting("device", "MANCAVEMADE_ESPLIVE"); setSetting("btnGPIO", 0, 4); @@ -875,7 +836,7 @@ void _hardwareLoad() { // QuinLED // http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html - setSetting("board", 41); + setSetting("board", BOARD_INTERMITTECH_QUINLED); setSetting("device", "INTERMITTECH_QUINLED"); setSetting("ledGPIO", 0, 5); @@ -892,7 +853,7 @@ void _hardwareLoad() { #elif defined(MAGICHOME_LED_CONTROLLER_20) - setSetting("board", 42); + setSetting("board", BOARD_MAGICHOME_LED_CONTROLLER_20); setSetting("device", "MAGICHOME_LED_CONTROLLER_20"); setSetting("ledGPIO", 0, 2); @@ -917,7 +878,7 @@ void _hardwareLoad() { #elif defined(ARILUX_AL_LC06) - setSetting("board", 43); + setSetting("board", BOARD_ARILUX_AL_LC06); setSetting("device", "ARILUX_AL_LC06"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -937,7 +898,7 @@ void _hardwareLoad() { #elif defined(XENON_SM_PW702U) - setSetting("board", 44); + setSetting("board", BOARD_XENON_SM_PW702U); setSetting("device", "XENON_SM_PW702U"); setSetting("btnGPIO", 0, 13); @@ -955,7 +916,7 @@ void _hardwareLoad() { // AUTHOMETION LYT8266 // https://authometion.com/shop/en/home/13-lyt8266.html - setSetting("board", 45); + setSetting("board", BOARD_AUTHOMETION_LYT8266); setSetting("device", "AUTHOMETION_LYT8266"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -975,7 +936,7 @@ void _hardwareLoad() { #elif defined(ARILUX_E27) - setSetting("board", 46); + setSetting("board", BOARD_ARILUX_E27); setSetting("device", "ARILUX_E27"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -991,7 +952,7 @@ void _hardwareLoad() { #elif defined(YJZK_SWITCH_2CH) - setSetting("board", 47); + setSetting("board", BOARD_YJZK_SWITCH_2CH); setSetting("device", "YJZK_SWITCH_2CH"); setSetting("btnGPIO", 0, 0); @@ -1011,7 +972,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_DUAL_R2) - setSetting("board", 48); + setSetting("board", BOARD_ITEAD_SONOFF_DUAL_R2); setSetting("device", "ITEAD_SONOFF_DUAL_R2"); setSetting("btnGPIO", 0, 0); @@ -1035,7 +996,7 @@ void _hardwareLoad() { #elif defined(GENERIC_8CH) - setSetting("board", 49); + setSetting("board", BOARD_GENERIC_8CH); setSetting("device", "GENERIC_8CH"); setSetting("rlyGPIO", 0, 0); @@ -1057,7 +1018,7 @@ void _hardwareLoad() { #elif defined(ARILUX_AL_LC01) - setSetting("board", 50); + setSetting("board", BOARD_ARILUX_AL_LC01); setSetting("device", "ARILUX_AL_LC01"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -1073,7 +1034,7 @@ void _hardwareLoad() { #elif defined(ARILUX_AL_LC11) - setSetting("board", 51); + setSetting("board", BOARD_ARILUX_AL_LC11); setSetting("device", "ARILUX_AL_LC11"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -1093,7 +1054,7 @@ void _hardwareLoad() { #elif defined(ARILUX_AL_LC02) - setSetting("board", 52); + setSetting("board", BOARD_ARILUX_AL_LC02); setSetting("device", "ARILUX_AL_LC02"); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); @@ -1114,7 +1075,7 @@ void _hardwareLoad() { // KMC 70011 // https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B - setSetting("board", 53); + setSetting("board", BOARD_KMC_70011); setSetting("device", "KMC_70011"); setSetting("btnGPIO", 0, 0); @@ -1135,7 +1096,7 @@ void _hardwareLoad() { #elif defined(GIZWITS_WITTY_CLOUD) - setSetting("board", 54); + setSetting("board", BOARD_GIZWITS_WITTY_CLOUD); setSetting("device", "GIZWITS_WITTY_CLOUD"); setSetting("btnGPIO", 0, 4); @@ -1173,7 +1134,7 @@ void _hardwareLoad() { // So @Geitde hack is still the only possible // Hack: drive GPIO12 low and use GPIO5 as normal relay pin: - setSetting("board", 55); + setSetting("board", BOARD_EUROMATE_WIFI_STECKER_SCHUKO); setSetting("device", "EUROMATE_WIFI_STECKER_SCHUKO"); setSetting("btnGPIO", 0, 14); @@ -1190,7 +1151,7 @@ void _hardwareLoad() { #elif defined(TONBUX_POWERSTRIP02) - setSetting("board", 56); + setSetting("board", BOARD_TONBUX_POWERSTRIP02); setSetting("device", "TONBUX_POWERSTRIP02"); setSetting("btnGPIO", 0, 5); @@ -1215,7 +1176,7 @@ void _hardwareLoad() { #elif defined(LINGAN_SWA1) - setSetting("board", 57); + setSetting("board", BOARD_LINGAN_SWA1); setSetting("device", "LINGAN_SWA1"); setSetting("btnGPIO", 0, 13); @@ -1230,7 +1191,7 @@ void _hardwareLoad() { #elif defined(HEYGO_HY02) - setSetting("board", 58); + setSetting("board", BOARD_HEYGO_HY02); setSetting("device", "HEYGO_HY02"); setSetting("btnGPIO", 0, 13); @@ -1245,7 +1206,7 @@ void _hardwareLoad() { #elif defined(MAXCIO_WUS002S) - setSetting("board", 59); + setSetting("board", BOARD_MAXCIO_WUS002S); setSetting("device", "MAXCIO_WUS002S"); setSetting("btnGPIO", 0, 2); @@ -1267,7 +1228,7 @@ void _hardwareLoad() { #elif defined(YIDIAN_XSSSA05) - setSetting("board", 60); + setSetting("board", BOARD_YIDIAN_XSSSA05); setSetting("device", "YIDIAN_XSSSA05"); setSetting("btnGPIO", 0, 13); @@ -1290,7 +1251,7 @@ void _hardwareLoad() { #elif defined(TONBUX_XSSSA06) - setSetting("board", 61); + setSetting("board", BOARD_TONBUX_XSSSA06); setSetting("device", "TONBUX_XSSSA06"); setSetting("btnGPIO", 0, 13); @@ -1312,7 +1273,7 @@ void _hardwareLoad() { // GREEN ESP8266 RELAY MODULE // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180323113846&SearchText=Green+ESP8266 - setSetting("board", 62); + setSetting("board", BOARD_GREEN_ESP8266RELAY); setSetting("device", "GREEN_ESP8266RELAY"); setSetting("btnGPIO", 0, 5); @@ -1330,7 +1291,7 @@ void _hardwareLoad() { // Henrique Gravina ESPIKE // https://github.com/Henriquegravina/Espike - setSetting("board", 63); + setSetting("board", BOARD_IKE_ESPIKE); setSetting("device", "IKE_ESPIKE"); setSetting("btnGPIO", 0, 13); @@ -1361,7 +1322,7 @@ void _hardwareLoad() { // SWIFITCH // https://github.com/ArnieX/swifitch - setSetting("board", 64); + setSetting("board", BOARD_ARNIEX_SWIFITCH); setSetting("device", "ARNIEX_SWIFITCH"); setSetting("btnGPIO", 0, 4); @@ -1384,7 +1345,7 @@ void _hardwareLoad() { // ESP-01S RELAY v4.0 // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay - setSetting("board", 65); + setSetting("board", BOARD_GENERIC_ESP01S_RELAY_V40); setSetting("device", "GENERIC_ESP01S_RELAY_V40"); setSetting("ledGPIO", 0, 2); @@ -1398,7 +1359,7 @@ void _hardwareLoad() { // ESP-01S RGB LED v1.0 (some sold with ws2818) // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404023816&SearchText=esp-01s+led+controller - setSetting("board", 66); + setSetting("board", BOARD_GENERIC_ESP01S_RGBLED_V10); setSetting("device", "GENERIC_ESP01S_RGBLED_V10"); setSetting("ledGPIO", 0, 2); @@ -1409,7 +1370,7 @@ void _hardwareLoad() { // Heltec Touch Relay // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+touch+relay - setSetting("board", 67); + setSetting("board", BOARD_HELTEC_TOUCHRELAY); setSetting("device", "HELTEC_TOUCHRELAY"); setSetting("btnGPIO", 0, 14); @@ -1424,7 +1385,7 @@ void _hardwareLoad() { // ESP-01S DHT11 v1.0 // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11 - setSetting("board", 68); + setSetting("board", BOARD_GENERIC_ESP01S_DHT11_V10); setSetting("device", "GENERIC_ESP01S_DHT11_V10"); setSetting("dhtEnabled", 1); @@ -1436,7 +1397,7 @@ void _hardwareLoad() { // ESP-01S DS18B20 v1.0 // https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20 - setSetting("board", 69); + setSetting("board", BOARD_GENERIC_ESP01S_DS18B20_V10); setSetting("device", "GENERIC_ESP01S_DS18B20_V10"); setSetting("dsEnabled", 1); @@ -1447,7 +1408,7 @@ void _hardwareLoad() { // Zhilde ZLD-EU44-W // http://www.zhilde.com/product/60705150109-805652505/EU_WiFi_Surge_Protector_Extension_Socket_4_Outlets_works_with_Amazon_Echo_Smart_Power_Strip.html - setSetting("board", 70); + setSetting("board", BOARD_ZHILDE_EU44_W); setSetting("device", "ZHILDE_EU44_W"); setSetting("btnGPIO", 0, 3); @@ -1474,7 +1435,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_POW_R2) - setSetting("board", 71); + setSetting("board", BOARD_ITEAD_SONOFF_POW_R2); setSetting("device", "ITEAD_SONOFF_POW_R2"); setSetting("btnGPIO", 0, 0); @@ -1498,7 +1459,7 @@ void _hardwareLoad() { // https://luani.de/projekte/esp8266-hvio/ // https://luani.de/blog/esp8266-230v-io-modul/ - setSetting("board", 72); + setSetting("board", BOARD_LUANI_HVIO); setSetting("device", "LUANI_HVIO"); setSetting("ledGPIO", 0, 15); @@ -1523,7 +1484,7 @@ void _hardwareLoad() { // http://www.allnet.de/de/allnet-brand/produkte/neuheiten/p/allnet-4duino-iot-wlan-relais-unterputz-esp8266-up-relais/ // https://shop.allnet.de/fileadmin/transfer/products/148814.pdf - setSetting("board", 73); + setSetting("board", BOARD_ALLNET_4DUINO_IOT_WLAN_RELAIS); setSetting("device", "ALLNET_4DUINO_IOT_WLAN_RELAIS"); setSetting("ledGPIO", 0, 0); @@ -1538,7 +1499,7 @@ void _hardwareLoad() { // Tonbux 50-100M Smart Mosquito Killer USB // https://www.aliexpress.com/item/Original-Tonbux-50-100M-Smart-Mosquito-Killer-USB-Plug-No-Noise-Repellent-App-Smart-Module/32859330820.html - setSetting("board", 74); + setSetting("board", BOARD_TONBUX_MOSQUITO_KILLER); setSetting("device", "TONBUX_MOSQUITO_KILLER"); setSetting("btnGPIO", 0, 2); @@ -1566,7 +1527,7 @@ void _hardwareLoad() { // https://es.aliexpress.com/item/-/32854589733.html?spm=a219c.12010608.0.0.6d084e68xX0y5N // https://www.fasttech.com/product/9649426-neo-coolcam-nas-wr01w-wifi-smart-power-plug-eu - setSetting("board", 75); + setSetting("board", BOARD_NEO_COOLCAM_NAS_WR01W); setSetting("device", "NEO_COOLCAM_NAS_WR01W"); setSetting("btnGPIO", 0, 13); @@ -1579,12 +1540,12 @@ void _hardwareLoad() { setSetting("rlyGPIO", 0, 12); setSetting("rlyType", 0, RELAY_TYPE_NORMAL); - #elif defined(PILOTAK_ESP_DIN_V1) + #elif defined(PILOTAK_ESP_DIN_V1) - // ESP-DIN relay board V1 - // https://github.com/pilotak/esp_din + // ESP-DIN relay board V1 + // https://github.com/pilotak/esp_din - setSetting("board", 76); + setSetting("board", BOARD_PILOTAK_ESP_DIN_V1); setSetting("device", "PILOTAK_ESP_DIN_V1"); setSetting("btnGPIO", 0, 0); @@ -1620,7 +1581,7 @@ void _hardwareLoad() { // Fornorm Wi-Fi USB Extension Socket (ZLD-34EU) // https://www.aliexpress.com/item/Fornorm-WiFi-Extension-Socket-with-Surge-Protector-Smart-Power-Strip-3-Outlets-and-4-USB-Charging/32849743948.html - setSetting("board", 77); + setSetting("board", BOARD_ESTINK_WIFI_POWER_STRIP); setSetting("device", "ESTINK_WIFI_POWER_STRIP"); setSetting("btnGPIO", 0, 16); @@ -1660,7 +1621,7 @@ void _hardwareLoad() { // https://www.bhonofre.pt/ // https://github.com/brunohorta82/BH_OnOfre/ - setSetting("board", 78); + setSetting("board", BOARD_BH_ONOFRE); setSetting("device", "BH_ONOFRE"); setSetting("btnGPIO", 0, 12); @@ -1684,7 +1645,7 @@ void _hardwareLoad() { // * Goosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5) // * Ablue (https://www.amazon.de/Intelligente-Steckdose-Ablue-Funktioniert-Assistant/dp/B076DRFRZC) - setSetting("board", 79); + setSetting("board", BOARD_BLITZWOLF_BWSHP2); setSetting("device", "BLITZWOLF_BWSHP2"); setSetting("btnGPIO", 0, 13); @@ -1714,7 +1675,7 @@ void _hardwareLoad() { #elif defined(TINKERMAN_ESPURNA_SWITCH) - setSetting("board", 80); + setSetting("board", BOARD_TINKERMAN_ESPURNA_SWITCH); setSetting("device", "TINKERMAN_ESPURNA_SWITCH"); setSetting("btnGPIO", 0, 4); @@ -1734,7 +1695,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_S31) - setSetting("board", 81); + setSetting("board", BOARD_ITEAD_SONOFF_S31); setSetting("device", "ITEAD_SONOFF_S31"); setSetting("btnGPIO", 0, 0); @@ -1754,7 +1715,7 @@ void _hardwareLoad() { #elif defined(STM_RELAY) - setSetting("board", 82); + setSetting("board", BOARD_STM_RELAY); setSetting("device", "STM_RELAY"); setSetting("rlyDummy", 2); @@ -1767,7 +1728,7 @@ void _hardwareLoad() { // VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01) // https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5 - setSetting("board", 83); + setSetting("board", BOARD_VANZAVANZU_SMART_WIFI_PLUG_MINI); setSetting("device", "VANZAVANZU_SMART_WIFI_PLUG_MINI"); setSetting("btnGPIO", 0, 13); @@ -1796,7 +1757,7 @@ void _hardwareLoad() { #elif defined(GENERIC_GEIGER_COUNTER) - setSetting("board", 84); + setSetting("board", BOARD_GENERIC_GEIGER_COUNTER); setSetting("device", "GENERIC_GEIGER_COUNTER"); setSetting("geiEnabled", 1); @@ -1805,7 +1766,7 @@ void _hardwareLoad() { // Check http://tinkerman.cat/rfm69-wifi-gateway/ - setSetting("board", 85); + setSetting("board", BOARD_TINKERMAN_RFM69GW); setSetting("device", "TINKERMAN_RFM69GW"); setSetting("btnGPIO", 0, 0); @@ -1818,7 +1779,7 @@ void _hardwareLoad() { #elif defined(ITEAD_SONOFF_IFAN02) - setSetting("board", 86); + setSetting("board", BOARD_ITEAD_SONOFF_IFAN02); setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 1, 9); @@ -1840,7 +1801,7 @@ void _hardwareLoad() { #elif defined(GENERIC_AG_L4) - setSetting("board", 87); + setSetting("board", BOARD_GENERIC_AG_L4); setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 1, 2); @@ -1872,6 +1833,59 @@ void _hardwareLoad() { } +void _hardwareMigrateMoveIndexDown(const char * key, int offset = 0) { + if (hasSetting(key, 0)) return; + for (unsigned char index = 1; index < SETTINGS_MAX_LIST_COUNT; index++) { + if (hasSetting(key, index)) { + setSetting(key, index - 1, getSetting(key, index).toInt() + offset); + } else { + delSetting(key, index - 1); + } + } +} + +// Configuration versions +// +// 1: based on Embedis, no board definitions +// 2: based on Embedis, with board definitions 1-based +// 3: based on Embedis, with board definitions 0-based +// 4: based on Embedis, added sensors and force resetting + +void _hardwareMigrate() { + + moveSetting("boardName", "device"); + moveSettings("relayGPIO", "rlyGPIO"); + moveSettings("relayResetGPIO", "rlyResetGPIO"); + moveSettings("relayType", "rlyType"); + moveSetting("selGPIO", "hlwSELGPIO"); + moveSetting("cfGPIO", "hlwCFGPIO"); + moveSetting("cf1GPIO", "hlwCF1GPIO"); + moveSetting("relayProvider", "rlyProvider"); + moveSetting("lightProvider", "litProvider"); + moveSetting("relays", "rlyDummy"); + moveSettings("chGPIO", "litChGPIO"); + moveSettings("chLogic", "litChLogic"); + moveSetting("enGPIO", "litEnableGPIO"); + moveSetting("hlwSelC", "hlwCurLevel"); + moveSetting("hlwIntM", "hlwInt"); + delSetting("ledWifi"); + + // Get config version + unsigned int board = getSetting("board", 0).toInt(); + unsigned int config_version = getSetting("cfg", board > 0 ? 2 : 1).toInt(); + setSetting("cfg", CFG_VERSION); + + if (config_version == 2) { + _hardwareMigrateMoveIndexDown("ledGPIO"); + _hardwareMigrateMoveIndexDown("ledLogic"); + _hardwareMigrateMoveIndexDown("btnGPIO"); + _hardwareMigrateMoveIndexDown("btnRelay", -1); + _hardwareMigrateMoveIndexDown("rlyGPIO"); + _hardwareMigrateMoveIndexDown("rlyType"); + } + +} + void _hardwareSpecific() { // These devices use the hardware UART