From 92032db563ad609c0792b3e8e2a48475bf89b116 Mon Sep 17 00:00:00 2001 From: Sam Quinn Date: Wed, 20 Feb 2019 20:12:44 -0800 Subject: [PATCH] ADDED SUPPORT FOR OUKITEL P1 SMART SWITCH (#1553) Added initial support for Oukitel Smart Switch. This is a 2 outlet plug that has the same pinout as the YiDian XS-SSA05. --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 32 ++++++++++++++++++++++++++++++++ code/espurna/migrate.ino | 13 +++++++++++++ code/platformio.ini | 26 +++++++++++++++++++++++++- 4 files changed, 71 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 6d9c30f9..f0c688e5 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -73,6 +73,7 @@ //#define LINGAN_SWA1 //#define HEYGO_HY02 //#define MAXCIO_WUS002S +//#define OUKITEL_P1 //#define YIDIAN_XSSSA05 //#define TONBUX_XSSSA06 //#define TONBUX_XSSSA01 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 85695ea9..ba30a6e4 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2101,6 +2101,38 @@ #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// Oukitel - P1 +// ----------------------------------------------------------------------------- + +#elif defined(OUKITEL_P1) + // ----------------------------------------------------------------------------- + // Oukitel P1 Smart Plug + // https://www.amazon.com/Docooler-OUKITEL-Control-Wireless-Adaptor/dp/B07J3BYFJX/ref=sr_1_fkmrnull_2?keywords=oukitel+p1+smart+switch&qid=1550424399&s=gateway&sr=8-2-fkmrnull + // ----------------------------------------------------------------------------- + + // Info + #define MANUFACTURER "Oukitel" + #define DEVICE "P1" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + // Right + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + // Left + #define RELAY2_PIN 15 + #define RELAY2_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 0 // blue + #define LED1_PIN_INVERSE 1 + #define LED1_MODE LED_MODE_WIFI + // ----------------------------------------------------------------------------- // YiDian XS-SSA05 // ----------------------------------------------------------------------------- diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index f1e7eafe..bb7c5599 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1256,6 +1256,19 @@ void migrate() { setSetting("relayGPIO", 0, 4); setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #elif defined(OUKITEL_P1) + + setSetting("board", 94); + setSetting("ledGPIO", 0, 0); // Blue LED + setSetting("ledLogic", 0, 0); + setSetting("btnGPIO", 0, 13); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 12); // Right outlet + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + setSetting("relayGPIO", 1, 15); // Left outlet + 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 cf2bb3f3..ec3ba376 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -2208,6 +2208,30 @@ upload_port = ${common.upload_port} upload_flags = ${common.upload_flags} extra_scripts = ${common.extra_scripts} +[env:oukitel-p1] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DOUKITEL_P1 +monitor_speed = ${common.monitor_speed} +extra_scripts = ${common.extra_scripts} + +[env:oukitel-p1-ota] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board_1m} +board_build.flash_mode = ${common.flash_mode} +lib_deps = ${common.lib_deps} +lib_ignore = ${common.lib_ignore} +build_flags = ${common.build_flags_1m0m} -DOUKITEL_P1 +upload_speed = ${common.upload_speed} +upload_port = ${common.upload_port} +upload_flags = ${common.upload_flags} +extra_scripts = ${common.extra_scripts} + [env:tonbux-xsssa01] platform = ${common.platform} framework = ${common.framework} @@ -3103,4 +3127,4 @@ 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} \ No newline at end of file +extra_scripts = ${common.extra_scripts}