From cfc0f806b67178d9bb35bf1631a869bfe07861fb Mon Sep 17 00:00:00 2001 From: abmantis Date: Sun, 12 Aug 2018 00:35:25 +0100 Subject: [PATCH] add support for shelly1 relay --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 14 ++++++++++++++ code/espurna/migrate.ino | 9 +++++++++ 3 files changed, 24 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 83fcbfbc..068dd648 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -91,6 +91,7 @@ //#define BH_ONOFRE //#define ITEAD_SONOFF_IFAN02 //#define GENERIC_AG_L4 +#define ALLTERCO_SHELLY1 //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 75cbe471..4cbfc3df 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2728,6 +2728,20 @@ #define NETBIOS_SUPPORT 1 #define SSDP_SUPPORT 1 +#elif defined(ALLTERCO_SHELLY1) + + // Info + #define MANUFACTURER "ALLTERCO" + #define DEVICE "SHELLY1" + + // Buttons + #define BUTTON1_PIN 5 + #define BUTTON1_MODE BUTTON_SWITCH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 4 + #define RELAY1_TYPE RELAY_TYPE_NORMAL #endif // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 005c7a19..7d2789c5 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1087,6 +1087,15 @@ void migrate() { setSetting("chLogic", 2, 0); setSetting("relays", 1); + #elif defined(ALLTERCO_SHELLY1) + + setSetting("board", 83); + setSetting("btnGPIO", 0, 5); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 4); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + + #else // Allow users to define new settings without migration config