Merge remote-tracking branch 'upstream/development' into max31855

This commit is contained in:
Markus Past 2018-12-30 11:50:57 +01:00
commit 1736409b18
13 changed files with 544 additions and 200 deletions

View File

@ -1,4 +1,7 @@
/* 6.4.1.2 20181228 /* 6.4.1.3 20181229
* Change sonoff_template.h module lay-out by removing non-configurable GPIOs
*
* 6.4.1.2 20181228
* Change switch driver making it modular and introduce input filter (#4665, #4724) * Change switch driver making it modular and introduce input filter (#4665, #4724)
* Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738) * Add define DS18B20_INTERNAL_PULLUP to select internal input pullup when only one DS18B20 sensor is connected eliminating external resistor (#4738)
* Add variable %timestamp% to rules (#4749) * Add variable %timestamp% to rules (#4749)

View File

@ -462,7 +462,7 @@
#define D_HX_CAL_REFERENCE "Poner Peso de Referencia" #define D_HX_CAL_REFERENCE "Poner Peso de Referencia"
#define D_HX_CAL_DONE "Calibrado" #define D_HX_CAL_DONE "Calibrado"
#define D_HX_CAL_FAIL "Falló Calibración" #define D_HX_CAL_FAIL "Falló Calibración"
#define D_RESET_HX711 "Restableces Escala" #define D_RESET_HX711 "Restablecer Escala"
#define D_CONFIGURE_HX711 "Configurar Escala" #define D_CONFIGURE_HX711 "Configurar Escala"
#define D_HX711_PARAMETERS "Parámetros de Escala" #define D_HX711_PARAMETERS "Parámetros de Escala"
#define D_ITEM_WEIGHT "Peso" #define D_ITEM_WEIGHT "Peso"

View File

@ -424,7 +424,7 @@ void SettingsDefaultSet2(void)
// Module // Module
// Settings.flag.interlock = 0; // Settings.flag.interlock = 0;
Settings.module = MODULE; Settings.module = MODULE;
// for (byte i = 0; i < MAX_GPIO_PIN; i++) { Settings.my_gp.io[i] = 0; } // for (byte i = 0; i < sizeof(Settings.my_gp); i++) { Settings.my_gp.io[i] = GPIO_NONE; }
strlcpy(Settings.friendlyname[0], FRIENDLY_NAME, sizeof(Settings.friendlyname[0])); strlcpy(Settings.friendlyname[0], FRIENDLY_NAME, sizeof(Settings.friendlyname[0]));
strlcpy(Settings.friendlyname[1], FRIENDLY_NAME"2", sizeof(Settings.friendlyname[1])); strlcpy(Settings.friendlyname[1], FRIENDLY_NAME"2", sizeof(Settings.friendlyname[1]));
strlcpy(Settings.friendlyname[2], FRIENDLY_NAME"3", sizeof(Settings.friendlyname[2])); strlcpy(Settings.friendlyname[2], FRIENDLY_NAME"3", sizeof(Settings.friendlyname[2]));
@ -742,7 +742,7 @@ void SettingsDelta(void)
Settings.altitude = 0; Settings.altitude = 0;
} }
if (Settings.version < 0x0508000B) { if (Settings.version < 0x0508000B) {
for (byte i = 0; i < MAX_GPIO_PIN; i++) { // Move GPIO_LEDs for (byte i = 0; i < sizeof(Settings.my_gp); i++) { // Move GPIO_LEDs
if ((Settings.my_gp.io[i] >= 25) && (Settings.my_gp.io[i] <= 32)) { // Was GPIO_LED1 if ((Settings.my_gp.io[i] >= 25) && (Settings.my_gp.io[i] <= 32)) { // Was GPIO_LED1
Settings.my_gp.io[i] += 23; // Move GPIO_LED1 Settings.my_gp.io[i] += 23; // Move GPIO_LED1
} }
@ -829,7 +829,7 @@ void SettingsDelta(void)
Settings.switchmode[i] = SWITCH_MODE; Settings.switchmode[i] = SWITCH_MODE;
} }
} }
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(Settings.my_gp); i++) {
if (Settings.my_gp.io[i] >= GPIO_SWT5) { // Move up from GPIO_SWT5 to GPIO_KEY1 if (Settings.my_gp.io[i] >= GPIO_SWT5) { // Move up from GPIO_SWT5 to GPIO_KEY1
Settings.my_gp.io[i] += 4; Settings.my_gp.io[i] += 4;
} }

View File

@ -175,7 +175,7 @@ byte mdns_delayed_start = 0; // mDNS delayed start
boolean latest_uptime_flag = true; // Signal latest uptime boolean latest_uptime_flag = true; // Signal latest uptime
boolean pwm_present = false; // Any PWM channel configured with SetOption15 0 boolean pwm_present = false; // Any PWM channel configured with SetOption15 0
boolean mdns_begun = false; // mDNS active boolean mdns_begun = false; // mDNS active
mytmplt my_module; // Active copy of Module name and GPIOs (23 x 8 bits) myio my_module; // Active copy of Module GPIOs (18 x 8 bits)
StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits) StateBitfield global_state; // Global states (currently Wifi and Mqtt) (8 bits)
char my_version[33]; // Composed version string char my_version[33]; // Composed version string
char my_image[33]; // Code image and/or commit char my_image[33]; // Code image and/or commit
@ -850,14 +850,13 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
Settings.last_module = Settings.module; Settings.last_module = Settings.module;
Settings.module = payload; Settings.module = payload;
if (Settings.last_module != payload) { if (Settings.last_module != payload) {
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(Settings.my_gp); i++) {
Settings.my_gp.io[i] = 0; Settings.my_gp.io[i] = GPIO_NONE;
} }
} }
restart_flag = 2; restart_flag = 2;
} }
snprintf_P(stemp1, sizeof(stemp1), kModules[Settings.module].name); snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_SVALUE, command, Settings.module +1, ModuleName().c_str());
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE_SVALUE, command, Settings.module +1, stemp1);
} }
else if (CMND_MODULES == command_code) { else if (CMND_MODULES == command_code) {
for (byte i = 0; i < MAXMODULE; i++) { for (byte i = 0; i < MAXMODULE; i++) {
@ -867,8 +866,7 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data);
} }
jsflg = 1; jsflg = 1;
snprintf_P(stemp1, sizeof(stemp1), kModules[i].name); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%d (%s)\""), mqtt_data, i +1, AnyModuleName(i).c_str());
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%d (%s)\""), mqtt_data, i +1, stemp1);
if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == MAXMODULE -1)) { if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == MAXMODULE -1)) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]}"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]}"), mqtt_data);
MqttPublishPrefixTopic_P(RESULT_OR_STAT, type); MqttPublishPrefixTopic_P(RESULT_OR_STAT, type);
@ -878,19 +876,19 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
} }
mqtt_data[0] = '\0'; mqtt_data[0] = '\0';
} }
else if ((CMND_GPIO == command_code) && (index < MAX_GPIO_PIN)) { else if ((CMND_GPIO == command_code) && (index < sizeof(Settings.my_gp))) {
mytmplt cmodule; myio cmodule;
memcpy_P(&cmodule, &kModules[Settings.module], sizeof(cmodule)); ModuleGpios(&cmodule);
if ((GPIO_USER == ValidGPIO(index, cmodule.gp.io[index])) && (payload >= 0) && (payload < GPIO_SENSOR_END)) { if ((GPIO_USER == ValidGPIO(index, cmodule.io[index])) && (payload >= 0) && (payload < GPIO_SENSOR_END)) {
bool present = false; bool present = false;
for (byte i = 0; i < sizeof(kGpioNiceList); i++) { for (byte i = 0; i < sizeof(kGpioNiceList); i++) {
uint8_t midx = pgm_read_byte(kGpioNiceList + i); uint8_t midx = pgm_read_byte(kGpioNiceList + i);
if (midx == payload) { present = true; } if (midx == payload) { present = true; }
} }
if (present) { if (present) {
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(Settings.my_gp); i++) {
if ((GPIO_USER == ValidGPIO(i, cmodule.gp.io[i])) && (Settings.my_gp.io[i] == payload)) { if ((GPIO_USER == ValidGPIO(i, cmodule.io[i])) && (Settings.my_gp.io[i] == payload)) {
Settings.my_gp.io[i] = 0; Settings.my_gp.io[i] = GPIO_NONE;
} }
} }
Settings.my_gp.io[index] = payload; Settings.my_gp.io[index] = payload;
@ -898,8 +896,8 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
} }
} }
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{")); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{"));
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(Settings.my_gp); i++) {
if (GPIO_USER == ValidGPIO(i, cmodule.gp.io[i])) { if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) {
if (jsflg) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data); if (jsflg) snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data);
jsflg = 1; jsflg = 1;
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_GPIO "%d\":\"%d (%s)\""), snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"" D_CMND_GPIO "%d\":\"%d (%s)\""),
@ -913,12 +911,12 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
} }
} }
else if (CMND_GPIOS == command_code) { else if (CMND_GPIOS == command_code) {
mytmplt cmodule; myio cmodule;
memcpy_P(&cmodule, &kModules[Settings.module], sizeof(cmodule)); ModuleGpios(&cmodule);
uint8_t midx; uint8_t midx;
for (byte i = 0; i < sizeof(kGpioNiceList); i++) { for (byte i = 0; i < sizeof(kGpioNiceList); i++) {
midx = pgm_read_byte(kGpioNiceList + i); midx = pgm_read_byte(kGpioNiceList + i);
if (!GetUsedInModule(midx, cmodule.gp.io)) { if (!GetUsedInModule(midx, cmodule.io)) {
if (!jsflg) { if (!jsflg) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_GPIOS "%d\":["), lines); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_GPIOS "%d\":["), lines);
@ -2317,7 +2315,6 @@ void GpioInit(void)
{ {
uint8_t mpin; uint8_t mpin;
uint8_t key_no_pullup = 0; uint8_t key_no_pullup = 0;
mytmplt def_module;
if (Settings.module >= MAXMODULE) { if (Settings.module >= MAXMODULE) {
Settings.module = MODULE; Settings.module = MODULE;
@ -2327,22 +2324,24 @@ void GpioInit(void)
baudrate = APP_BAUDRATE; baudrate = APP_BAUDRATE;
} }
memcpy_P(&def_module, &kModules[Settings.module], sizeof(def_module)); myio def_gp;
strlcpy(my_module.name, def_module.name, sizeof(my_module.name)); ModuleGpios(&def_gp);
for (byte i = 0; i < MAX_GPIO_PIN; i++) {
for (byte i = 0; i < sizeof(Settings.my_gp); i++) {
if (Settings.my_gp.io[i] > GPIO_NONE) { if (Settings.my_gp.io[i] > GPIO_NONE) {
my_module.gp.io[i] = Settings.my_gp.io[i]; my_module.io[i] = Settings.my_gp.io[i];
} }
if ((def_module.gp.io[i] > GPIO_NONE) && (def_module.gp.io[i] < GPIO_USER)) { if ((def_gp.io[i] > GPIO_NONE) && (def_gp.io[i] < GPIO_USER)) {
my_module.gp.io[i] = def_module.gp.io[i]; my_module.io[i] = def_gp.io[i];
} }
} }
for (byte i = 0; i < GPIO_MAX; i++) { for (byte i = 0; i < GPIO_MAX; i++) {
pin[i] = 99; pin[i] = 99;
} }
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(my_module.io); i++) {
mpin = ValidGPIO(i, my_module.gp.io[i]); mpin = ValidGPIO(i, my_module.io[i]);
// snprintf_P(log_data, sizeof(log_data), PSTR("DBG: gpio pin %d, mpin %d"), i, mpin); // snprintf_P(log_data, sizeof(log_data), PSTR("DBG: gpio pin %d, mpin %d"), i, mpin);
// AddLog(LOG_LEVEL_DEBUG); // AddLog(LOG_LEVEL_DEBUG);
@ -2397,11 +2396,11 @@ void GpioInit(void)
for (byte i = 0; i < GPIO_MAX; i++) { for (byte i = 0; i < GPIO_MAX; i++) {
if ((pin[i] >= 12) && (pin[i] <=14)) pin[i] = 99; if ((pin[i] >= 12) && (pin[i] <=14)) pin[i] = 99;
} }
my_module.gp.io[12] = GPIO_SPI_MISO; my_module.io[12] = GPIO_SPI_MISO;
pin[GPIO_SPI_MISO] = 12; pin[GPIO_SPI_MISO] = 12;
my_module.gp.io[13] = GPIO_SPI_MOSI; my_module.io[13] = GPIO_SPI_MOSI;
pin[GPIO_SPI_MOSI] = 13; pin[GPIO_SPI_MOSI] = 13;
my_module.gp.io[14] = GPIO_SPI_CLK; my_module.io[14] = GPIO_SPI_CLK;
pin[GPIO_SPI_CLK] = 14; pin[GPIO_SPI_CLK] = 14;
} }
soft_spi_flg = ((pin[GPIO_SSPI_CS] < 99) && (pin[GPIO_SSPI_SCLK] < 99) && ((pin[GPIO_SSPI_MOSI] < 99) || (pin[GPIO_SSPI_MOSI] < 99))); soft_spi_flg = ((pin[GPIO_SSPI_CS] < 99) && (pin[GPIO_SSPI_SCLK] < 99) && ((pin[GPIO_SSPI_MOSI] < 99) || (pin[GPIO_SSPI_MOSI] < 99)));
@ -2567,7 +2566,7 @@ void setup(void)
if (RtcReboot.fast_reboot_count > 4) { // Restarted 5 times if (RtcReboot.fast_reboot_count > 4) { // Restarted 5 times
Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic Settings.module = SONOFF_BASIC; // Reset module to Sonoff Basic
// Settings.last_module = SONOFF_BASIC; // Settings.last_module = SONOFF_BASIC;
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(Settings.my_gp); i++) {
Settings.my_gp.io[i] = GPIO_NONE; // Reset user defined GPIO disabling sensors Settings.my_gp.io[i] = GPIO_NONE; // Reset user defined GPIO disabling sensors
} }
} }

View File

@ -279,6 +279,7 @@ enum SupportedModules {
/********************************************************************************************/ /********************************************************************************************/
#define MAX_GPIO_PIN 18 // Number of supported GPIO #define MAX_GPIO_PIN 18 // Number of supported GPIO
#define MIN_FLASH_PINS 4 // Number of flash chip pins unusable for configuration (GPIO6, 7, 8 and 11)
const char PINS_WEMOS[] PROGMEM = "D3TXD4RXD2D1flashcFLFLolD6D7D5D8D0A0"; const char PINS_WEMOS[] PROGMEM = "D3TXD4RXD2D1flashcFLFLolD6D7D5D8D0A0";
@ -286,9 +287,13 @@ typedef struct MYIO {
uint8_t io[MAX_GPIO_PIN]; uint8_t io[MAX_GPIO_PIN];
} myio; } myio;
typedef struct MYCFGIO {
uint8_t io[MAX_GPIO_PIN - MIN_FLASH_PINS];
} mycfgio;
typedef struct MYTMPLT { typedef struct MYTMPLT {
char name[15]; char name[15];
myio gp; mycfgio gp;
} mytmplt; } mytmplt;
const uint8_t kGpioNiceList[] PROGMEM = { const uint8_t kGpioNiceList[] PROGMEM = {
@ -544,12 +549,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
0, // GPIO05 0, // GPIO05
0, // GPIO06 (SD_CLK Flash) // GPIO06 (SD_CLK Flash)
0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT) // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
0, // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT) // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO) 0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO) 0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
0, // GPIO11 (SD_CMD Flash) // GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -564,7 +569,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -577,7 +587,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
GPIO_USER, // GPIO05 Optional sensor GPIO_USER, // GPIO05 Optional sensor
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -591,7 +606,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -604,7 +624,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_RXD, // GPIO03 Relay control GPIO_RXD, // GPIO03 Relay control
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
0, 0,
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -614,7 +639,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_KEY1, // GPIO00 Button GPIO_KEY1, // GPIO00 Button
0, 0, 0, 0, 0, 0, 0, 0,
GPIO_NRG_SEL, // GPIO05 HLW8012 Sel output (1 = Voltage) GPIO_NRG_SEL, // GPIO05 HLW8012 Sel output (1 = Voltage)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_NRG_CF1, // GPIO13 HLW8012 CF1 voltage / current GPIO_NRG_CF1, // GPIO13 HLW8012 CF1 voltage / current
GPIO_HLW_CF, // GPIO14 HLW8012 CF power GPIO_HLW_CF, // GPIO14 HLW8012 CF power
@ -628,10 +658,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_REL3, // GPIO04 Sonoff 4CH Red Led and Relay 3 (0 = Off, 1 = On) GPIO_REL3, // GPIO04 Sonoff 4CH Red Led and Relay 3 (0 = Off, 1 = On)
GPIO_REL2, // GPIO05 Sonoff 4CH Red Led and Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Sonoff 4CH Red Led and Relay 2 (0 = Off, 1 = On)
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
GPIO_KEY2, // GPIO09 Button 2 GPIO_KEY2, // GPIO09 Button 2
GPIO_KEY3, // GPIO10 Button 3 GPIO_KEY3, // GPIO10 Button 3
0, // Flash connection // GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay 1 (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
GPIO_KEY4, // GPIO14 Button 4 GPIO_KEY4, // GPIO14 Button 4
@ -644,7 +676,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO02 Optional sensor GPIO_USER, // GPIO02 Optional sensor
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green/Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green/Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -655,7 +692,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -666,9 +708,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0, 0, 0,
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
0, 0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
0, // Flash connection // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09
0, // GPIO10
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -678,7 +723,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0, 0, 0, 0, 0,
GPIO_USER, // GPIO04 Optional sensor (PWM3 Green) GPIO_USER, // GPIO04 Optional sensor (PWM3 Green)
GPIO_USER, // GPIO05 Optional sensor (PWM2 Red) GPIO_USER, // GPIO05 Optional sensor (PWM2 Red)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM1, // GPIO12 Cold light (PWM0 Cold) GPIO_PWM1, // GPIO12 Cold light (PWM0 Cold)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
GPIO_PWM2, // GPIO14 Warm light (PWM1 Warm) GPIO_PWM2, // GPIO14 Warm light (PWM1 Warm)
@ -688,7 +738,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
{ "1 Channel", // 1 Channel Inching/Latching Relay using (PSA-B01 - ESP8266 and PSF-B01 - ESP8285) { "1 Channel", // 1 Channel Inching/Latching Relay using (PSA-B01 - ESP8266 and PSF-B01 - ESP8285)
GPIO_KEY1, // GPIO00 Button GPIO_KEY1, // GPIO00 Button
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -699,7 +754,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
GPIO_RXD, // GPIO03 Relay control GPIO_RXD, // GPIO03 Relay control
0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
0, 0,
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -707,7 +767,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
{ "Motor C/AC", // Motor Clockwise / Anti clockwise (PSA-B01 - ESP8266) { "Motor C/AC", // Motor Clockwise / Anti clockwise (PSA-B01 - ESP8266)
GPIO_KEY1, // GPIO00 Button GPIO_KEY1, // GPIO00 Button
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -719,7 +784,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
GPIO_USER, // GPIO05 Optional sensor GPIO_USER, // GPIO05 Optional sensor
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL2, // GPIO12 Red Led and Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO12 Red Led and Relay 2 (0 = Off, 1 = On)
GPIO_REL1, // GPIO13 Red Led and Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO13 Red Led and Relay 1 (0 = Off, 1 = On)
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -737,7 +807,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 UART0_RXD V3.1 Module Pin 3 GPIO_USER, // GPIO03 UART0_RXD V3.1 Module Pin 3
GPIO_USER, // GPIO04 V3.1 Module Pin 10 - V5.0 Module Pin 2 GPIO_USER, // GPIO04 V3.1 Module Pin 10 - V5.0 Module Pin 2
GPIO_USER, // GPIO05 V3.1 Module Pin 9 - V5.0 Module Pin 1 GPIO_USER, // GPIO05 V3.1 Module Pin 9 - V5.0 Module Pin 1
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Relay1 ( 1 = Off) GPIO_REL1, // GPIO12 Relay1 ( 1 = Off)
GPIO_REL2, // GPIO13 Relay1 ( 1 = On) GPIO_REL2, // GPIO13 Relay1 ( 1 = On)
GPIO_USER, // GPIO14 V3.1 Module Pin 5 - V5.0 GPIO_REL3_INV Relay2 ( 1 = Off) GPIO_USER, // GPIO14 V3.1 Module Pin 5 - V5.0 GPIO_REL3_INV Relay2 ( 1 = Off)
@ -751,7 +826,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
GPIO_LED1, // GPIO02 Green Led (1 = On, 0 = Off) GPIO_LED1, // GPIO02 Green Led (1 = On, 0 = Off)
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, // GPIO12 Optional sensor (pm data) GPIO_USER, // GPIO12 Optional sensor (pm data)
GPIO_KEY1, // GPIO13 Button GPIO_KEY1, // GPIO13 Button
0, 0,
@ -765,10 +845,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 RX Serial TXD and Optional sensor GPIO_USER, // GPIO03 RX Serial TXD and Optional sensor
GPIO_USER, // GPIO04 D2 Wemos I2C SDA GPIO_USER, // GPIO04 D2 Wemos I2C SDA
GPIO_USER, // GPIO05 D1 Wemos I2C SCL / Wemos Relay Shield (0 = Off, 1 = On) / Wemos WS2812B RGB led Shield GPIO_USER, // GPIO05 D1 Wemos I2C SCL / Wemos Relay Shield (0 = Off, 1 = On) / Wemos WS2812B RGB led Shield
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
GPIO_USER, // Flash connection or GPIO09 on ESP8285 only! // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
GPIO_USER, // Flash connection or GPIO10 on ESP8285 only! // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // Flash connection GPIO_USER, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
GPIO_USER, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, // GPIO12 D6 GPIO_USER, // GPIO12 D6
GPIO_USER, // GPIO13 D7 GPIO_USER, // GPIO13 D7
GPIO_USER, // GPIO14 D5 GPIO_USER, // GPIO14 D5
@ -783,7 +865,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 RX Serial TXD and Optional sensor GPIO_USER, // GPIO03 RX Serial TXD and Optional sensor
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
GPIO_USER, // GPIO05 Optional sensor GPIO_USER, // GPIO05 Optional sensor
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, // GPIO12 GPIO_USER, // GPIO12
GPIO_USER, // GPIO13 BLUE LED GPIO_USER, // GPIO13 BLUE LED
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -798,7 +885,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 RX and Optional sensor - Pin next to GND on the PCB GPIO_USER, // GPIO03 RX and Optional sensor - Pin next to GND on the PCB
GPIO_PWM5, // GPIO04 W2 - PWM5 GPIO_PWM5, // GPIO04 W2 - PWM5
GPIO_LED2_INV, // GPIO05 Red LED GPIO_LED2_INV, // GPIO05 Red LED
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM3, // GPIO12 Blue GPIO_PWM3, // GPIO12 Blue
GPIO_PWM2, // GPIO13 Green GPIO_PWM2, // GPIO13 Green
GPIO_PWM4, // GPIO14 W1 - PWM4 GPIO_PWM4, // GPIO14 W1 - PWM4
@ -811,16 +903,24 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO02 Optional sensor GPIO_USER, // GPIO02 Optional sensor
GPIO_RXD, // GPIO03 TXD to ATMEGA328P GPIO_RXD, // GPIO03 TXD to ATMEGA328P
0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
0, 0,
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
}, },
{ "Sonoff BN-SZ", // Sonoff BN-SZ01 Ceiling led (ESP8285) { "Sonoff BN-SZ", // Sonoff BN-SZ01 Ceiling led (ESP8285)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
0, 0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
0, // Flash connection // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09
0, // GPIO10
// GPIO11 (SD_CMD Flash)
GPIO_PWM1, // GPIO12 Light GPIO_PWM1, // GPIO12 Light
GPIO_LED1_INV, // GPIO13 Red Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Red Led (0 = On, 1 = Off)
0, 0, 0, 0,
@ -833,10 +933,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_REL3, // GPIO04 Sonoff 4CH Red Led and Relay 3 (0 = Off, 1 = On) GPIO_REL3, // GPIO04 Sonoff 4CH Red Led and Relay 3 (0 = Off, 1 = On)
GPIO_REL2, // GPIO05 Sonoff 4CH Red Led and Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Sonoff 4CH Red Led and Relay 2 (0 = Off, 1 = On)
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
GPIO_KEY2, // GPIO09 Button 2 GPIO_KEY2, // GPIO09 Button 2
GPIO_KEY3, // GPIO10 Button 3 GPIO_KEY3, // GPIO10 Button 3
0, // Flash connection // GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay 1 (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
GPIO_KEY4, // GPIO14 Button 4 GPIO_KEY4, // GPIO14 Button 4
@ -844,12 +946,17 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0 0, 0
}, },
{ "Huafan SS", // Hua Fan Smart Socket (ESP8266) - like Sonoff Pow { "Huafan SS", // Hua Fan Smart Socket (ESP8266) - like Sonoff Pow
GPIO_LED1_INV, // GPIO0 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO00 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0,
GPIO_LED2_INV, // GPIO3 Red Led (0 = On, 1 = Off) GPIO_LED2_INV, // GPIO03 Red Led (0 = On, 1 = Off)
GPIO_KEY1, // GPIO4 Button GPIO_KEY1, // GPIO04 Button
GPIO_REL1_INV, // GPIO5 Relay (0 = On, 1 = Off) GPIO_REL1_INV, // GPIO05 Relay (0 = On, 1 = Off)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_CF1, // GPIO12 HLW8012 CF1 voltage / current GPIO_NRG_CF1, // GPIO12 HLW8012 CF1 voltage / current
GPIO_NRG_SEL, // GPIO13 HLW8012 Sel output (1 = Voltage) GPIO_NRG_SEL, // GPIO13 HLW8012 Sel output (1 = Voltage)
GPIO_HLW_CF, // GPIO14 HLW8012 CF power GPIO_HLW_CF, // GPIO14 HLW8012 CF power
@ -862,9 +969,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_RXD, // GPIO03 RF bridge control GPIO_RXD, // GPIO03 RF bridge control
GPIO_USER, // GPIO04 Optional sensor GPIO_USER, // GPIO04 Optional sensor
GPIO_USER, // GPIO05 Optional sensor GPIO_USER, // GPIO05 Optional sensor
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
0, 0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
0, // Flash connection // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09
0, // GPIO10
// GPIO11 (SD_CMD Flash)
0, 0,
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -875,9 +985,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO02 Optional sensor SDA pad GPIO_USER, // GPIO02 Optional sensor SDA pad
GPIO_USER, // GPIO03 Serial TXD and Optional sensor pad GPIO_USER, // GPIO03 Serial TXD and Optional sensor pad
0, 0, 0, 0,
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
0, 0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
0, // Flash connection // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09
0, // GPIO10
// GPIO11 (SD_CMD Flash)
GPIO_DI, // GPIO12 my9231 DI GPIO_DI, // GPIO12 my9231 DI
0, 0,
GPIO_DCKI, // GPIO14 my9231 DCKI GPIO_DCKI, // GPIO14 my9231 DCKI
@ -889,9 +1002,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO02 Optional sensor SDA pad GPIO_USER, // GPIO02 Optional sensor SDA pad
GPIO_USER, // GPIO03 Serial TXD and Optional sensor pad GPIO_USER, // GPIO03 Serial TXD and Optional sensor pad
0, 0, 0, 0,
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
0, 0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
0, // Flash connection // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
0, 0,
GPIO_DI, // GPIO13 my9291 DI GPIO_DI, // GPIO13 my9291 DI
0, 0,
@ -904,9 +1020,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO02 Optional Sensor (J3 Pin 5) GPIO_USER, // GPIO02 Optional Sensor (J3 Pin 5)
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0, 0, 0,
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
0, 0, // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
0, // Flash connection // GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09
0, // GPIO10
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -918,10 +1037,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0,
GPIO_REL2, // GPIO05 Blue Led and Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Blue Led and Relay 2 (0 = Off, 1 = On)
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
GPIO_KEY2, // GPIO09 Button 2 GPIO_KEY2, // GPIO09 Button 2
0, 0, // GPIO10
0, // Flash connection // GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -933,10 +1054,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_REL3, // GPIO04 Blue Led and Relay 3 (0 = Off, 1 = On) GPIO_REL3, // GPIO04 Blue Led and Relay 3 (0 = Off, 1 = On)
GPIO_REL2, // GPIO05 Blue Led and Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Blue Led and Relay 2 (0 = Off, 1 = On)
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
GPIO_KEY2, // GPIO09 Button 2 GPIO_KEY2, // GPIO09 Button 2
GPIO_KEY3, // GPIO10 Button 3 GPIO_KEY3, // GPIO10 Button 3
0, // Flash connection // GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -949,7 +1072,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_KEY1, // GPIO04 Button 1 GPIO_KEY1, // GPIO04 Button 1
GPIO_REL1, // GPIO05 Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO05 Relay 1 (0 = Off, 1 = On)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, // GPIO12 Optional sensor GPIO_USER, // GPIO12 Optional sensor
GPIO_REL2, // GPIO13 Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO13 Relay 2 (0 = Off, 1 = On)
GPIO_USER, // GPIO14 Optional sensor GPIO_USER, // GPIO14 Optional sensor
@ -965,7 +1093,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_KEY1, // GPIO04 D2 push button on ESP-12F board GPIO_KEY1, // GPIO04 D2 push button on ESP-12F board
GPIO_USER, // GPIO05 D1 optional sensor GPIO_USER, // GPIO05 D1 optional sensor
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM2, // GPIO12 D6 RGB LED Green GPIO_PWM2, // GPIO12 D6 RGB LED Green
GPIO_PWM3, // GPIO13 D7 RGB LED Blue GPIO_PWM3, // GPIO13 D7 RGB LED Blue
GPIO_USER, // GPIO14 D5 optional sensor GPIO_USER, // GPIO14 D5 optional sensor
@ -982,7 +1115,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor - Module Pin 3 GPIO_USER, // GPIO03 Serial TXD and Optional sensor - Module Pin 3
GPIO_REL1, // GPIO04 Red Led and Relay (0 = Off, 1 = On) - Module Pin 10 GPIO_REL1, // GPIO04 Red Led and Relay (0 = Off, 1 = On) - Module Pin 10
GPIO_KEY1, // GPIO05 Blue Led and OptoCoupler input - Module Pin 9 GPIO_KEY1, // GPIO05 Blue Led and OptoCoupler input - Module Pin 9
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
0, 0, 0, 0, 0 0, 0, 0, 0, 0
}, },
{ "MagicHome", // Magic Home (aka Flux-light) (ESP8266) and Arilux LC10 (ESP8285) { "MagicHome", // Magic Home (aka Flux-light) (ESP8266) and Arilux LC10 (ESP8285)
@ -993,7 +1131,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_ARIRFRCV, // GPIO04 IR or RF receiver (optional) (Arilux LC10) GPIO_ARIRFRCV, // GPIO04 IR or RF receiver (optional) (Arilux LC10)
GPIO_PWM2, // GPIO05 RGB LED Green GPIO_PWM2, // GPIO05 RGB LED Green
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM3, // GPIO12 RGB LED Blue GPIO_PWM3, // GPIO12 RGB LED Blue
GPIO_USER, // GPIO13 RGBW LED White (optional - set to PWM4 for Cold White or Warm White as used on Arilux LC10) GPIO_USER, // GPIO13 RGBW LED White (optional - set to PWM4 for Cold White or Warm White as used on Arilux LC10)
GPIO_PWM1, // GPIO14 RGB LED Red GPIO_PWM1, // GPIO14 RGB LED Red
@ -1008,7 +1151,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_REL1, // GPIO04 Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO04 Relay 1 (0 = Off, 1 = On)
GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_SWT1, // GPIO12 External input 1 (0 = On, 1 = Off) GPIO_SWT1, // GPIO12 External input 1 (0 = On, 1 = Off)
GPIO_SWT2, // GPIO13 External input 2 (0 = On, 1 = Off) GPIO_SWT2, // GPIO13 External input 2 (0 = On, 1 = Off)
GPIO_USER, // GPIO14 Optional sensor / I2C SCL pad GPIO_USER, // GPIO14 Optional sensor / I2C SCL pad
@ -1022,7 +1170,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0, 0, 0, 0, 0,
GPIO_HLW_CF, // GPIO04 HLW8012 CF power GPIO_HLW_CF, // GPIO04 HLW8012 CF power
GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 voltage / current GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 voltage / current
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_SEL, // GPIO12 HLW8012 SEL (1 = Voltage) GPIO_NRG_SEL, // GPIO12 HLW8012 SEL (1 = Voltage)
GPIO_LED1_INV, // GPIO13 Green Led GPIO_LED1_INV, // GPIO13 Green Led
GPIO_REL1, // GPIO14 Relay GPIO_REL1, // GPIO14 Relay
@ -1037,7 +1190,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_ARIRFRCV, // GPIO04 IR or RF receiver (optional) GPIO_ARIRFRCV, // GPIO04 IR or RF receiver (optional)
GPIO_PWM1, // GPIO05 RGB LED Red GPIO_PWM1, // GPIO05 RGB LED Red
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM2, // GPIO12 RGB LED Green GPIO_PWM2, // GPIO12 RGB LED Green
GPIO_PWM3, // GPIO13 RGB LED Blue GPIO_PWM3, // GPIO13 RGB LED Blue
GPIO_USER, // GPIO14 RGBW LED White (optional - set to PWM4 for Cold White or Warm White) GPIO_USER, // GPIO14 RGBW LED White (optional - set to PWM4 for Cold White or Warm White)
@ -1052,7 +1210,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_PWM2, // GPIO04 RGB LED Green GPIO_PWM2, // GPIO04 RGB LED Green
GPIO_PWM1, // GPIO05 RGB LED Red GPIO_PWM1, // GPIO05 RGB LED Red
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM5, // GPIO12 RGBCW LED Warm GPIO_PWM5, // GPIO12 RGBCW LED Warm
GPIO_PWM4, // GPIO13 RGBW LED Cold GPIO_PWM4, // GPIO13 RGBW LED Cold
GPIO_PWM3, // GPIO14 RGB LED Blue GPIO_PWM3, // GPIO14 RGB LED Blue
@ -1066,10 +1229,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0,
GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On) GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On)
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
GPIO_USER, // GPIO09 Button 1 on header (0 = On, 1 = Off) GPIO_USER, // GPIO09 Button 1 on header (0 = On, 1 = Off)
GPIO_KEY1, // GPIO10 Button on casing GPIO_KEY1, // GPIO10 Button on casing
0, // Flash connection // GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Relay 1 (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Relay 1 (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -1082,7 +1247,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_USER, // GPIO04 W2 - PWM5 GPIO_USER, // GPIO04 W2 - PWM5
0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM2, // GPIO12 RGB LED Green GPIO_PWM2, // GPIO12 RGB LED Green
GPIO_PWM3, // GPIO13 RGB LED Blue GPIO_PWM3, // GPIO13 RGB LED Blue
GPIO_PWM1, // GPIO14 RGB LED Red GPIO_PWM1, // GPIO14 RGB LED Red
@ -1095,7 +1265,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
0, // GPIO03 Serial TXD 0, // GPIO03 Serial TXD
0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -1108,7 +1283,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
GPIO_USER, // GPIO04 W2 - PWM5 GPIO_USER, // GPIO04 W2 - PWM5
0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM2, // GPIO12 RGB LED Green GPIO_PWM2, // GPIO12 RGB LED Green
GPIO_PWM1, // GPIO13 RGB LED Red GPIO_PWM1, // GPIO13 RGB LED Red
GPIO_PWM3, // GPIO14 RGB LED Blue GPIO_PWM3, // GPIO14 RGB LED Blue
@ -1120,7 +1300,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
0, // GPIO03 Serial TXD 0, // GPIO03 Serial TXD
0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0
@ -1132,10 +1317,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 ESP_RXD Serial TXD and Optional sensor GPIO_USER, // GPIO03 ESP_RXD Serial TXD and Optional sensor
GPIO_REL3, // GPIO04 WIFI_O2 Relay 3 (0 = Off, 1 = On) controlling the fan GPIO_REL3, // GPIO04 WIFI_O2 Relay 3 (0 = Off, 1 = On) controlling the fan
GPIO_REL2, // GPIO05 WIFI_O1 Relay 2 (0 = Off, 1 = On) controlling the fan GPIO_REL2, // GPIO05 WIFI_O1 Relay 2 (0 = Off, 1 = On) controlling the fan
0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
GPIO_KEY2, // GPIO09 WIFI_KEY1 Virtual button 2 as feedback from RC GPIO_KEY2, // GPIO09 WIFI_KEY1 Virtual button 2 as feedback from RC
GPIO_KEY3, // GPIO10 WIFI_KEY2 Virtual button 3 as feedback from RC GPIO_KEY3, // GPIO10 WIFI_KEY2 Virtual button 3 as feedback from RC
0, // Flash connection // GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 WIFI_O0 Relay 1 (0 = Off, 1 = On) controlling the light GPIO_REL1, // GPIO12 WIFI_O0 Relay 1 (0 = Off, 1 = On) controlling the light
GPIO_LED1_INV, // GPIO13 WIFI_CHK Blue Led on PCA (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 WIFI_CHK Blue Led on PCA (0 = On, 1 = Off)
GPIO_KEY4, // GPIO14 WIFI_KEY3 Virtual button 4 as feedback from RC GPIO_KEY4, // GPIO14 WIFI_KEY3 Virtual button 4 as feedback from RC
@ -1153,37 +1340,57 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
0, 0,
GPIO_HJL_CF, // GPIO05 BL0937 or HJL-01 CF power GPIO_HJL_CF, // GPIO05 BL0937 or HJL-01 CF power
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage)
GPIO_KEY1, // GPIO13 Button GPIO_KEY1, // GPIO13 Button
GPIO_NRG_CF1, // GPIO14 BL0937 or HJL-01 CF1 current / voltage GPIO_NRG_CF1, // GPIO14 BL0937 or HJL-01 CF1 current / voltage
GPIO_REL1, // GPIO15 Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO15 Relay (0 = Off, 1 = On)
0, 0 0, 0
}, },
{ "Shelly 1", // Shelly1 Open Source (ESP8266 - 2MB) - https://shelly.cloud/shelly1-open-source/ { "Shelly 1", // Shelly1 Open Source (ESP8266 - 2MB) - https://shelly.cloud/shelly1-open-source/
0, 0, 0, 0, 0, 0, 0, 0,
GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On)
GPIO_SWT1_NP, // GPIO05 SW pin GPIO_SWT1_NP, // GPIO05 SW pin
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0
}, },
{ "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/ { "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/
0, 0,
GPIO_TXD, // GPIO01 MCP39F501 Serial input GPIO_TXD, // GPIO01 MCP39F501 Serial input
0, 0,
GPIO_RXD, // GPIO03 MCP39F501 Serial output GPIO_RXD, // GPIO03 MCP39F501 Serial output
GPIO_REL1, // GPIO04 GPIO_REL1, // GPIO04
GPIO_REL2, // GPIO05 GPIO_REL2, // GPIO05
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
GPIO_SWT1, // GPIO12 // GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_SWT1, // GPIO12
0, 0,
GPIO_SWT2, // GPIO14 GPIO_SWT2, // GPIO14
0, // GPIO15 MCP39F501 Reset 0, // GPIO15 MCP39F501 Reset
0, 0 0, 0
}, },
{ "Xiaomi Philips", // Xiaomi Philips bulb (ESP8266) { "Xiaomi Philips", // Xiaomi Philips bulb (ESP8266)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM2, // GPIO12 cold/warm light GPIO_PWM2, // GPIO12 cold/warm light
0, 0, 0, 0,
GPIO_PWM1, // GPIO15 light intensity GPIO_PWM1, // GPIO15 light intensity
@ -1194,7 +1401,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0,
GPIO_LED1_INV, // GPIO04 Red Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO04 Red Led (0 = On, 1 = Off)
0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_KEY1, // GPIO13 Button GPIO_KEY1, // GPIO13 Button
0, 0, 0, 0 0, 0, 0, 0
@ -1207,7 +1419,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_KEY1, // GPIO04 Button 1 GPIO_KEY1, // GPIO04 Button 1
GPIO_REL2_INV, // GPIO05 Red Led 2 (0 = On, 1 = Off) GPIO_REL2_INV, // GPIO05 Red Led 2 (0 = On, 1 = Off)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL4_INV, // GPIO12 Blue Led 4 (0 = On, 1 = Off) GPIO_REL4_INV, // GPIO12 Blue Led 4 (0 = On, 1 = Off)
GPIO_KEY4, // GPIO13 Button 4 GPIO_KEY4, // GPIO13 Button 4
GPIO_KEY3, // GPIO14 Button 3 GPIO_KEY3, // GPIO14 Button 3
@ -1221,7 +1438,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD GPIO_USER, // GPIO03 Serial TXD
GPIO_LED1, // GPIO04 Blue LED GPIO_LED1, // GPIO04 Blue LED
GPIO_REL1, // GPIO05 (Relay OFF, but used as Relay Switch) GPIO_REL1, // GPIO05 (Relay OFF, but used as Relay Switch)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_LED2, // GPIO12 (Relay ON, but set to LOW, so we can switch with GPIO05) GPIO_LED2, // GPIO12 (Relay ON, but set to LOW, so we can switch with GPIO05)
GPIO_USER, // GPIO13 GPIO_USER, // GPIO13
GPIO_KEY1, // GPIO14 Button GPIO_KEY1, // GPIO14 Button
@ -1236,7 +1458,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_LED2_INV, // GPIO03 Serial RXD and Red Led (0 = On, 1 = Off) GPIO_LED2_INV, // GPIO03 Serial RXD and Red Led (0 = On, 1 = Off)
GPIO_HJL_CF, // GPIO04 BL0937 or HJL-01 CF power GPIO_HJL_CF, // GPIO04 BL0937 or HJL-01 CF power
GPIO_NRG_CF1, // GPIO05 BL0937 or HJL-01 CF1 current / voltage GPIO_NRG_CF1, // GPIO05 BL0937 or HJL-01 CF1 current / voltage
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage)
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
GPIO_REL1, // GPIO14 Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO14 Relay (0 = Off, 1 = On)
@ -1248,7 +1475,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_KEY1, // GPIO03 Button GPIO_KEY1, // GPIO03 Button
GPIO_HLW_CF, // GPIO04 HLW8012 CF power GPIO_HLW_CF, // GPIO04 HLW8012 CF power
GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 current / voltage GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 current / voltage
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_SEL_INV, // GPIO12 HLW8012 CF Sel output (0 = Voltage) GPIO_NRG_SEL_INV, // GPIO12 HLW8012 CF Sel output (0 = Voltage)
GPIO_LED1_INV, // GPIO13 LED (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 LED (0 = On, 1 = Off)
GPIO_REL1, // GPIO14 Relay SRU 5VDC SDA (0 = Off, 1 = On ) GPIO_REL1, // GPIO14 Relay SRU 5VDC SDA (0 = Off, 1 = On )
@ -1262,7 +1494,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 MCU serial control GPIO_USER, // GPIO03 MCU serial control
GPIO_USER, GPIO_USER,
GPIO_USER, GPIO_USER,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, GPIO_USER,
GPIO_USER, GPIO_USER,
GPIO_USER, // GPIO14 Green Led GPIO_USER, // GPIO14 Green Led
@ -1277,22 +1514,32 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_KEY1, // GPIO03 Serial TXD and Button GPIO_KEY1, // GPIO03 Serial TXD and Button
GPIO_HJL_CF, // GPIO04 BL0937 or HJL-01 CF power GPIO_HJL_CF, // GPIO04 BL0937 or HJL-01 CF power
GPIO_NRG_CF1, // GPIO05 BL0937 or HJL-01 CF1 current / voltage GPIO_NRG_CF1, // GPIO05 BL0937 or HJL-01 CF1 current / voltage
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage)
GPIO_LED2_INV, // GPIO13 LED2 (red) inv GPIO_LED2_INV, // GPIO13 LED2 (red) inv
GPIO_REL1, // GPIO14 Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO14 Relay (0 = Off, 1 = On)
0, 0, 0 0, 0, 0
}, },
{ "ARMTR Dimmer", // ARMTRONIX Dimmer, one or two channel (ESP8266 w/ separate MCU dimmer) { "ARMTR Dimmer", // ARMTRONIX Dimmer, one or two channel (ESP8266 w/ separate MCU dimmer)
// https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-two-triac-board/ // https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-two-triac-board/
// https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-esp8266-one-triac-board-alexaecho/ // https://www.tindie.com/products/Armtronix/wifi-ac-dimmer-esp8266-one-triac-board-alexaecho/
GPIO_USER, GPIO_USER,
GPIO_TXD, // GPIO01 MCU serial control GPIO_TXD, // GPIO01 MCU serial control
GPIO_USER, GPIO_USER,
GPIO_RXD, // GPIO03 MCU serial control GPIO_RXD, // GPIO03 MCU serial control
GPIO_USER, GPIO_USER,
GPIO_USER, GPIO_USER,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, GPIO_USER,
GPIO_USER, GPIO_USER,
GPIO_USER, GPIO_USER,
@ -1305,7 +1552,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0, 0, 0, 0, 0,
GPIO_HLW_CF, // GPIO04 HLW8012 CF power GPIO_HLW_CF, // GPIO04 HLW8012 CF power
GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 current / voltage GPIO_NRG_CF1, // GPIO05 HLW8012 CF1 current / voltage
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_SEL_INV, // GPIO12 HLW8012 CF Sel output (0 = Voltage) GPIO_NRG_SEL_INV, // GPIO12 HLW8012 CF Sel output (0 = Voltage)
GPIO_LED2_INV, // GPIO13 Red Led (0 = On, 1 = Off) GPIO_LED2_INV, // GPIO13 Red Led (0 = On, 1 = Off)
GPIO_LED1_INV, // GPIO14 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO14 Blue Led (0 = On, 1 = Off)
@ -1320,7 +1572,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_RXD, // GPIO03 MCU serial control GPIO_RXD, // GPIO03 MCU serial control
GPIO_USER, GPIO_USER,
GPIO_USER, GPIO_USER,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, GPIO_USER,
GPIO_LED1, // GPIO13 WiFi LED GPIO_LED1, // GPIO13 WiFi LED
GPIO_USER, GPIO_USER,
@ -1337,7 +1594,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On)
GPIO_HJL_CF, // GPIO05 BL0937 or HJL-01 CF power GPIO_HJL_CF, // GPIO05 BL0937 or HJL-01 CF power
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage) GPIO_NRG_SEL_INV, // GPIO12 BL0937 or HJL-01 Sel output (0 = Voltage)
GPIO_KEY1, // GPIO13 Button GPIO_KEY1, // GPIO13 Button
GPIO_NRG_CF1, // GPIO14 BL0937 or HJL-01 CF1 current / voltage GPIO_NRG_CF1, // GPIO14 BL0937 or HJL-01 CF1 current / voltage
@ -1352,7 +1614,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_KEY1, // GPIO03 Serial TXD + Button GPIO_KEY1, // GPIO03 Serial TXD + Button
GPIO_REL2, // GPIO04 Relay 2 GPIO_REL2, // GPIO04 Relay 2
GPIO_REL1, // GPIO05 Relay 1 GPIO_REL1, // GPIO05 Relay 1
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL3, // GPIO12 Relay 3 GPIO_REL3, // GPIO12 Relay 3
GPIO_REL4, // GPIO13 Relay 4 GPIO_REL4, // GPIO13 Relay 4
GPIO_USER, // GPIO14 GPIO_USER, // GPIO14
@ -1373,7 +1640,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor GPIO_USER, // GPIO03 Serial TXD and Optional sensor
GPIO_USER, // GPIO04 IR receiver (optional) GPIO_USER, // GPIO04 IR receiver (optional)
GPIO_PWM2, // GPIO05 RGB LED Green GPIO_PWM2, // GPIO05 RGB LED Green
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM3, // GPIO12 RGB LED Blue GPIO_PWM3, // GPIO12 RGB LED Blue
GPIO_USER, // GPIO13 RGBW LED White (optional - set to PWM4 for Cold White or Warm White) GPIO_USER, // GPIO13 RGBW LED White (optional - set to PWM4 for Cold White or Warm White)
GPIO_PWM1, // GPIO14 RGB LED Red GPIO_PWM1, // GPIO14 RGB LED Red
@ -1389,7 +1661,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 Serial TXD and Optional sensor0 GPIO_USER, // GPIO03 Serial TXD and Optional sensor0
GPIO_ARIRFRCV, // GPIO04 RF receiver input GPIO_ARIRFRCV, // GPIO04 RF receiver input
GPIO_PWM2, // GPIO05 RGB LED Green GPIO_PWM2, // GPIO05 RGB LED Green
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM3, // GPIO12 RGB LED Blue GPIO_PWM3, // GPIO12 RGB LED Blue
GPIO_PWM4, // GPIO13 RGBW LED White GPIO_PWM4, // GPIO13 RGBW LED White
GPIO_PWM1, // GPIO14 RGB LED Red GPIO_PWM1, // GPIO14 RGB LED Red
@ -1402,7 +1679,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_KEY2, // GPIO03 Serial TXD and Optional sensor GPIO_KEY2, // GPIO03 Serial TXD and Optional sensor
GPIO_REL2, // GPIO04 Relay 2 GPIO_REL2, // GPIO04 Relay 2
GPIO_KEY3, // GPIO05 Input 2 GPIO_KEY3, // GPIO05 Input 2
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_KEY1, // GPIO12 Key input GPIO_KEY1, // GPIO12 Key input
GPIO_REL1, // GPIO13 Relay 1 GPIO_REL1, // GPIO13 Relay 1
0, 0,
@ -1414,7 +1696,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0,
GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO04 Relay (0 = Off, 1 = On)
0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_KEY1, // GPIO12 Button GPIO_KEY1, // GPIO12 Button
0, 0, 0, 0,
GPIO_LED1, // GPIO15 Led (1 = On, 0 = Off) GPIO_LED1, // GPIO15 Led (1 = On, 0 = Off)
@ -1425,7 +1712,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0,
GPIO_LED1_INV, // GPIO04 Blue Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO04 Blue Led (0 = On, 1 = Off)
0, // GPIO05 IR or RF receiver (optional) 0, // GPIO05 IR or RF receiver (optional)
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Relay and Red Led (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Relay and Red Led (0 = Off, 1 = On)
GPIO_KEY1, // GPIO13 Button GPIO_KEY1, // GPIO13 Button
0, 0, 0, 0 0, 0, 0, 0
@ -1438,7 +1730,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 GPIO_USER, // GPIO03
GPIO_LED1_INV, // GPIO04 Blue LED GPIO_LED1_INV, // GPIO04 Blue LED
GPIO_REL1, // GPIO05 Red LED and relay GPIO_REL1, // GPIO05 Red LED and relay
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
0, 0,
GPIO_KEY1, // GPIO13 Button (normally GPIO00) GPIO_KEY1, // GPIO13 Button (normally GPIO00)
GPIO_USER, // GPIO14 GPIO_USER, // GPIO14
@ -1451,7 +1748,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0,
GPIO_USER, // GPIO04 IR receiver (optional) GPIO_USER, // GPIO04 IR receiver (optional)
GPIO_PWM2, // GPIO05 RGB LED Green GPIO_PWM2, // GPIO05 RGB LED Green
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_PWM1, // GPIO12 RGB LED Red GPIO_PWM1, // GPIO12 RGB LED Red
GPIO_PWM3, // GPIO13 RGB LED Blue GPIO_PWM3, // GPIO13 RGB LED Blue
0, 0,
@ -1466,7 +1768,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO03 (D8) Serial TXD GPIO_USER, // GPIO03 (D8) Serial TXD
GPIO_USER, // GPIO04 (D4) 4 x WS2812 Leds, (DOUT) Extents WS2812 string GPIO_USER, // GPIO04 (D4) 4 x WS2812 Leds, (DOUT) Extents WS2812 string
GPIO_USER, // GPIO05 (D5) Blue Led GPIO_USER, // GPIO05 (D5) Blue Led
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_USER, // GPIO12 (D12) GPIO_USER, // GPIO12 (D12)
GPIO_USER, // GPIO13 (D13) GPIO_USER, // GPIO13 (D13)
GPIO_USER, // GPIO14 (D14) GPIO_USER, // GPIO14 (D14)
@ -1478,7 +1785,12 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
{ "Delock 11826", // Delock 11826 (ESP8285) = Sonoff Basic { "Delock 11826", // Delock 11826 (ESP8285) = Sonoff Basic
GPIO_KEY1, // GPIO00 Button GPIO_KEY1, // GPIO00 Button
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, // Flash connection // GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On) GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off) GPIO_LED1_INV, // GPIO13 Green Led (0 = On, 1 = Off)
0, 0, 0, 0 0, 0, 0, 0

View File

@ -20,7 +20,7 @@
#ifndef _SONOFF_VERSION_H_ #ifndef _SONOFF_VERSION_H_
#define _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_
#define VERSION 0x06040102 #define VERSION 0x06040103
#define D_PROGRAMNAME "Sonoff-Tasmota" #define D_PROGRAMNAME "Sonoff-Tasmota"
#define D_AUTHOR "Theo Arends" #define D_AUTHOR "Theo Arends"

View File

@ -492,6 +492,43 @@ String PressureUnit(void)
return (Settings.flag.pressure_conversion) ? String(D_UNIT_MILLIMETER_MERCURY) : String(D_UNIT_PRESSURE); return (Settings.flag.pressure_conversion) ? String(D_UNIT_MILLIMETER_MERCURY) : String(D_UNIT_PRESSURE);
} }
String AnyModuleName(uint8_t index)
{
return FPSTR(kModules[index].name);
}
String ModuleName()
{
return FPSTR(kModules[Settings.module].name);
}
void ModuleGpios(myio *gp)
{
uint8_t *dest = (uint8_t *)gp;
memset(dest, GPIO_NONE, sizeof(myio));
uint8_t src[sizeof(mycfgio)];
memcpy_P(&src, &kModules[Settings.module].gp, sizeof(mycfgio));
// 11 85 00 85 85 00 00 00 15 38 85 00 00 81
// AddLogSerial(LOG_LEVEL_DEBUG, (uint8_t *)&src, sizeof(mycfgio));
for (uint8_t i = 0; i < sizeof(mycfgio); i++) {
if (i < 6) {
dest[i] = src[i]; // GPIO00 - GPIO05
}
else if (i < 8) {
dest[i +3] = src[i]; // GPIO09 - GPIO10
}
else {
dest[i +4] = src[i]; // GPIO12 - GPIO16 and ADC0
}
}
// 11 85 00 85 85 00 00 00 00 00 00 00 15 38 85 00 00 81
// AddLogSerial(LOG_LEVEL_DEBUG, (uint8_t *)gp, sizeof(myio));
}
void SetGlobalValues(float temperature, float humidity) void SetGlobalValues(float temperature, float humidity)
{ {
global_update = uptime; global_update = uptime;

View File

@ -169,7 +169,7 @@ const char HTTP_SCRIPT_MODULE2[] PROGMEM =
"x.send();" "x.send();"
"}"; "}";
const char HTTP_SCRIPT_MODULE3[] PROGMEM = const char HTTP_SCRIPT_MODULE3[] PROGMEM =
"}1'%d'>%s (%02d)}2"; // "}1" and "}2" means do not use "}x" in Module name and Sensor name "}1'%d'>%s (%d)}2"; // "}1" and "}2" means do not use "}x" in Module name and Sensor name
const char HTTP_SCRIPT_INFO_BEGIN[] PROGMEM = const char HTTP_SCRIPT_INFO_BEGIN[] PROGMEM =
"function i(){" "function i(){"
@ -492,7 +492,7 @@ void ShowPage(String &page, bool auth)
} }
page.replace(F("{a}"), String(Settings.web_refresh)); page.replace(F("{a}"), String(Settings.web_refresh));
page.replace(F("{ha"), my_module.name); page.replace(F("{ha"), ModuleName());
page.replace(F("{h}"), Settings.friendlyname[0]); page.replace(F("{h}"), Settings.friendlyname[0]);
String info = ""; String info = "";
@ -798,21 +798,20 @@ void HandleModuleConfiguration(void)
char stemp[20]; char stemp[20];
uint8_t midx; uint8_t midx;
mytmplt cmodule; myio cmodule;
memcpy_P(&cmodule, &kModules[Settings.module], sizeof(cmodule)); ModuleGpios(&cmodule);
if (WebServer->hasArg("m")) { if (WebServer->hasArg("m")) {
String page = ""; String page = "";
for (byte i = 0; i < MAXMODULE; i++) { for (byte i = 0; i < MAXMODULE; i++) {
midx = pgm_read_byte(kModuleNiceList + i); midx = pgm_read_byte(kModuleNiceList + i);
snprintf_P(stemp, sizeof(stemp), kModules[midx].name); snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SCRIPT_MODULE3, midx, AnyModuleName(midx).c_str(), midx +1);
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SCRIPT_MODULE3, midx, stemp, midx +1);
page += mqtt_data; page += mqtt_data;
} }
page += "}3"; // String separator means do not use "}3" in Module name and Sensor name page += "}3"; // String separator means do not use "}3" in Module name and Sensor name
for (byte j = 0; j < sizeof(kGpioNiceList); j++) { for (byte j = 0; j < sizeof(kGpioNiceList); j++) {
midx = pgm_read_byte(kGpioNiceList + j); midx = pgm_read_byte(kGpioNiceList + j);
if (!GetUsedInModule(midx, cmodule.gp.io)) { if (!GetUsedInModule(midx, cmodule.io)) {
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SCRIPT_MODULE3, midx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), midx); snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SCRIPT_MODULE3, midx, GetTextIndexed(stemp, sizeof(stemp), midx, kSensorNames), midx);
page += mqtt_data; page += mqtt_data;
} }
@ -827,9 +826,9 @@ void HandleModuleConfiguration(void)
page.replace(F("{v}"), FPSTR(S_CONFIGURE_MODULE)); page.replace(F("{v}"), FPSTR(S_CONFIGURE_MODULE));
page += FPSTR(HTTP_SCRIPT_MODULE1); page += FPSTR(HTTP_SCRIPT_MODULE1);
page.replace(F("}4"), String(Settings.module)); page.replace(F("}4"), String(Settings.module));
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(cmodule); i++) {
if (GPIO_USER == ValidGPIO(i, cmodule.gp.io[i])) { if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("sk(%d,%d);"), my_module.gp.io[i], i); // g0 - g16 snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("sk(%d,%d);"), my_module.io[i], i); // g0 - g16
page += mqtt_data; page += mqtt_data;
} }
} }
@ -837,11 +836,10 @@ void HandleModuleConfiguration(void)
page += FPSTR(HTTP_HEAD_STYLE); page += FPSTR(HTTP_HEAD_STYLE);
page.replace(F("<body>"), F("<body onload='sl()'>")); page.replace(F("<body>"), F("<body onload='sl()'>"));
page += FPSTR(HTTP_FORM_MODULE); page += FPSTR(HTTP_FORM_MODULE);
snprintf_P(stemp, sizeof(stemp), kModules[MODULE].name); page.replace(F("{mt"), AnyModuleName(MODULE));
page.replace(F("{mt"), stemp);
page += F("<br/><table>"); page += F("<br/><table>");
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(cmodule); i++) {
if (GPIO_USER == ValidGPIO(i, cmodule.gp.io[i])) { if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) {
snprintf_P(stemp, 3, PINS_WEMOS +i*2); snprintf_P(stemp, 3, PINS_WEMOS +i*2);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("<tr><td style='width:190px'>%s <b>" D_GPIO "%d</b> %s</td><td style='width:160px'><select id='g%d' name='g%d'></select></td></tr>"), snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("<tr><td style='width:190px'>%s <b>" D_GPIO "%d</b> %s</td><td style='width:160px'><select id='g%d' name='g%d'></select></td></tr>"),
(WEMOS==Settings.module)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :(9==i)? "<font color='red'>ESP8285</font>" :(10==i)? "<font color='red'>ESP8285</font>" :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i, i); (WEMOS==Settings.module)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :(9==i)? "<font color='red'>ESP8285</font>" :(10==i)? "<font color='red'>ESP8285</font>" :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i, i);
@ -863,14 +861,14 @@ void ModuleSaveSettings(void)
byte new_module = (!strlen(tmp)) ? MODULE : atoi(tmp); byte new_module = (!strlen(tmp)) ? MODULE : atoi(tmp);
Settings.last_module = Settings.module; Settings.last_module = Settings.module;
Settings.module = new_module; Settings.module = new_module;
mytmplt cmodule; myio cmodule;
memcpy_P(&cmodule, &kModules[Settings.module], sizeof(cmodule)); ModuleGpios(&cmodule);
String gpios = ""; String gpios = "";
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(cmodule); i++) {
if (Settings.last_module != new_module) { if (Settings.last_module != new_module) {
Settings.my_gp.io[i] = 0; Settings.my_gp.io[i] = 0;
} else { } else {
if (GPIO_USER == ValidGPIO(i, cmodule.gp.io[i])) { if (GPIO_USER == ValidGPIO(i, cmodule.io[i])) {
snprintf_P(stemp, sizeof(stemp), PSTR("g%d"), i); snprintf_P(stemp, sizeof(stemp), PSTR("g%d"), i);
WebGetArg(stemp, tmp, sizeof(tmp)); WebGetArg(stemp, tmp, sizeof(tmp));
Settings.my_gp.io[i] = (!strlen(tmp)) ? 0 : atoi(tmp); Settings.my_gp.io[i] = (!strlen(tmp)) ? 0 : atoi(tmp);
@ -878,8 +876,7 @@ void ModuleSaveSettings(void)
} }
} }
} }
snprintf_P(stemp, sizeof(stemp), kModules[Settings.module].name); snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), ModuleName().c_str(), gpios.c_str());
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MODULE "%s " D_CMND_MODULE "%s"), stemp, gpios.c_str());
AddLog(LOG_LEVEL_INFO); AddLog(LOG_LEVEL_INFO);
} }

