From 8f7d77b2a1247063adc3bf8db04cb38d0426d2a0 Mon Sep 17 00:00:00 2001 From: julianwb Date: Tue, 18 Feb 2020 19:23:52 +0000 Subject: [PATCH] Config for Teckin SP23 & Maxcio W-UK007S (#2157) --- code/espurna/config/arduino.h | 2 + code/espurna/config/hardware.h | 84 ++++++++++++++++++++++++++++++++++ code/platformio.ini | 8 ++++ code/platformio_ota.ini | 6 +++ 4 files changed, 100 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index e0b8c136..422f8700 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -124,6 +124,7 @@ //#define MANCAVEMADE_ESPLIVE //#define MAXCIO_WDE004 //#define MAXCIO_WUS002S +//#define MAXCIO_WUK007S //#define MUVIT_IO_MIOBULB001 //#define NEO_COOLCAM_NAS_WR01W //#define NEXETE_A19 @@ -143,6 +144,7 @@ //#define TECKIN_SP20 //#define TECKIN_SP21 //#define TECKIN_SP22_V14 +//#define TECKIN_SP23_V13 //#define TFLAG_NX_SMX00 //#define TINKERMAN_ESPURNA_H06 //#define TINKERMAN_ESPURNA_H08 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index b28dd085..797caf86 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2297,6 +2297,46 @@ #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// Maxcio W-UK007S +// Like this: https://www.amazon.co.uk/Maxcio-Monitoring-Function-Compatible-Required/dp/B07BWFB55Q/ref=pd_rhf_se_p_img_2?_encoding=UTF8&psc=1&refRID=4H63A43SKHV8WV54XH19 +// ----------------------------------------------------------------------------- + +#elif defined(MAXCIO_WUK007S) + + // Info + #define MANUFACTURER "MAXCIO" + #define DEVICE "WUK007S" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 15 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 0 + #define LED1_PIN_INVERSE 0 + #define LED1_RELAY 1 + #define LED1_MODE LED_MODE_RELAY_WIFI + + // HJL01 / BL0937 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 14 + #define HLW8012_CF_PIN 5 + + #define HLW8012_SEL_CURRENT LOW + #define HLW8012_CURRENT_RATIO 24380 + #define HLW8012_VOLTAGE_RATIO 32048 + #define HLW8012_POWER_RATIO 3509285 + #define HLW8012_INTERRUPT_ON FALLING + // ----------------------------------------------------------------------------- // 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 @@ -3214,6 +3254,50 @@ // BUTTON1 and LED1 are using Serial pins #define DEBUG_SERIAL_SUPPORT 0 +// ----------------------------------------------------------------------------- +// Teckin SP22 v1.4 - v1.6 +// +// NB Notes suggest that energy monitoring is removed from later versions +// ----------------------------------------------------------------------------- + +#elif defined(TECKIN_SP23_V13) + + // Info .. NB Newer versions apparently lack energy monitor + // The board revision is not indicated externally + #define MANUFACTURER "TECKIN" + #define DEVICE "SP23_V13" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 15 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 4 + #define LED1_PIN_INVERSE 1 + #define LED2_PIN 2 + #define LED2_PIN_INVERSE 0 + #define LED2_MODE LED_MODE_FINDME + #define LED2_RELAY 1 + + // HJL01 / BL0937 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 14 + #define HLW8012_CF_PIN 5 + + #define HLW8012_SEL_CURRENT LOW + #define HLW8012_CURRENT_RATIO 23324 + #define HLW8012_VOLTAGE_RATIO 324305 + #define HLW8012_POWER_RATIO 3580841 + #define HLW8012_INTERRUPT_ON FALLING + // ----------------------------------------------------------------------------- // Several boards under different names uing a power chip labelled BL0937 or HJL-01 // Also model number KS-602S diff --git a/code/platformio.ini b/code/platformio.ini index b9cf8804..e8dfb772 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -661,6 +661,10 @@ build_flags = ${common.build_flags_1m0m} -DMAXCIO_WUS002S board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DMAXCIO_WDE004 +[env:maxcio-wuk007s] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DMAXCIO_WUK007S + [env:yidian-xsssa05] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DYIDIAN_XSSSA05 @@ -801,6 +805,10 @@ build_flags = ${common.build_flags_1m0m} -DTECKIN_SP21 board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DTECKIN_SP22_V14 +[env:teckin-sp23-v13] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DTECKIN_SP23_V13 + [env:gosund-ws1] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DGOSUND_WS1 diff --git a/code/platformio_ota.ini b/code/platformio_ota.ini index ddd6b611..e2b7e319 100644 --- a/code/platformio_ota.ini +++ b/code/platformio_ota.ini @@ -246,6 +246,9 @@ extends = env:maxcio-wus002s [env:maxcio-wde004-ota] extends = env:maxcio-wde004 +[env:maxcio-wuk007s-ota] +extends = env:maxcio-wuk007s + [env:yidian-xsssa05-ota] extends = env:yidian-xsssa05 @@ -348,6 +351,9 @@ extends = env:teckin-sp21 [env:teckin-sp22-v14-ota] extends = env:teckin-sp22-v14 +[env:teckin-sp23-v13-ota] +extends = env:teckin-sp23-v13 + [env:gosund-ws1-ota] extends = env:gosund-ws1