From 55a73b1c6e071dabfa07b88e54e812cd20f017c1 Mon Sep 17 00:00:00 2001 From: Anders Blockmar Date: Mon, 20 Jan 2020 13:42:16 +0100 Subject: [PATCH] Added hardware config for Avatto NAS-WR01W (#2113) Not a match to same model from Neo Coolcam --- code/espurna/config/arduino.h | 1 + code/espurna/config/hardware.h | 39 ++++++++++++++++++++++++++++++++++ code/espurna/migrate.ino | 10 +++++++++ code/platformio.ini | 10 +++++++++ 4 files changed, 60 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 4886e85b..d90d8af7 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -21,6 +21,7 @@ //#define ARILUX_E27 //#define ARNIEX_SWIFITCH //#define AUTHOMETION_LYT8266 +//#define AVATTO_NAS_WR01W //#define BESTEK_MRJ1011 //#define BH_ONOFRE //#define BLITZWOLF_BWSHPX diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index d5a7d4ae..4eed2af3 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2805,6 +2805,45 @@ #define LED4_PIN_INVERSE 0 #define LED4_RELAY 1 +// ----------------------------------------------------------------------------- +// Avatto NAS-WR01W Wifi Smart Power Plug +// https://www.aliexpress.com/item/33011753732.html +// https://todo... +// ----------------------------------------------------------------------------- + +#elif defined(AVATTO_NAS_WR01W) + + // Info + #define MANUFACTURER "AVATTO" + #define DEVICE "NAS_WR01W" + + // Buttons + #define BUTTON1_PIN 0 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 14 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 13 + #define LED1_PIN_INVERSE 1 + + // HJL01 / BL0937 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 5 + #define HLW8012_CF_PIN 4 + + #define HLW8012_SEL_CURRENT LOW + #define HLW8012_CURRENT_RATIO 25740 + #define HLW8012_VOLTAGE_RATIO 313400 + #define HLW8012_POWER_RATIO 3414290 + #define HLW8012_INTERRUPT_ON FALLING + // ----------------------------------------------------------------------------- // NEO Coolcam NAS-WR01W Wifi Smart Power Plug // https://es.aliexpress.com/item/-/32854589733.html?spm=a219c.12010608.0.0.6d084e68xX0y5N diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 292a48a0..18983bde 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -964,6 +964,16 @@ void migrate() { setSetting("relayGPIO", 0, 5); setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #elif defined(AVATTO_NAS_WR01W) + + setSetting("board", 75); + setSetting("ledGPIO", 0, 13); + setSetting("ledLogic", 0, 1); + setSetting("btnGPIO", 0, 0); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 14); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + #elif defined(NEO_COOLCAM_NAS_WR01W) setSetting("board", 75); diff --git a/code/platformio.ini b/code/platformio.ini index 6b82b1a3..404333d8 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1212,6 +1212,16 @@ build_flags = ${common.build_flags_1m0m} -DLUANI_HVIO upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} +[env:avatto-power-plug-wifi] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DAVATTO_NAS_WR01W + +[env:avatto-power-plug-wifi-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DAVATTO_NAS_WR01W +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + [env:neo-coolcam-power-plug-wifi] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DNEO_COOLCAM_NAS_WR01W