Add reset-button-handler vor tuya-dimmer

This commit is contained in:
Joel Stein 2018-10-18 16:02:40 +02:00
parent d1c807998f
commit cfdec25bcb
1 changed files with 14 additions and 1 deletions

View File

@ -1723,7 +1723,20 @@ void ButtonHandler()
ExecuteCommandPower(button_index +1, POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally
}
}
} else {
}
#ifdef USE_TUYA_DIMMER
else if (TUYA_DIMMER == Settings.module) {
if ((PRESSED == button) && (NOT_PRESSED == lastbutton[button_index])) {
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1);
AddLog(LOG_LEVEL_DEBUG);
if (!Settings.flag.button_restrict) {
snprintf_P(scmnd, sizeof(scmnd), D_CMND_WIFICONFIG " %d", 2);
ExecuteCommand(scmnd, SRC_BUTTON);
}
}
}
#endif
else {
if ((PRESSED == button) && (NOT_PRESSED == lastbutton[button_index])) {
if (Settings.flag.button_single) { // Allow only single button press for immediate action
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1);