From 6d74f4e95830a3700dc769e52389f6fc51e63c36 Mon Sep 17 00:00:00 2001 From: Sandeep Sirpatil <26658815+sirpatil@users.noreply.github.com> Date: Mon, 5 Aug 2019 08:57:08 -0700 Subject: [PATCH] Add etekcity-esw01-usa (#1836) * * Added support for Etekcity ESW01-USA device * Update hardware.h * Update hardware.h --- code/espurna/config/hardware.h | 45 ++++++++++++++++++++++++++++++++++ code/platformio.ini | 10 ++++++++ 2 files changed, 55 insertions(+) diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index cd9667e4..b6684f93 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -3741,6 +3741,51 @@ #define LED2_RELAY 1 #define LED2_MODE LED_MODE_FINDME_WIFI +// ----------------------------------------------------------------------------- +// Etekcity ESW01-USA +// https://www.amazon.com/Etekcity-Voltson-Outlet-Monitoring-Required/dp/B01M3MYIFS +// ----------------------------------------------------------------------------- + +#elif defined(ETEKCITY_ESW01_USA) + + // Info + #define MANUFACTURER "ETEKCITY" + #define DEVICE "ESW01-USA" + + // Buttons + #define BUTTON1_PIN 14 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 4 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + // Blue + #define LED1_PIN 5 + #define LED1_PIN_INVERSE 0 + #define LED1_MODE LED_MODE_WIFI + // Yellow + #define LED2_PIN 16 + #define LED2_PIN_INVERSE 0 + #define LED2_MODE LED_MODE_FOLLOW + #define LED2_RELAY 1 + + // HLW8012 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 15 + #define HLW8012_CF1_PIN 12 + #define HLW8012_CF_PIN 13 + + #define HLW8012_SEL_CURRENT HIGH // SEL pin to HIGH to measure current + #define HLW8012_CURRENT_R 0.001 // Current resistor + #define HLW8012_VOLTAGE_R_UP ( 4 * 470000 ) // Upstream voltage resistor + #define HLW8012_VOLTAGE_R_DOWN ( 1000 ) // Downstream voltage resistor + #define HLW8012_INTERRUPT_ON CHANGE + // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- diff --git a/code/platformio.ini b/code/platformio.ini index a591a7ce..65055e05 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1543,3 +1543,13 @@ board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DJINVOO_VALVE_SM_AW713 upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} + +[env:etekcity-esw01-usa] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DETEKCITY_ESW01_USA + +[env:etekcity-esw01-usa-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DETEKCITY_ESW01_USA +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags}