From 3fdedd512539014439a8ac802c394e678dd19843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 5 Mar 2018 08:14:15 +0100 Subject: [PATCH] Added Wifi Stecker Shuko device (thanks to @Geitde) --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 32 ++++++++++++++++++++++++++++++++ code/espurna/migrate.ino | 12 ++++++++++++ code/platformio.ini | 24 ++++++++++++++++++++++++ 4 files changed, 69 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 8fbe3fba..5b3785cc 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -61,6 +61,7 @@ //#define ARILUX_AL_LC02 //#define WEMOS_D1_TARPUNA_SHIELD //#define GIZWITS_WITTY_CLOUD +//#define EUROMATE_WIFI_STECKER_SCHUKO //-------------------------------------------------------------------------------- // Features (values below are non-default values) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index c4b9dcd3..5c2f29c4 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -1458,6 +1458,38 @@ #define HLW8012_CF1_PIN 5 #define HLW8012_CF_PIN 4 +// ----------------------------------------------------------------------------- +// Euromate (?) Wifi Stecker Shuko +// https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko/p/2291706 +// Thanks to @Geitde +// ----------------------------------------------------------------------------- + +#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 + + // Relays + // #define RELAY1_PIN 12 + // #define RELAY1_TYPE RELAY_TYPE_LATCHED_INVERSE + // #define RELAY1_RESET_PIN 5 + + // 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 + // ----------------------------------------------------------------------------- // Generic 8CH // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index e8b753dc..51c07aad 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -727,6 +727,18 @@ void migrate() { setSetting("chLogic", 2, 0); setSetting("relays", 1); + #elif defined(EUROMATE_WIFI_STECKER_SCHUKO) + + setSetting("board", 55); + setSetting("ledGPIO", 0, 4); + setSetting("ledLogic", 0, 0); + setSetting("ledGPIO", 1, 12); + setSetting("ledLogic", 1, 0); + setSetting("btnGPIO", 0, 14); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 5); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index 0671444a..07cc79b0 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1471,6 +1471,30 @@ upload_port = "${env.ESPURNA_IP}" upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 extra_scripts = ${common.extra_scripts} +[env:euromate-wifi-stecker-shuko] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags} -DEUROMATE_WIFI_STECKER_SCHUKO +monitor_baud = 115200 +extra_scripts = ${common.extra_scripts} + +[env:euromate-wifi-stecker-shuko-ota] +platform = ${common.platform} +framework = arduino +board = esp01_1m +board_flash_mode = dout +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags} -DEUROMATE_WIFI_STECKER_SCHUKO +upload_speed = 115200 +upload_port = "${env.ESPURNA_IP}" +upload_flags = --auth=${env.ESPURNA_AUTH} --port 8266 +extra_scripts = ${common.extra_scripts} + [env:stm-relay-ota] platform = ${common.platform} framework = arduino