Add global timer cntrl to webpage

Add command Timers 0/1 to globally disable or enable armed timers (#3270)
This commit is contained in:
Theo Arends 2018-07-21 16:47:44 +02:00
parent a8d373dd2c
commit a4eddcb518
18 changed files with 24 additions and 3 deletions

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Конфигуриране на таймер"
#define D_TIMER_PARAMETERS "Параметри на таймера"
#define D_TIMER_ENABLE "Активиране на таймера"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Време"
#define D_TIMER_DAYS "Дни"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Nastavení Časovače"
#define D_TIMER_PARAMETERS "Časovač"
#define D_TIMER_ENABLE "Povol Časovače"
#define D_TIMER_ARM "Aktivní"
#define D_TIMER_TIME "Čas"
#define D_TIMER_DAYS "Dny"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Zeitplan konfigurieren"
#define D_TIMER_PARAMETERS "Zeitplan-Einstellungen"
#define D_TIMER_ENABLE "Zeitpläne aktivieren"
#define D_TIMER_ARM "Aktiv"
#define D_TIMER_TIME "Uhrzeit"
#define D_TIMER_DAYS "Wochentage"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Ρυθμίσεις Χρόνου"
#define D_TIMER_PARAMETERS "Χρονικοί παράμετροι"
#define D_TIMER_ENABLE "Ενεργοποιημένο Χρονικοί"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Ωρα"
#define D_TIMER_DAYS "Μέρες"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configure Timer"
#define D_TIMER_PARAMETERS "Timer parameters"
#define D_TIMER_ENABLE "Enable Timers"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Time"
#define D_TIMER_DAYS "Days"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configuración Temporizadores"
#define D_TIMER_PARAMETERS "Parámetros de Temporizadores"
#define D_TIMER_ENABLE "Habilitar Temporizadores"
#define D_TIMER_ARM "Activo"
#define D_TIMER_TIME "Hora"
#define D_TIMER_DAYS "Días"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configuration des Timers"
#define D_TIMER_PARAMETERS "Paramètres Timer"
#define D_TIMER_ENABLE "Activer des Timers"
#define D_TIMER_ARM "Armer"
#define D_TIMER_TIME "Temps"
#define D_TIMER_DAYS "Jours"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configure Timer"
#define D_TIMER_PARAMETERS "Timer parameters"
#define D_TIMER_ENABLE "Enable Timers"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Time"
#define D_TIMER_DAYS "Days"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configura Timer"
#define D_TIMER_PARAMETERS "Parametri Timer"
#define D_TIMER_ENABLE "Abilita Timers"
#define D_TIMER_ARM "Attiva"
#define D_TIMER_TIME "Ora"
#define D_TIMER_DAYS "Giorni"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configureer Tijdschakelaar"
#define D_TIMER_PARAMETERS "Tijdschakelaar parameters"
#define D_TIMER_ENABLE "Tijdschakelaars inschakelen"
#define D_TIMER_ARM "Actief"
#define D_TIMER_TIME "Tijd"
#define D_TIMER_DAYS "Dagen"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configure Timer"
#define D_TIMER_PARAMETERS "Timer parameters"
#define D_TIMER_ENABLE "Enable Timers"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Time"
#define D_TIMER_DAYS "Days"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configurar temporizador"
#define D_TIMER_PARAMETERS "Parâmetros"
#define D_TIMER_ENABLE "Habilitar temporizadores"
#define D_TIMER_ARM "Habilitar"
#define D_TIMER_TIME "Horário"
#define D_TIMER_DAYS "Dias"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configure Timer"
#define D_TIMER_PARAMETERS "Timer parameters"
#define D_TIMER_ENABLE "Enable Timers"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Time"
#define D_TIMER_DAYS "Days"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configure Timer"
#define D_TIMER_PARAMETERS "Timer parameters"
#define D_TIMER_ENABLE "Enable Timers"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Time"
#define D_TIMER_DAYS "Days"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Конфігурація таймеру"
#define D_TIMER_PARAMETERS "Налаштування таймеру"
#define D_TIMER_ENABLE "Увімкнений таймеру"
#define D_TIMER_ARM "Увімкнений"
#define D_TIMER_TIME "Час"
#define D_TIMER_DAYS "Дні"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "定时器设置"
#define D_TIMER_PARAMETERS "定时器参数"
#define D_TIMER_ENABLE "启用定时器"
#define D_TIMER_ARM "启用"
#define D_TIMER_TIME "时间"
#define D_TIMER_DAYS "天"

View File

@ -380,6 +380,7 @@
// xdrv_09_timers.ino
#define D_CONFIGURE_TIMER "Configure Timer"
#define D_TIMER_PARAMETERS "Timer parameters"
#define D_TIMER_ENABLE "Enable Timers"
#define D_TIMER_ARM "Arm"
#define D_TIMER_TIME "Time"
#define D_TIMER_DAYS "Days"

View File

@ -637,7 +637,9 @@ const char HTTP_TIMER_STYLE[] PROGMEM =
"</style>";
const char HTTP_FORM_TIMER[] PROGMEM =
"<fieldset style='min-width:470px;text-align:center;'><legend style='text-align:left;'><b>&nbsp;" D_TIMER_PARAMETERS "&nbsp;</b></legend><form method='post' action='sv'>"
"<input id='w' name='w' value='7,0' hidden><input id='t0' name='t0' value='";
"<input id='w' name='w' value='7,0' hidden>"
"<br/><input style='width:5%;' id='e0' name='e0' type='checkbox'{e0><b>" D_TIMER_ENABLE "</b><br/><br/><hr/>"
"<input id='t0' name='t0' value='";
const char HTTP_FORM_TIMER1[] PROGMEM =
"' hidden><div id='bt' name='bt'></div><br/><br/><br/>"
"<div id='oa' name='oa'></div><br/>"
@ -683,6 +685,7 @@ void HandleTimerConfiguration()
page += FPSTR(HTTP_HEAD_STYLE);
page.replace(F("</style>"), FPSTR(HTTP_TIMER_STYLE));
page += FPSTR(HTTP_FORM_TIMER);
page.replace(F("{e0"), (Settings.flag3.timers_enable) ? F(" checked") : F(""));
for (byte i = 0; i < MAX_TIMERS; i++) {
if (i > 0) { page += F(","); }
page += String(Settings.timer[i].data);
@ -706,9 +709,10 @@ void TimerSaveSettings()
char tmp[MAX_TIMERS *12]; // Need space for MAX_TIMERS x 10 digit numbers separated by a comma
Timer timer;
Settings.flag3.timers_enable = WebServer->hasArg("e0");
WebGetArg("t0", tmp, sizeof(tmp));
char *p = tmp;
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_CMND_TIMERS " "));
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_CMND_TIMERS " %d"), Settings.flag3.timers_enable);
for (byte i = 0; i < MAX_TIMERS; i++) {
timer.data = strtol(p, &p, 10);
p++; // Skip comma
@ -717,7 +721,7 @@ void TimerSaveSettings()
Settings.timer[i].data = timer.data;
if (flag) TimerSetRandomWindow(i);
}
snprintf_P(log_data, sizeof(log_data), PSTR("%s%s0x%08X"), log_data, (i > 0)?",":"", Settings.timer[i].data);
snprintf_P(log_data, sizeof(log_data), PSTR("%s,0x%08X"), log_data, Settings.timer[i].data);
}
AddLog(LOG_LEVEL_DEBUG);
}