diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 6f9a13c0..f614a8ef 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -96,6 +96,7 @@ //#define YJZK_SWITCH_1CH //#define YJZK_SWITCH_3CH //#define XIAOMI_SMART_DESK_LAMP +//#define ALLTERCO_SHELLY2 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index e07bf2b3..9df3e3ba 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2654,6 +2654,26 @@ #define RELAY1_PIN 4 #define RELAY1_TYPE RELAY_TYPE_NORMAL +#elif defined(ALLTERCO_SHELLY2) + + // Info + #define MANUFACTURER "ALLTERCO" + #define DEVICE "SHELLY2" + + // Buttons + #define BUTTON1_PIN 12 + #define BUTTON2_PIN 14 + #define BUTTON1_MODE BUTTON_SWITCH + #define BUTTON2_MODE BUTTON_SWITCH + #define BUTTON1_RELAY 1 + #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 + // ----------------------------------------------------------------------------- #elif defined(LOHAS_9W) diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index fdec5006..7639d054 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1163,6 +1163,18 @@ void migrate() { setSetting("encBtnGPIO", 0, 2); setSetting("encMode", ENCODER_MODE_RATIO); + #elif defined(ALLTERCO_SHELLY2) + + setSetting("board", 88); + setSetting("btnGPIO", 0, 12); + setSetting("btnGPIO", 1, 14); + setSetting("btnRelay", 0, 0); + setSetting("btnRelay", 1, 1); + setSetting("relayGPIO", 0, 4); + setSetting("relayGPIO", 1, 5); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + setSetting("relayType", 1, RELAY_TYPE_NORMAL); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index 0d39e7b0..a3b5ccca 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -2574,6 +2574,31 @@ upload_flags = ${common.upload_flags} monitor_speed = ${common.monitor_speed} extra_scripts = ${common.extra_scripts} +[env:allterco-shelly2] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_2m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY2 +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:allterco-shelly2-ota] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_2m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY2 +upload_speed = ${common.upload_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + [env:xiaomi-smart-desk-lamp] platform = ${common.platform} framework = ${common.framework}