Skip to content

Commit

Permalink
Add support for Hykker Smart Plug with power meter (xoseperez#2010)
Browse files Browse the repository at this point in the history
* add support for Hykker Smart Plug with power meter
Type: Power Plugs
Board: Hykker Power Plug
Build flag: HYKKER_POWER_PLUG
Description: Power plug w/ power metering

* Update arduino.h

hykker power plug

* Update platformio.ini

hykker power plug

* Type: Power Plugs
Board: Hykker Smart Home Power Plug
Build flag: HYKKER_SMART_HOME_POWER_PLUG
Description: Power plug w/ power metering

* voltage ratio calibration for correct results
  • Loading branch information
reaper7 authored and mcspr committed Nov 26, 2019
1 parent 0b5d200 commit 899f646
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/espurna/config/arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
//#define HOMECUBE_16A
//#define HUACANXING_H801
//#define HUACANXING_H802
//#define HYKKER_SMART_HOME_POWER_PLUG
//#define IKE_ESPIKE
//#define INTERMITTECH_QUINLED
//#define ITEAD_1CH_INCHING
Expand Down
45 changes: 45 additions & 0 deletions code/espurna/config/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -4054,7 +4054,52 @@
#define LIGHT_CH3_INVERSE 0
#define LIGHT_CH4_INVERSE 0

// -----------------------------------------------------------------------------
// Hykker Power Plug (Smart Home Series) available in Jer—nimo Martins Polska (Biedronka)
// https://www.hykker.com/akcesoria/gniazdo-wi-fi-z-licznikiem-energii/
// Reflashing from original Tuya firmware
// to thirdparty firmware like espurna by:
// https://github.com/ct-Open-Source/tuya-convert
// -----------------------------------------------------------------------------

#elif defined(HYKKER_SMART_HOME_POWER_PLUG)

// Info
#define MANUFACTURER "HYKKER"
#define DEVICE "SMART_HOME_POWER_PLUG"

// 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

// LED
// Red
#define LED1_PIN 13
#define LED1_MODE LED_MODE_WIFI
#define LED1_PIN_INVERSE 1
// Blue connected to relay

// HLW8012
#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 282060
#define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING

#define SENSOR_ENERGY_UNITS ENERGY_KWH
#define SENSOR_POWER_UNITS POWER_WATTS
// -----------------------------------------------------------------------------

#else
Expand Down
10 changes: 10 additions & 0 deletions code/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1642,3 +1642,13 @@ board = ${common.board_1m}
build_flags = ${common.build_flags_1m0m} -DMUVIT_IO_MIOBULB001
upload_port = ${common.ota_upload_port}
upload_flags = ${common.ota_upload_flags}

[env:hykker-smart-home-power-plug]
board = ${common.board_1m}
build_flags = ${common.build_flags_1m0m} -DHYKKER_SMART_HOME_POWER_PLUG

[env:hykker-smart-home-power-plug-ota]
board = ${common.board_1m}
build_flags = ${common.build_flags_1m0m} -DHYKKER_SMART_HOME_POWER_PLUG
upload_port = ${common.ota_upload_port}
upload_flags = ${common.ota_upload_flags}
Binary file added images/devices/hykker-smart-home-power-plug.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 899f646

Please sign in to comment.