Browse Source

Define ESPURNA_IMAGE

v2
Xose Pérez 6 years ago
parent
commit
76cf133900
3 changed files with 679 additions and 2006 deletions
  1. +496
    -1852
      code/espurna/config/hardware.h
  2. +15
    -0
      code/espurna/config/types.h
  3. +168
    -154
      code/espurna/hardware.ino

+ 496
- 1852
code/espurna/config/hardware.h
File diff suppressed because it is too large
View File


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

@ -3,6 +3,21 @@
// Do not touch this definitions // 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 // WIFI
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 168
- 154
code/espurna/hardware.ino View File

@ -6,72 +6,33 @@ Copyright (C) 2016-2018 by Xose Pérez <xose dot perez at gmail dot com>
*/ */
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 <n>: GPIO for the n-th button (0-based)
// btnRelay <n>: Relay index linked to the n-th button
// btnMode <n>: 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 <n>: GPIO for the n-th relay (0-based)
// rlyType <n>: Type of the n-th relaym can be on of:
// - RELAY_TYPE_NORMAL
// - RELAY_TYPE_INVERSE
// - RELAY_TYPE_LATCHED
// - RELAY_TYPE_LATCHED_INVERSE
// ledGPIO <n>: GPIO for the n-th LED (0-based)
// ledLogic <n>: GPIO_LOGIC_DIRECT or GPIO_LOGIC_INVERSE
// ledMode <n>: Mode for the n-th LED, check types.h for LED_MODE_%
// ledRelay <n>: Relay linked to the n-th LED
//
// Besides, other hardware specific information can be added to any device
void _hardwareLoad() { void _hardwareLoad() {
@ -81,7 +42,7 @@ void _hardwareLoad() {
#if defined(NODEMCU_LOLIN) #if defined(NODEMCU_LOLIN)
setSetting("board", 2);
setSetting("board", BOARD_NODEMCU_LOLIN);
setSetting("device", "NODEMCU_LOLIN"); setSetting("device", "NODEMCU_LOLIN");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -96,7 +57,7 @@ void _hardwareLoad() {
#elif defined(WEMOS_D1_MINI_RELAYSHIELD) #elif defined(WEMOS_D1_MINI_RELAYSHIELD)
setSetting("board", 3);
setSetting("board", BOARD_WEMOS_D1_MINI_RELAYSHIELD);
setSetting("device", "WEMOS_D1_MINI_RELAYSHIELD"); setSetting("device", "WEMOS_D1_MINI_RELAYSHIELD");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -111,7 +72,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_BASIC) #elif defined(ITEAD_SONOFF_BASIC)
setSetting("board", 4);
setSetting("board", BOARD_ITEAD_SONOFF_BASIC);
setSetting("device", "ITEAD_SONOFF_BASIC"); setSetting("device", "ITEAD_SONOFF_BASIC");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -126,7 +87,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_TH) #elif defined(ITEAD_SONOFF_TH)
setSetting("board", 5);
setSetting("board", BOARD_ITEAD_SONOFF_TH);
setSetting("device", "ITEAD_SONOFF_TH"); setSetting("device", "ITEAD_SONOFF_TH");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -147,7 +108,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_SV) #elif defined(ITEAD_SONOFF_SV)
setSetting("board", 6);
setSetting("board", BOARD_ITEAD_SONOFF_SV);
setSetting("device", "ITEAD_SONOFF_SV"); setSetting("device", "ITEAD_SONOFF_SV");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -162,7 +123,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_TOUCH) #elif defined(ITEAD_SONOFF_TOUCH)
setSetting("board", 7);
setSetting("board", BOARD_ITEAD_SONOFF_TOUCH);
setSetting("device", "ITEAD_SONOFF_TOUCH"); setSetting("device", "ITEAD_SONOFF_TOUCH");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -182,7 +143,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_POW) #elif defined(ITEAD_SONOFF_POW)
setSetting("board", 8);
setSetting("board", BOARD_ITEAD_SONOFF_POW);
setSetting("device", "ITEAD_SONOFF_POW"); setSetting("device", "ITEAD_SONOFF_POW");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -202,7 +163,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_DUAL) #elif defined(ITEAD_SONOFF_DUAL)
setSetting("board", 9);
setSetting("board", BOARD_ITEAD_SONOFF_DUAL);
setSetting("device", "ITEAD_SONOFF_DUAL"); setSetting("device", "ITEAD_SONOFF_DUAL");
setSetting("btnRelay", 0, GPIO_NONE); setSetting("btnRelay", 0, GPIO_NONE);
@ -229,7 +190,7 @@ void _hardwareLoad() {
// You can still use the pulse options from the web interface // You can still use the pulse options from the web interface
// without problem. // without problem.
setSetting("board", 10);
setSetting("board", BOARD_ITEAD_1CH_INCHING);
setSetting("device", "ITEAD_1CH_INCHING"); setSetting("device", "ITEAD_1CH_INCHING");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -244,7 +205,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_4CH) #elif defined(ITEAD_SONOFF_4CH)
setSetting("board", 11);
setSetting("board", BOARD_ITEAD_SONOFF_4CH);
setSetting("device", "ITEAD_SONOFF_4CH"); setSetting("device", "ITEAD_SONOFF_4CH");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -274,7 +235,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SLAMPHER) #elif defined(ITEAD_SLAMPHER)
setSetting("board", 12);
setSetting("board", BOARD_ITEAD_SLAMPHER);
setSetting("device", "ITEAD_SLAMPHER"); setSetting("device", "ITEAD_SLAMPHER");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -289,7 +250,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_S20) #elif defined(ITEAD_S20)
setSetting("board", 13);
setSetting("board", BOARD_ITEAD_S20);
setSetting("device", "ITEAD_S20"); setSetting("device", "ITEAD_S20");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -304,7 +265,7 @@ void _hardwareLoad() {
#elif defined(ELECTRODRAGON_WIFI_IOT) #elif defined(ELECTRODRAGON_WIFI_IOT)
setSetting("board", 14);
setSetting("board", BOARD_ELECTRODRAGON_WIFI_IOT);
setSetting("device", "ELECTRODRAGON_WIFI_IOT"); setSetting("device", "ELECTRODRAGON_WIFI_IOT");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -324,7 +285,7 @@ void _hardwareLoad() {
#elif defined(WORKCHOICE_ECOPLUG) #elif defined(WORKCHOICE_ECOPLUG)
setSetting("board", 15);
setSetting("board", BOARD_WORKCHOICE_ECOPLUG);
setSetting("device", "WORKCHOICE_ECOPLUG"); setSetting("device", "WORKCHOICE_ECOPLUG");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -342,7 +303,7 @@ void _hardwareLoad() {
// Jan Goedeke Wifi Relay // Jan Goedeke Wifi Relay
// https://github.com/JanGoe/esp8266-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("device", "JANGOE_WIFI_RELAY_NC");
setSetting("btnGPIO", 0, 12); setSetting("btnGPIO", 0, 12);
@ -359,7 +320,7 @@ void _hardwareLoad() {
#elif defined(JANGOE_WIFI_RELAY_NO) #elif defined(JANGOE_WIFI_RELAY_NO)
setSetting("board", 17);
setSetting("board", BOARD_JANGOE_WIFI_RELAY_NO);
setSetting("device", "JANGOE_WIFI_RELAY_NO"); setSetting("device", "JANGOE_WIFI_RELAY_NO");
setSetting("btnGPIO", 0, 12); setSetting("btnGPIO", 0, 12);
@ -376,7 +337,7 @@ void _hardwareLoad() {
#elif defined(OPENENERGYMONITOR_MQTT_RELAY) #elif defined(OPENENERGYMONITOR_MQTT_RELAY)
setSetting("board", 18);
setSetting("board", BOARD_OPENENERGYMONITOR_MQTT_RELAY);
setSetting("device", "OPENENERGYMONITOR_MQTT_RELAY"); setSetting("device", "OPENENERGYMONITOR_MQTT_RELAY");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -395,7 +356,7 @@ void _hardwareLoad() {
// https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit // https://www.tindie.com/products/jorgegarciadev/wifi--relays-board-kit
// https://github.com/jorgegarciadev/wifikit // https://github.com/jorgegarciadev/wifikit
setSetting("board", 19);
setSetting("board", BOARD_JORGEGARCIA_WIFI_RELAYS);
setSetting("device", "JORGEGARCIA_WIFI_RELAYS"); setSetting("device", "JORGEGARCIA_WIFI_RELAYS");
setSetting("rlyGPIO", 0, 0); setSetting("rlyGPIO", 0, 0);
@ -405,7 +366,7 @@ void _hardwareLoad() {
#elif defined(AITHINKER_AI_LIGHT) #elif defined(AITHINKER_AI_LIGHT)
setSetting("board", 20);
setSetting("board", BOARD_AITHINKER_AI_LIGHT);
setSetting("device", "AITHINKER_AI_LIGHT"); setSetting("device", "AITHINKER_AI_LIGHT");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -421,7 +382,7 @@ void _hardwareLoad() {
#elif defined(MAGICHOME_LED_CONTROLLER) #elif defined(MAGICHOME_LED_CONTROLLER)
setSetting("board", 21);
setSetting("board", BOARD_MAGICHOME_LED_CONTROLLER);
setSetting("device", "MAGICHOME_LED_CONTROLLER"); setSetting("device", "MAGICHOME_LED_CONTROLLER");
setSetting("ledGPIO", 0, 2); setSetting("ledGPIO", 0, 2);
@ -446,7 +407,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_MOTOR) #elif defined(ITEAD_MOTOR)
setSetting("board", 22);
setSetting("board", BOARD_ITEAD_MOTOR);
setSetting("device", "ITEAD_MOTOR"); setSetting("device", "ITEAD_MOTOR");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -461,7 +422,7 @@ void _hardwareLoad() {
#elif defined(TINKERMAN_ESPURNA_H06) #elif defined(TINKERMAN_ESPURNA_H06)
setSetting("board", 23);
setSetting("board", BOARD_TINKERMAN_ESPURNA_H06);
setSetting("device", "TINKERMAN_ESPURNA_H06"); setSetting("device", "TINKERMAN_ESPURNA_H06");
setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 0, 4);
@ -481,7 +442,7 @@ void _hardwareLoad() {
#elif defined(HUACANXING_H801) #elif defined(HUACANXING_H801)
setSetting("board", 24);
setSetting("board", BOARD_HUACANXING_H801);
setSetting("device", "HUACANXING_H801"); setSetting("device", "HUACANXING_H801");
setSetting("ledGPIO", 0, 5); setSetting("ledGPIO", 0, 5);
@ -506,7 +467,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_BNSZ01) #elif defined(ITEAD_BNSZ01)
setSetting("board", 25);
setSetting("board", BOARD_ITEAD_BNSZ01);
setSetting("device", "ITEAD_BNSZ01"); setSetting("device", "ITEAD_BNSZ01");
setSetting("ledGPIO", 0, 13); setSetting("ledGPIO", 0, 13);
@ -521,7 +482,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_RFBRIDGE) #elif defined(ITEAD_SONOFF_RFBRIDGE)
setSetting("board", 26);
setSetting("board", BOARD_ITEAD_SONOFF_RFBRIDGE);
setSetting("device", "ITEAD_SONOFF_RFBRIDGE"); setSetting("device", "ITEAD_SONOFF_RFBRIDGE");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -545,7 +506,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_4CH_PRO) #elif defined(ITEAD_SONOFF_4CH_PRO)
setSetting("board", 27);
setSetting("board", BOARD_ITEAD_SONOFF_4CH_PRO);
setSetting("device", "ITEAD_SONOFF_4CH_PRO"); setSetting("device", "ITEAD_SONOFF_4CH_PRO");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -606,7 +567,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_B1) #elif defined(ITEAD_SONOFF_B1)
setSetting("board", 28);
setSetting("board", BOARD_ITEAD_SONOFF_B1);
setSetting("device", "ITEAD_SONOFF_B1"); setSetting("device", "ITEAD_SONOFF_B1");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -624,7 +585,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_LED) #elif defined(ITEAD_SONOFF_LED)
setSetting("board", 29);
setSetting("board", BOARD_ITEAD_SONOFF_LED);
setSetting("device", "ITEAD_SONOFF_LED"); setSetting("device", "ITEAD_SONOFF_LED");
setSetting("ledGPIO", 0, 13); setSetting("ledGPIO", 0, 13);
@ -641,7 +602,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_T1_1CH) #elif defined(ITEAD_SONOFF_T1_1CH)
setSetting("board", 30);
setSetting("board", BOARD_ITEAD_SONOFF_T1_1CH);
setSetting("device", "ITEAD_SONOFF_T1_1CH"); setSetting("device", "ITEAD_SONOFF_T1_1CH");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -662,7 +623,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_T1_2CH) #elif defined(ITEAD_SONOFF_T1_2CH)
setSetting("board", 31);
setSetting("board", BOARD_ITEAD_SONOFF_T1_2CH);
setSetting("device", "ITEAD_SONOFF_T1_2CH"); setSetting("device", "ITEAD_SONOFF_T1_2CH");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -693,7 +654,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_T1_3CH) #elif defined(ITEAD_SONOFF_T1_3CH)
setSetting("board", 32);
setSetting("board", BOARD_ITEAD_SONOFF_T1_3CH);
setSetting("device", "ITEAD_SONOFF_T1_3CH"); setSetting("device", "ITEAD_SONOFF_T1_3CH");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -734,7 +695,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_RF) #elif defined(ITEAD_SONOFF_RF)
setSetting("board", 33);
setSetting("board", BOARD_ITEAD_SONOFF_RF);
setSetting("device", "ITEAD_SONOFF_RF"); setSetting("device", "ITEAD_SONOFF_RF");
setSetting("btnGPIO", 0, 0); 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 // 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 // Does not support power monitoring yet
setSetting("board", 34);
setSetting("board", BOARD_WION_50055);
setSetting("device", "WION_50055"); setSetting("device", "WION_50055");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -772,7 +733,7 @@ void _hardwareLoad() {
// EX-Store Wifi Relay v3.1 // EX-Store Wifi Relay v3.1
// https://ex-store.de/ESP8266-WiFi-Relay-V31 // 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("device", "EXS_WIFI_RELAY_V31");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -785,7 +746,7 @@ void _hardwareLoad() {
#elif defined(HUACANXING_H802) #elif defined(HUACANXING_H802)
setSetting("board", 36);
setSetting("board", BOARD_HUACANXING_H802);
setSetting("device", "HUACANXING_H802"); setSetting("device", "HUACANXING_H802");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -805,7 +766,7 @@ void _hardwareLoad() {
#elif defined(GENERIC_V9261F) #elif defined(GENERIC_V9261F)
setSetting("board", 37);
setSetting("board", BOARD_GENERIC_V9261F);
setSetting("device", "GENERIC_V9261F"); setSetting("device", "GENERIC_V9261F");
setSetting("v92Enabled", 1); setSetting("v92Enabled", 1);
@ -814,7 +775,7 @@ void _hardwareLoad() {
#elif defined(GENERIC_ECH1560) #elif defined(GENERIC_ECH1560)
setSetting("board", 38);
setSetting("board", BOARD_GENERIC_ECH1560);
setSetting("device", "GENERIC_ECH1560"); setSetting("device", "GENERIC_ECH1560");
setSetting("echEnabled", 1); setSetting("echEnabled", 1);
@ -824,7 +785,7 @@ void _hardwareLoad() {
#elif defined(TINKERMAN_ESPURNA_H08) #elif defined(TINKERMAN_ESPURNA_H08)
setSetting("board", 39);
setSetting("board", BOARD_TINKERMAN_ESPURNA_H08);
setSetting("device", "TINKERMAN_ESPURNA_H08"); setSetting("device", "TINKERMAN_ESPURNA_H08");
setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 0, 4);
@ -847,7 +808,7 @@ void _hardwareLoad() {
// ESPLive // ESPLive
// https://github.com/ManCaveMade/ESP-Live // https://github.com/ManCaveMade/ESP-Live
setSetting("board", 40);
setSetting("board", BOARD_MANCAVEMADE_ESPLIVE);
setSetting("device", "MANCAVEMADE_ESPLIVE"); setSetting("device", "MANCAVEMADE_ESPLIVE");
setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 0, 4);
@ -875,7 +836,7 @@ void _hardwareLoad() {
// QuinLED // QuinLED
// http://blog.quindorian.org/2017/02/esp8266-led-lighting-quinled-v2-6-pcb.html // 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("device", "INTERMITTECH_QUINLED");
setSetting("ledGPIO", 0, 5); setSetting("ledGPIO", 0, 5);
@ -892,7 +853,7 @@ void _hardwareLoad() {
#elif defined(MAGICHOME_LED_CONTROLLER_20) #elif defined(MAGICHOME_LED_CONTROLLER_20)
setSetting("board", 42);
setSetting("board", BOARD_MAGICHOME_LED_CONTROLLER_20);
setSetting("device", "MAGICHOME_LED_CONTROLLER_20"); setSetting("device", "MAGICHOME_LED_CONTROLLER_20");
setSetting("ledGPIO", 0, 2); setSetting("ledGPIO", 0, 2);
@ -917,7 +878,7 @@ void _hardwareLoad() {
#elif defined(ARILUX_AL_LC06) #elif defined(ARILUX_AL_LC06)
setSetting("board", 43);
setSetting("board", BOARD_ARILUX_AL_LC06);
setSetting("device", "ARILUX_AL_LC06"); setSetting("device", "ARILUX_AL_LC06");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -937,7 +898,7 @@ void _hardwareLoad() {
#elif defined(XENON_SM_PW702U) #elif defined(XENON_SM_PW702U)
setSetting("board", 44);
setSetting("board", BOARD_XENON_SM_PW702U);
setSetting("device", "XENON_SM_PW702U"); setSetting("device", "XENON_SM_PW702U");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -955,7 +916,7 @@ void _hardwareLoad() {
// AUTHOMETION LYT8266 // AUTHOMETION LYT8266
// https://authometion.com/shop/en/home/13-lyt8266.html // https://authometion.com/shop/en/home/13-lyt8266.html
setSetting("board", 45);
setSetting("board", BOARD_AUTHOMETION_LYT8266);
setSetting("device", "AUTHOMETION_LYT8266"); setSetting("device", "AUTHOMETION_LYT8266");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -975,7 +936,7 @@ void _hardwareLoad() {
#elif defined(ARILUX_E27) #elif defined(ARILUX_E27)
setSetting("board", 46);
setSetting("board", BOARD_ARILUX_E27);
setSetting("device", "ARILUX_E27"); setSetting("device", "ARILUX_E27");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -991,7 +952,7 @@ void _hardwareLoad() {
#elif defined(YJZK_SWITCH_2CH) #elif defined(YJZK_SWITCH_2CH)
setSetting("board", 47);
setSetting("board", BOARD_YJZK_SWITCH_2CH);
setSetting("device", "YJZK_SWITCH_2CH"); setSetting("device", "YJZK_SWITCH_2CH");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -1011,7 +972,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_DUAL_R2) #elif defined(ITEAD_SONOFF_DUAL_R2)
setSetting("board", 48);
setSetting("board", BOARD_ITEAD_SONOFF_DUAL_R2);
setSetting("device", "ITEAD_SONOFF_DUAL_R2"); setSetting("device", "ITEAD_SONOFF_DUAL_R2");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -1035,7 +996,7 @@ void _hardwareLoad() {
#elif defined(GENERIC_8CH) #elif defined(GENERIC_8CH)
setSetting("board", 49);
setSetting("board", BOARD_GENERIC_8CH);
setSetting("device", "GENERIC_8CH"); setSetting("device", "GENERIC_8CH");
setSetting("rlyGPIO", 0, 0); setSetting("rlyGPIO", 0, 0);
@ -1057,7 +1018,7 @@ void _hardwareLoad() {
#elif defined(ARILUX_AL_LC01) #elif defined(ARILUX_AL_LC01)
setSetting("board", 50);
setSetting("board", BOARD_ARILUX_AL_LC01);
setSetting("device", "ARILUX_AL_LC01"); setSetting("device", "ARILUX_AL_LC01");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -1073,7 +1034,7 @@ void _hardwareLoad() {
#elif defined(ARILUX_AL_LC11) #elif defined(ARILUX_AL_LC11)
setSetting("board", 51);
setSetting("board", BOARD_ARILUX_AL_LC11);
setSetting("device", "ARILUX_AL_LC11"); setSetting("device", "ARILUX_AL_LC11");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -1093,7 +1054,7 @@ void _hardwareLoad() {
#elif defined(ARILUX_AL_LC02) #elif defined(ARILUX_AL_LC02)
setSetting("board", 52);
setSetting("board", BOARD_ARILUX_AL_LC02);
setSetting("device", "ARILUX_AL_LC02"); setSetting("device", "ARILUX_AL_LC02");
setSetting("rlyProvider", RELAY_PROVIDER_LIGHT); setSetting("rlyProvider", RELAY_PROVIDER_LIGHT);
@ -1114,7 +1075,7 @@ void _hardwareLoad() {
// KMC 70011 // KMC 70011
// https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B // https://www.amazon.com/KMC-Monitoring-Required-Control-Compatible/dp/B07313TH7B
setSetting("board", 53);
setSetting("board", BOARD_KMC_70011);
setSetting("device", "KMC_70011"); setSetting("device", "KMC_70011");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -1135,7 +1096,7 @@ void _hardwareLoad() {
#elif defined(GIZWITS_WITTY_CLOUD) #elif defined(GIZWITS_WITTY_CLOUD)
setSetting("board", 54);
setSetting("board", BOARD_GIZWITS_WITTY_CLOUD);
setSetting("device", "GIZWITS_WITTY_CLOUD"); setSetting("device", "GIZWITS_WITTY_CLOUD");
setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 0, 4);
@ -1173,7 +1134,7 @@ void _hardwareLoad() {
// So @Geitde hack is still the only possible // So @Geitde hack is still the only possible
// Hack: drive GPIO12 low and use GPIO5 as normal relay pin: // 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("device", "EUROMATE_WIFI_STECKER_SCHUKO");
setSetting("btnGPIO", 0, 14); setSetting("btnGPIO", 0, 14);
@ -1190,7 +1151,7 @@ void _hardwareLoad() {
#elif defined(TONBUX_POWERSTRIP02) #elif defined(TONBUX_POWERSTRIP02)
setSetting("board", 56);
setSetting("board", BOARD_TONBUX_POWERSTRIP02);
setSetting("device", "TONBUX_POWERSTRIP02"); setSetting("device", "TONBUX_POWERSTRIP02");
setSetting("btnGPIO", 0, 5); setSetting("btnGPIO", 0, 5);
@ -1215,7 +1176,7 @@ void _hardwareLoad() {
#elif defined(LINGAN_SWA1) #elif defined(LINGAN_SWA1)
setSetting("board", 57);
setSetting("board", BOARD_LINGAN_SWA1);
setSetting("device", "LINGAN_SWA1"); setSetting("device", "LINGAN_SWA1");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1230,7 +1191,7 @@ void _hardwareLoad() {
#elif defined(HEYGO_HY02) #elif defined(HEYGO_HY02)
setSetting("board", 58);
setSetting("board", BOARD_HEYGO_HY02);
setSetting("device", "HEYGO_HY02"); setSetting("device", "HEYGO_HY02");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1245,7 +1206,7 @@ void _hardwareLoad() {
#elif defined(MAXCIO_WUS002S) #elif defined(MAXCIO_WUS002S)
setSetting("board", 59);
setSetting("board", BOARD_MAXCIO_WUS002S);
setSetting("device", "MAXCIO_WUS002S"); setSetting("device", "MAXCIO_WUS002S");
setSetting("btnGPIO", 0, 2); setSetting("btnGPIO", 0, 2);
@ -1267,7 +1228,7 @@ void _hardwareLoad() {
#elif defined(YIDIAN_XSSSA05) #elif defined(YIDIAN_XSSSA05)
setSetting("board", 60);
setSetting("board", BOARD_YIDIAN_XSSSA05);
setSetting("device", "YIDIAN_XSSSA05"); setSetting("device", "YIDIAN_XSSSA05");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1290,7 +1251,7 @@ void _hardwareLoad() {
#elif defined(TONBUX_XSSSA06) #elif defined(TONBUX_XSSSA06)
setSetting("board", 61);
setSetting("board", BOARD_TONBUX_XSSSA06);
setSetting("device", "TONBUX_XSSSA06"); setSetting("device", "TONBUX_XSSSA06");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1312,7 +1273,7 @@ void _hardwareLoad() {
// GREEN ESP8266 RELAY MODULE // GREEN ESP8266 RELAY MODULE
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180323113846&SearchText=Green+ESP8266 // 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("device", "GREEN_ESP8266RELAY");
setSetting("btnGPIO", 0, 5); setSetting("btnGPIO", 0, 5);
@ -1330,7 +1291,7 @@ void _hardwareLoad() {
// Henrique Gravina ESPIKE // Henrique Gravina ESPIKE
// https://github.com/Henriquegravina/Espike // https://github.com/Henriquegravina/Espike
setSetting("board", 63);
setSetting("board", BOARD_IKE_ESPIKE);
setSetting("device", "IKE_ESPIKE"); setSetting("device", "IKE_ESPIKE");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1361,7 +1322,7 @@ void _hardwareLoad() {
// SWIFITCH // SWIFITCH
// https://github.com/ArnieX/swifitch // https://github.com/ArnieX/swifitch
setSetting("board", 64);
setSetting("board", BOARD_ARNIEX_SWIFITCH);
setSetting("device", "ARNIEX_SWIFITCH"); setSetting("device", "ARNIEX_SWIFITCH");
setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 0, 4);
@ -1384,7 +1345,7 @@ void _hardwareLoad() {
// ESP-01S RELAY v4.0 // ESP-01S RELAY v4.0
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180404024035&SearchText=esp-01s+relay // 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("device", "GENERIC_ESP01S_RELAY_V40");
setSetting("ledGPIO", 0, 2); setSetting("ledGPIO", 0, 2);
@ -1398,7 +1359,7 @@ void _hardwareLoad() {
// ESP-01S RGB LED v1.0 (some sold with ws2818) // 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 // 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("device", "GENERIC_ESP01S_RGBLED_V10");
setSetting("ledGPIO", 0, 2); setSetting("ledGPIO", 0, 2);
@ -1409,7 +1370,7 @@ void _hardwareLoad() {
// Heltec Touch Relay // Heltec Touch Relay
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180408043114&SearchText=esp8266+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("device", "HELTEC_TOUCHRELAY");
setSetting("btnGPIO", 0, 14); setSetting("btnGPIO", 0, 14);
@ -1424,7 +1385,7 @@ void _hardwareLoad() {
// ESP-01S DHT11 v1.0 // ESP-01S DHT11 v1.0
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105907&SearchText=esp-01s+dht11 // 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("device", "GENERIC_ESP01S_DHT11_V10");
setSetting("dhtEnabled", 1); setSetting("dhtEnabled", 1);
@ -1436,7 +1397,7 @@ void _hardwareLoad() {
// ESP-01S DS18B20 v1.0 // ESP-01S DS18B20 v1.0
// https://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20180410105933&SearchText=esp-01s+ds18b20 // 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("device", "GENERIC_ESP01S_DS18B20_V10");
setSetting("dsEnabled", 1); setSetting("dsEnabled", 1);
@ -1447,7 +1408,7 @@ void _hardwareLoad() {
// Zhilde ZLD-EU44-W // 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 // 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("device", "ZHILDE_EU44_W");
setSetting("btnGPIO", 0, 3); setSetting("btnGPIO", 0, 3);
@ -1474,7 +1435,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_POW_R2) #elif defined(ITEAD_SONOFF_POW_R2)
setSetting("board", 71);
setSetting("board", BOARD_ITEAD_SONOFF_POW_R2);
setSetting("device", "ITEAD_SONOFF_POW_R2"); setSetting("device", "ITEAD_SONOFF_POW_R2");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -1498,7 +1459,7 @@ void _hardwareLoad() {
// https://luani.de/projekte/esp8266-hvio/ // https://luani.de/projekte/esp8266-hvio/
// https://luani.de/blog/esp8266-230v-io-modul/ // https://luani.de/blog/esp8266-230v-io-modul/
setSetting("board", 72);
setSetting("board", BOARD_LUANI_HVIO);
setSetting("device", "LUANI_HVIO"); setSetting("device", "LUANI_HVIO");
setSetting("ledGPIO", 0, 15); 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/ // 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 // 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("device", "ALLNET_4DUINO_IOT_WLAN_RELAIS");
setSetting("ledGPIO", 0, 0); setSetting("ledGPIO", 0, 0);
@ -1538,7 +1499,7 @@ void _hardwareLoad() {
// Tonbux 50-100M Smart Mosquito Killer USB // 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 // 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("device", "TONBUX_MOSQUITO_KILLER");
setSetting("btnGPIO", 0, 2); setSetting("btnGPIO", 0, 2);
@ -1566,7 +1527,7 @@ void _hardwareLoad() {
// https://es.aliexpress.com/item/-/32854589733.html?spm=a219c.12010608.0.0.6d084e68xX0y5N // 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 // 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("device", "NEO_COOLCAM_NAS_WR01W");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1579,12 +1540,12 @@ void _hardwareLoad() {
setSetting("rlyGPIO", 0, 12); setSetting("rlyGPIO", 0, 12);
setSetting("rlyType", 0, RELAY_TYPE_NORMAL); 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("device", "PILOTAK_ESP_DIN_V1");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -1620,7 +1581,7 @@ void _hardwareLoad() {
// Fornorm Wi-Fi USB Extension Socket (ZLD-34EU) // 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 // 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("device", "ESTINK_WIFI_POWER_STRIP");
setSetting("btnGPIO", 0, 16); setSetting("btnGPIO", 0, 16);
@ -1660,7 +1621,7 @@ void _hardwareLoad() {
// https://www.bhonofre.pt/ // https://www.bhonofre.pt/
// https://github.com/brunohorta82/BH_OnOfre/ // https://github.com/brunohorta82/BH_OnOfre/
setSetting("board", 78);
setSetting("board", BOARD_BH_ONOFRE);
setSetting("device", "BH_ONOFRE"); setSetting("device", "BH_ONOFRE");
setSetting("btnGPIO", 0, 12); 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) // * 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) // * 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("device", "BLITZWOLF_BWSHP2");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1714,7 +1675,7 @@ void _hardwareLoad() {
#elif defined(TINKERMAN_ESPURNA_SWITCH) #elif defined(TINKERMAN_ESPURNA_SWITCH)
setSetting("board", 80);
setSetting("board", BOARD_TINKERMAN_ESPURNA_SWITCH);
setSetting("device", "TINKERMAN_ESPURNA_SWITCH"); setSetting("device", "TINKERMAN_ESPURNA_SWITCH");
setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 0, 4);
@ -1734,7 +1695,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_S31) #elif defined(ITEAD_SONOFF_S31)
setSetting("board", 81);
setSetting("board", BOARD_ITEAD_SONOFF_S31);
setSetting("device", "ITEAD_SONOFF_S31"); setSetting("device", "ITEAD_SONOFF_S31");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -1754,7 +1715,7 @@ void _hardwareLoad() {
#elif defined(STM_RELAY) #elif defined(STM_RELAY)
setSetting("board", 82);
setSetting("board", BOARD_STM_RELAY);
setSetting("device", "STM_RELAY"); setSetting("device", "STM_RELAY");
setSetting("rlyDummy", 2); setSetting("rlyDummy", 2);
@ -1767,7 +1728,7 @@ void _hardwareLoad() {
// VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01) // VANZAVANZU Smart Outlet Socket (based on BL0937 or HJL-01)
// https://www.amazon.com/Smart-Plug-Wifi-Mini-VANZAVANZU/dp/B078PHD6S5 // 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("device", "VANZAVANZU_SMART_WIFI_PLUG_MINI");
setSetting("btnGPIO", 0, 13); setSetting("btnGPIO", 0, 13);
@ -1796,7 +1757,7 @@ void _hardwareLoad() {
#elif defined(GENERIC_GEIGER_COUNTER) #elif defined(GENERIC_GEIGER_COUNTER)
setSetting("board", 84);
setSetting("board", BOARD_GENERIC_GEIGER_COUNTER);
setSetting("device", "GENERIC_GEIGER_COUNTER"); setSetting("device", "GENERIC_GEIGER_COUNTER");
setSetting("geiEnabled", 1); setSetting("geiEnabled", 1);
@ -1805,7 +1766,7 @@ void _hardwareLoad() {
// Check http://tinkerman.cat/rfm69-wifi-gateway/ // Check http://tinkerman.cat/rfm69-wifi-gateway/
setSetting("board", 85);
setSetting("board", BOARD_TINKERMAN_RFM69GW);
setSetting("device", "TINKERMAN_RFM69GW"); setSetting("device", "TINKERMAN_RFM69GW");
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
@ -1818,7 +1779,7 @@ void _hardwareLoad() {
#elif defined(ITEAD_SONOFF_IFAN02) #elif defined(ITEAD_SONOFF_IFAN02)
setSetting("board", 86);
setSetting("board", BOARD_ITEAD_SONOFF_IFAN02);
setSetting("btnGPIO", 0, 0); setSetting("btnGPIO", 0, 0);
setSetting("btnGPIO", 1, 9); setSetting("btnGPIO", 1, 9);
@ -1840,7 +1801,7 @@ void _hardwareLoad() {
#elif defined(GENERIC_AG_L4) #elif defined(GENERIC_AG_L4)
setSetting("board", 87);
setSetting("board", BOARD_GENERIC_AG_L4);
setSetting("btnGPIO", 0, 4); setSetting("btnGPIO", 0, 4);
setSetting("btnGPIO", 1, 2); 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() { void _hardwareSpecific() {
// These devices use the hardware UART // These devices use the hardware UART


Loading…
Cancel
Save