View File

@ -415,8 +415,7 @@ void MqttConnected(void)
if (mqtt_initial_connection_state) { if (mqtt_initial_connection_state) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_FALLBACKTOPIC "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\"}"), snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_FALLBACKTOPIC "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\"}"),
my_module.name, my_version, my_image, GetFallbackTopic_P(stopic, CMND, ""), Settings.mqtt_grptopic); ModuleName().c_str(), my_version, my_image, GetFallbackTopic_P(stopic, CMND, ""), Settings.mqtt_grptopic);
// my_module.name, my_version, my_image, mqtt_client, Settings.mqtt_grptopic);
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "1")); MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "1"));
#ifdef USE_WEBSERVER #ifdef USE_WEBSERVER
if (Settings.webserver) { if (Settings.webserver) {

View File

@ -373,15 +373,15 @@ void LightInit(void)
} }
} }
if (SONOFF_LED == Settings.module) { // Fix Sonoff Led instabilities if (SONOFF_LED == Settings.module) { // Fix Sonoff Led instabilities
if (!my_module.gp.io[4]) { if (!my_module.io[4]) {
pinMode(4, OUTPUT); // Stop floating outputs pinMode(4, OUTPUT); // Stop floating outputs
digitalWrite(4, LOW); digitalWrite(4, LOW);
} }
if (!my_module.gp.io[5]) { if (!my_module.io[5]) {
pinMode(5, OUTPUT); // Stop floating outputs pinMode(5, OUTPUT); // Stop floating outputs
digitalWrite(5, LOW); digitalWrite(5, LOW);
} }
if (!my_module.gp.io[14]) { if (!my_module.io[14]) {
pinMode(14, OUTPUT); // Stop floating outputs pinMode(14, OUTPUT); // Stop floating outputs
digitalWrite(14, LOW); digitalWrite(14, LOW);
} }

View File

@ -465,11 +465,11 @@ void KNX_INIT(void)
// and activate options according to the hardware // and activate options according to the hardware
/*for (int i = GPIO_REL1; i < GPIO_REL8 + 1; ++i) /*for (int i = GPIO_REL1; i < GPIO_REL8 + 1; ++i)
{ {
if (GetUsedInModule(i, my_module.gp.io)) { device_param[i - GPIO_REL1].show = true; } if (GetUsedInModule(i, my_module.io)) { device_param[i - GPIO_REL1].show = true; }
} }
for (int i = GPIO_REL1_INV; i < GPIO_REL8_INV + 1; ++i) for (int i = GPIO_REL1_INV; i < GPIO_REL8_INV + 1; ++i)
{ {
if (GetUsedInModule(i, my_module.gp.io)) { device_param[i - GPIO_REL1_INV].show = true; } if (GetUsedInModule(i, my_module.io)) { device_param[i - GPIO_REL1_INV].show = true; }
}*/ }*/
for (int i = 0; i < devices_present; ++i) for (int i = 0; i < devices_present; ++i)
{ {
@ -477,27 +477,27 @@ void KNX_INIT(void)
} }
for (int i = GPIO_SWT1; i < GPIO_SWT4 + 1; ++i) for (int i = GPIO_SWT1; i < GPIO_SWT4 + 1; ++i)
{ {
if (GetUsedInModule(i, my_module.gp.io)) { device_param[i - GPIO_SWT1 + 8].show = true; } if (GetUsedInModule(i, my_module.io)) { device_param[i - GPIO_SWT1 + 8].show = true; }
} }
for (int i = GPIO_KEY1; i < GPIO_KEY4 + 1; ++i) for (int i = GPIO_KEY1; i < GPIO_KEY4 + 1; ++i)
{ {
if (GetUsedInModule(i, my_module.gp.io)) { device_param[i - GPIO_KEY1 + 8].show = true; } if (GetUsedInModule(i, my_module.io)) { device_param[i - GPIO_KEY1 + 8].show = true; }
} }
for (int i = GPIO_SWT1_NP; i < GPIO_SWT4_NP + 1; ++i) for (int i = GPIO_SWT1_NP; i < GPIO_SWT4_NP + 1; ++i)
{ {
if (GetUsedInModule(i, my_module.gp.io)) { device_param[i - GPIO_SWT1_NP + 8].show = true; } if (GetUsedInModule(i, my_module.io)) { device_param[i - GPIO_SWT1_NP + 8].show = true; }
} }
for (int i = GPIO_KEY1_NP; i < GPIO_KEY4_NP + 1; ++i) for (int i = GPIO_KEY1_NP; i < GPIO_KEY4_NP + 1; ++i)
{ {
if (GetUsedInModule(i, my_module.gp.io)) { device_param[i - GPIO_KEY1_NP + 8].show = true; } if (GetUsedInModule(i, my_module.io)) { device_param[i - GPIO_KEY1_NP + 8].show = true; }
} }
if (GetUsedInModule(GPIO_DHT11, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } if (GetUsedInModule(GPIO_DHT11, my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; }
if (GetUsedInModule(GPIO_DHT22, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } if (GetUsedInModule(GPIO_DHT22, my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; }
if (GetUsedInModule(GPIO_SI7021, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } if (GetUsedInModule(GPIO_SI7021, my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; }
if (GetUsedInModule(GPIO_DSB, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } if (GetUsedInModule(GPIO_DSB, my_module.io)) { device_param[KNX_TEMPERATURE-1].show = true; }
if (GetUsedInModule(GPIO_DHT11, my_module.gp.io)) { device_param[KNX_HUMIDITY-1].show = true; } if (GetUsedInModule(GPIO_DHT11, my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; }
if (GetUsedInModule(GPIO_DHT22, my_module.gp.io)) { device_param[KNX_HUMIDITY-1].show = true; } if (GetUsedInModule(GPIO_DHT22, my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; }
if (GetUsedInModule(GPIO_SI7021, my_module.gp.io)) { device_param[KNX_HUMIDITY-1].show = true; } if (GetUsedInModule(GPIO_SI7021, my_module.io)) { device_param[KNX_HUMIDITY-1].show = true; }
// Sonoff 31 or Sonoff Pow or any HLW8012 based device or Sonoff POW R2 or Any device with a Pzem004T // Sonoff 31 or Sonoff Pow or any HLW8012 based device or Sonoff POW R2 or Any device with a Pzem004T
if ( ( SONOFF_S31 == Settings.module ) || ( SONOFF_POW_R2 == Settings.module ) || ( energy_flg != ENERGY_NONE ) ) { if ( ( SONOFF_S31 == Settings.module ) || ( SONOFF_POW_R2 == Settings.module ) || ( energy_flg != ENERGY_NONE ) ) {

View File

@ -237,10 +237,9 @@ void HAssAnnounceRelayLight(void)
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_LIGHT_CT, mqtt_data, color_temp_command_topic, state_topic); snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_LIGHT_CT, mqtt_data, color_temp_command_topic, state_topic);
} }
} }
snprintf_P(stemp1, sizeof(stemp1), kModules[Settings.module].name);
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data, snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data,
unique_id, ESP.getChipId(), unique_id, ESP.getChipId(),
Settings.friendlyname[0], stemp1, my_version, my_image, "Tasmota"); Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image, "Tasmota");
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
} }
@ -287,10 +286,9 @@ void HAssAnnounceButtonSwitch(byte device, char* topic, byte present, byte key,
if (toggle) snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_BUTTON_SWITCH_TOGGLE, mqtt_data); if (toggle) snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_BUTTON_SWITCH_TOGGLE, mqtt_data);
else snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_BUTTON_SWITCH_ONOFF, mqtt_data, Settings.state_text[0]); else snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_BUTTON_SWITCH_ONOFF, mqtt_data, Settings.state_text[0]);
snprintf_P(stemp1, sizeof(stemp1), kModules[Settings.module].name);
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data, snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data,
unique_id, ESP.getChipId(), unique_id, ESP.getChipId(),
Settings.friendlyname[0], stemp1, my_version, my_image, "Tasmota"); Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image, "Tasmota");
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
} }
@ -413,10 +411,9 @@ void HAssAnnounceSensor(const char* sensorname, const char* subsensortype)
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_SENSOR_ANY, snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_SENSOR_ANY,
mqtt_data, sensorname, subsensortype); mqtt_data, sensorname, subsensortype);
} }
snprintf_P(stemp1, sizeof(stemp1), kModules[Settings.module].name);
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data, snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_DEVICE_INFO, mqtt_data,
unique_id, ESP.getChipId(), unique_id, ESP.getChipId(),
Settings.friendlyname[0], stemp1, my_version, my_image, "Tasmota"); Settings.friendlyname[0], ModuleName().c_str(), my_version, my_image, "Tasmota");
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix); snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_TOPIC_PREFIX, mqtt_data, prefix);
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
} }

View File

@ -248,7 +248,7 @@ void TuyaPacketProcess(void)
uint8_t key1_gpio = tuya_buffer[7]; uint8_t key1_gpio = tuya_buffer[7];
boolean key1_set = false; boolean key1_set = false;
boolean led1_set = false; boolean led1_set = false;
for (byte i = 0; i < MAX_GPIO_PIN; i++) { for (byte i = 0; i < sizeof(Settings.my_gp); i++) {
if (Settings.my_gp.io[i] == GPIO_LED1) led1_set = true; if (Settings.my_gp.io[i] == GPIO_LED1) led1_set = true;
else if (Settings.my_gp.io[i] == GPIO_KEY1) key1_set = true; else if (Settings.my_gp.io[i] == GPIO_KEY1) key1_set = true;
} }