diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 98b293f4..dcdec570 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -11,6 +11,7 @@ //#define ALLNET_4DUINO_IOT_WLAN_RELAIS //#define ALLTERCO_SHELLY1 //#define ALLTERCO_SHELLY2 +//#define ALLTERCO_SHELLY1PM //#define ARILUX_AL_LC01 //#define ARILUX_AL_LC02 //#define ARILUX_AL_LC02_V14 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 41e61082..f296dc39 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -3103,6 +3103,51 @@ #define RELAY2_PIN 5 #define RELAY2_TYPE RELAY_TYPE_NORMAL +#elif defined(ALLTERCO_SHELLY1PM) + // Info + #define MANUFACTURER "ALLTERCO" + #define DEVICE "SHELLY1PM" + + // Buttons + #define BUTTON1_PIN 4 + #define BUTTON1_MODE BUTTON_SWITCH + #define BUTTON1_RELAY 1 + + #define BUTTON2_PIN 2 + #define BUTTON2_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON2_LNGCLICK BUTTON_MODE_RESET + #define BUTTON2_LNGLNGCLICK BUTTON_MODE_FACTORY + + // Relays + #define RELAY1_PIN 15 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // Light + #define LED1_PIN 0 + #define LED1_PIN_INVERSE 1 + + // HJL01 / BL0937 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 13 + #define HLW8012_CF_PIN 5 + + #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 + + //Temperature + #define NTC_SUPPORT 1 + #define SENSOR_SUPPORT 1 + #define NTC_BETA 3350 + #define NTC_R_UP 10000 + #define NTC_R_DOWN 0 + #define NTC_R0 10000 + // ----------------------------------------------------------------------------- #elif defined(LOHAS_9W) diff --git a/code/platformio.ini b/code/platformio.ini index 7723ca7b..a1f60f5a 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1384,6 +1384,16 @@ build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY2 upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} +[env:allterco-shelly1pm] +board = ${common.board_2m} +build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY1PM + +[env:allterco-shelly1pm-ota] +board = ${common.board_2m} +build_flags = ${common.build_flags_2m1m} -DALLTERCO_SHELLY1PM +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + [env:xiaomi-smart-desk-lamp] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DXIAOMI_SMART_DESK_LAMP