From 57a441a811ec0b6734ae4283690e746192e2900b Mon Sep 17 00:00:00 2001 From: orrpan Date: Mon, 13 Jan 2020 12:31:17 +0100 Subject: [PATCH] Deltaco smart home (#2103) * add support for DELTACO SH-P01 * renaming deltaco_sh_le14w to deltaco_sh_lexxw * add support Deltaco SH-P03USB and SH-LEXXRGB --- code/espurna/config/arduino.h | 4 ++ code/espurna/config/hardware.h | 104 +++++++++++++++++++++++++++++++++ code/espurna/migrate.ino | 56 ++++++++++++++++++ code/platformio.ini | 40 +++++++++++++ 4 files changed, 204 insertions(+) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 76fc1f44..4886e85b 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -26,6 +26,10 @@ //#define BLITZWOLF_BWSHPX //#define BLITZWOLF_BWSHPX_V23 //#define BLITZWOLF_BWSHP5 +//#define DELTACO_SH_LEXXW +//#define DELTACO_SH_LEXXRGB +//#define DELTACO_SH_P01 +//#define DELTACO_SH_P03USB //#define DIGOO_NX_SP202 //#define EHOMEDIY_WT02 //#define EHOMEDIY_WT03 diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 3f6695e1..d5a7d4ae 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -2831,6 +2831,64 @@ #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// Deltaco SH_P01 Wifi Smart Power Plug +// ----------------------------------------------------------------------------- + +#elif defined(DELTACO_SH_P01) + + // Info + #define MANUFACTURER "DELTACO" + #define DEVICE "SH_P01" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 5 + #define LED1_PIN_INVERSE 1 + #define LED1_MODE LED_MODE_FINDME + + +// ------------------------------------------------------------------------------ +// DELTACO_SH_P03USB Wifi Smart Power Plug +// ----------------------------------------------------------------------------- + +#elif defined(DELTACO_SH_P03USB) + + // Info + #define MANUFACTURER "DELTACO" + #define DEVICE "SH_P03USB" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP + #define BUTTON1_RELAY 2 + + // Relays + #define RELAY1_PIN 15 // USB power + #define RELAY2_PIN 12 // power plug 1 + #define RELAY3_PIN 14 // power plug 2 + #define RELAY4_PIN 5 // power plug 3 + + #define RELAY1_TYPE RELAY_TYPE_NORMAL + #define RELAY2_TYPE RELAY_TYPE_NORMAL + #define RELAY3_TYPE RELAY_TYPE_NORMAL + #define RELAY4_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 0 // power led + #define LED1_PIN_INVERSE 1 + #define LED1_MODE LED_MODE_FINDME + + + // ------------------------------------------------------------------------------ // Fornorm Wi-Fi USB Extension Socket (ZLD-34EU) // https://www.aliexpress.com/item/Fornorm-WiFi-Extension-Socket-with-Surge-Protector-Smart-Power-Strip-3-Outlets-and-4-USB-Charging/32849743948.html @@ -3621,6 +3679,52 @@ #define LIGHT_CH3_INVERSE 0 #define LIGHT_CH4_INVERSE 0 +// ----------------------------------------------------------------------------- +// Deltaco white e14 (SH-LE14W) and e27 (SH-LE27W) +// ----------------------------------------------------------------------------- + +#elif defined(DELTACO_SH_LEXXW) + + // Info + #define MANUFACTURER "DELTACO" + #define DEVICE "SH_LEXXW" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + // Light + #define LIGHT_CHANNELS 2 + #define LIGHT_CH1_PIN 12 // WARM WHITE + #define LIGHT_CH2_PIN 14 // COLD WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + +// ----------------------------------------------------------------------------- +// Deltaco rgbw e27 (SH-LE27RGB) +// ----------------------------------------------------------------------------- + +#elif defined(DELTACO_SH_LEXXRGB) + + // Info + #define MANUFACTURER "DELTACO" + #define DEVICE "SH_LEXXRGB" + #define RELAY_PROVIDER RELAY_PROVIDER_LIGHT + #define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER + #define DUMMY_RELAY_COUNT 1 + + // Light + #define LIGHT_CHANNELS 5 + #define LIGHT_CH1_PIN 5 // RED + #define LIGHT_CH2_PIN 4 // GREEN + #define LIGHT_CH3_PIN 13 // BLUE + #define LIGHT_CH4_PIN 14 // WARM WHITE + #define LIGHT_CH5_PIN 12 // COLD WHITE + #define LIGHT_CH1_INVERSE 0 + #define LIGHT_CH2_INVERSE 0 + #define LIGHT_CH3_INVERSE 0 + #define LIGHT_CH4_INVERSE 0 + #define LIGHT_CH5_INVERSE 0 + // ----------------------------------------------------------------------------- // Nexete A19 // https://www.ebay.com/itm/Wifi-Smart-LED-light-Bulb-9W-60W-A19-850LM-RGBW-Dimmable-for-Alexa-Google-Home/283514779201 diff --git a/code/espurna/migrate.ino b/code/espurna/migrate.ino index 91cc3ebd..292a48a0 100644 --- a/code/espurna/migrate.ino +++ b/code/espurna/migrate.ino @@ -1414,6 +1414,62 @@ void migrate() { setSetting("chLogic", 3, 0); setSetting("relays", 1); + #elif defined(DELTACO_SH_P01) + + setSetting("board", 105); + setSetting("ledGPIO", 0, 5); + setSetting("ledLogic", 0, 1); + setSetting("ledMode", 0, LED_MODE_FOLLOW); + setSetting("btnGPIO", 0, 13); + setSetting("btnRelay", 0, 0); + setSetting("relayGPIO", 0, 12); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + + #elif defined(DELTACO_SH_P03USB) + + setSetting("board", 106); + setSetting("btnGPIO", 0, 13); + setSetting("btnRelay", 0, 2); + setSetting("ledGPIO", 0, 0); + setSetting("ledLogic", 0, 1); + setSetting("ledMode", 0, LED_MODE_FINDME); + setSetting("relayGPIO", 0, 15); + setSetting("relayGPIO", 1, 12); + setSetting("relayGPIO", 2, 14); + setSetting("relayGPIO", 3, 5); + setSetting("relayType", 0, RELAY_TYPE_NORMAL); + setSetting("relayType", 1, RELAY_TYPE_NORMAL); + setSetting("relayType", 2, RELAY_TYPE_NORMAL); + setSetting("relayType", 3, RELAY_TYPE_NORMAL); + + #elif defined(DELTACO_SH_LEXXW) + + setSetting("board", 107); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("chGPIO", 0, 12); + setSetting("chGPIO", 1, 14); + setSetting("chLogic", 0, 0); + setSetting("chLogic", 1, 0); + setSetting("relays", 1); + + #elif defined(DELTACO_SH_LEXXRGB) + + setSetting("board", 108); + setSetting("relayProvider", RELAY_PROVIDER_LIGHT); + setSetting("lightProvider", LIGHT_PROVIDER_DIMMER); + setSetting("chGPIO", 0, 5); + setSetting("chGPIO", 1, 4); + setSetting("chGPIO", 2, 13); + setSetting("chGPIO", 3, 14); + setSetting("chGPIO", 4, 12); + setSetting("chLogic", 0, 0); + setSetting("chLogic", 1, 0); + setSetting("chLogic", 2, 0); + setSetting("chLogic", 3, 0); + setSetting("chLogic", 4, 0); + setSetting("relays", 1); + #else // Allow users to define new settings without migration config diff --git a/code/platformio.ini b/code/platformio.ini index 58e641e9..6b82b1a3 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -1222,6 +1222,46 @@ build_flags = ${common.build_flags_1m0m} -DNEO_COOLCAM_NAS_WR01W upload_port = ${common.ota_upload_port} upload_flags = ${common.ota_upload_flags} +[env:deltaco-sh-p01] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_P01 + +[env:deltaco-sh-p01-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_P01 +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + +[env:deltaco-sh-p03usb] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_P03USB + +[env:deltaco-sh-p03usb-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_P03USB +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + +[env:deltaco-sh-lexxw] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_LEXXW + +[env:deltaco-sh-lexxw-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_LEXXW +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + +[env:deltaco-sh-lexxrgb] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_LEXXRGB + +[env:deltaco-sh-lexxrgb-ota] +board = ${common.board_1m} +build_flags = ${common.build_flags_1m0m} -DDELTACO_SH_LEXXRGB +upload_port = ${common.ota_upload_port} +upload_flags = ${common.ota_upload_flags} + [env:estink-wifi-power-strip] board = ${common.board_1m} build_flags = ${common.build_flags_1m0m} -DFORNORM_ZLD_34EU